From ea1900c2d8d3d9f555ebbfa76dabcadcc8e4c174 Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Thu, 28 Sep 2017 19:03:07 +0300 Subject: [PATCH] Add buttons to toggle channels on/off in music editor #193 --- src/music.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/music.c b/src/music.c index e507827..fad35ec 100644 --- a/src/music.c +++ b/src/music.c @@ -1126,7 +1126,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel) } } -static void drawTumbler(Music* music, s32 x, s32 y, s32 i) +static void drawTumbler(Music* music, s32 x, s32 y, s32 index) { tic_mem* tic = music->tic; @@ -1141,11 +1141,18 @@ static void drawTumbler(Music* music, s32 x, s32 y, s32 i) showTooltip("on/off channel"); if(checkMouseClick(&rect, SDL_BUTTON_LEFT)) - music->tracker.patterns[i] = !music->tracker.patterns[i]; + { + if (SDL_GetModState() & KMOD_CTRL) + { + for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++) + music->tracker.patterns[i] = i == index; + } + else music->tracker.patterns[index] = !music->tracker.patterns[index]; + } } u8 color = Chroma; - tic->api.sprite(tic, &tic->config.gfx, music->tracker.patterns[i] ? On : Off, x, y, &color, 1); + tic->api.sprite(tic, &tic->config.gfx, music->tracker.patterns[index] ? On : Off, x, y, &color, 1); } static void drawTracker(Music* music, s32 x, s32 y)