aboutsummaryrefslogtreecommitdiffstats
path: root/src/sequencer.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-08-25 11:57:37 +0200
committerBad Diode <bd@badd10de.dev>2023-08-25 11:57:37 +0200
commit439f5564e4a92f91a43a7f36d734f6bd96effd63 (patch)
tree9dae2644ca5ab91f4711a2275b2fbc6c0689f66c /src/sequencer.c
parenteaf5d404450c4e467b981db1ea79c6871667a52e (diff)
downloadstepper-439f5564e4a92f91a43a7f36d734f6bd96effd63.tar.gz
stepper-439f5564e4a92f91a43a7f36d734f6bd96effd63.zip
Add global mutes behaviour
Diffstat (limited to 'src/sequencer.c')
-rw-r--r--src/sequencer.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/sequencer.c b/src/sequencer.c
index 07f3012..58714cb 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -151,7 +151,8 @@ play_step(void) {
151 } 151 }
152 chain.playing = true; 152 chain.playing = true;
153 } 153 }
154 if (pat->ch1.active && !pat->empty) { 154 bool ch1_active = settings.global_mute ? !settings.mutes[0] : pat->ch1.active;
155 if (ch1_active && !pat->empty) {
155 TriggerNote *trig = &pat->ch1.notes[step_counter]; 156 TriggerNote *trig = &pat->ch1.notes[step_counter];
156 ChannelSquareParams *params = &pat->ch1.params[step_counter]; 157 ChannelSquareParams *params = &pat->ch1.params[step_counter];
157 if (trig->active && should_play(params->prob)) { 158 if (trig->active && should_play(params->prob)) {
@@ -196,7 +197,8 @@ play_step(void) {
196 SOUND_SQUARE1_FREQ = SOUND_FREQ_RESET; 197 SOUND_SQUARE1_FREQ = SOUND_FREQ_RESET;
197 SOUND_SQUARE1_CTRL = 0; 198 SOUND_SQUARE1_CTRL = 0;
198 } 199 }
199 if (pat->ch2.active && !pat->empty) { 200 bool ch2_active = settings.global_mute ? !settings.mutes[1] : pat->ch2.active;
201 if (ch2_active && !pat->empty) {
200 TriggerNote *trig = &pat->ch2.notes[step_counter]; 202 TriggerNote *trig = &pat->ch2.notes[step_counter];
201 ChannelSquareParams *params = &pat->ch2.params[step_counter]; 203 ChannelSquareParams *params = &pat->ch2.params[step_counter];
202 if (trig->active && should_play(params->prob)) { 204 if (trig->active && should_play(params->prob)) {
@@ -222,7 +224,8 @@ play_step(void) {
222 SOUND_SQUARE2_FREQ = SOUND_FREQ_RESET; 224 SOUND_SQUARE2_FREQ = SOUND_FREQ_RESET;
223 SOUND_SQUARE2_CTRL = 0; 225 SOUND_SQUARE2_CTRL = 0;
224 } 226 }
225 if (pat->ch3.active && !pat->empty) { 227 bool ch3_active = settings.global_mute ? !settings.mutes[2] : pat->ch3.active;
228 if (ch3_active && !pat->empty) {
226 TriggerNote *trig = &pat->ch3.notes[step_counter]; 229 TriggerNote *trig = &pat->ch3.notes[step_counter];
227 ChannelWaveParams *params = &pat->ch3.params[step_counter]; 230 ChannelWaveParams *params = &pat->ch3.params[step_counter];
228 if (trig->active && should_play(params->prob)) { 231 if (trig->active && should_play(params->prob)) {
@@ -271,7 +274,8 @@ play_step(void) {
271 SOUND_WAVE_FREQ = SOUND_FREQ_RESET; 274 SOUND_WAVE_FREQ = SOUND_FREQ_RESET;
272 SOUND_WAVE_CTRL = SOUND_WAVE_MUTE; 275 SOUND_WAVE_CTRL = SOUND_WAVE_MUTE;
273 } 276 }
274 if (pat->ch4.active && !pat->empty) { 277 bool ch4_active = settings.global_mute ? !settings.mutes[3] : pat->ch4.active;
278 if (ch4_active && !pat->empty) {
275 TriggerNote *trig = &pat->ch4.notes[step_counter]; 279 TriggerNote *trig = &pat->ch4.notes[step_counter];
276 ChannelNoiseParams *params = &pat->ch4.params[step_counter]; 280 ChannelNoiseParams *params = &pat->ch4.params[step_counter];
277 if (trig->active && should_play(params->prob)) { 281 if (trig->active && should_play(params->prob)) {
@@ -384,10 +388,10 @@ handle_channel_selection(void) {
384 clear_pattern(pattern_selection_loc); 388 clear_pattern(pattern_selection_loc);
385 } 389 }
386 switch (channel_selection_loc) { 390 switch (channel_selection_loc) {
387 case 0: { pat->ch1.active ^= 1; } break; 391 case 0: { if (settings.global_mute) { settings.mutes[0] ^= 1; } else { pat->ch1.active ^= 1; } } break;
388 case 1: { pat->ch2.active ^= 1; } break; 392 case 1: { if (settings.global_mute) { settings.mutes[1] ^= 1; } else { pat->ch2.active ^= 1; } } break;
389 case 2: { pat->ch3.active ^= 1; } break; 393 case 2: { if (settings.global_mute) { settings.mutes[2] ^= 1; } else { pat->ch3.active ^= 1; } } break;
390 case 3: { pat->ch4.active ^= 1; } break; 394 case 3: { if (settings.global_mute) { settings.mutes[3] ^= 1; } else { pat->ch4.active ^= 1; } } break;
391 } 395 }
392 redraw_channels = true; 396 redraw_channels = true;
393 } 397 }