Mercurial > hg > dmlib
diff ppl.c @ 203:bed7457cd8da
Improve channel mute control. Now shift+M will toggle mute of all channels,
ctrl+M will clear all mutes and 'M' alone will toggle one channel.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 07 Oct 2012 12:09:44 +0300 |
parents | 844f38cbff65 |
children | 247b03797fc9 |
line wrap: on
line diff
--- a/ppl.c Sun Oct 07 08:53:51 2012 +0300 +++ b/ppl.c Sun Oct 07 12:09:44 2012 +0300 @@ -526,13 +526,11 @@ } -void dmMuteChannels(int nchannel) +void dmMuteChannels(BOOL mute) { int i; for (i = 0; i < engine.mod->nchannels; i++) - jvmMute(engine.dev, i, TRUE); - - jvmMute(engine.dev, nchannel, FALSE); + jvmMute(engine.dev, i, mute); } int main(int argc, char *argv[]) @@ -540,6 +538,7 @@ BOOL initSDL = FALSE; DMResource *file = NULL; int result = -1; + BOOL muteState = FALSE; memset(&engine, 0, sizeof(engine)); @@ -690,8 +689,10 @@ if (optMuteOChannels >= 0 && optMuteOChannels < engine.mod->nchannels) { - dmMuteChannels(optMuteOChannels); + dmMuteChannels(TRUE); + jvmMute(engine.dev, optMuteOChannels, FALSE); engine.actChannel = optMuteOChannels; + muteState = TRUE; } // Initialize video @@ -742,13 +743,21 @@ } break; - case SDLK_RETURN: - jvmMute(engine.dev, engine.actChannel, !jvmGetMute(engine.dev, engine.actChannel)); - force = TRUE; - break; - case SDLK_m: - dmMuteChannels(engine.actChannel); + if (engine.event.key.keysym.mod & KMOD_SHIFT) + { + muteState = !muteState; + dmMuteChannels(muteState); + } + else + if (engine.event.key.keysym.mod & KMOD_CTRL) + { + dmMuteChannels(FALSE); + } + else + { + jvmMute(engine.dev, engine.actChannel, !jvmGetMute(engine.dev, engine.actChannel)); + } force = TRUE; break;