From cf9912cd61c9499fc60a839042fcae1ac556e044 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Thu, 24 Aug 2023 18:38:46 +0200 Subject: Add visual feedback and control for scale roots --- src/sequencer.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'src/sequencer.c') diff --git a/src/sequencer.c b/src/sequencer.c index 3635657..f3dff04 100644 --- a/src/sequencer.c +++ b/src/sequencer.c @@ -15,7 +15,6 @@ bool redraw_channels = true; bool redraw_bank_buttons = true; bool redraw_params = true; bool redraw_bpm = true; -bool redraw_piano_note = true; bool redraw_scale = true; bool update_bpm = false; u8 bar_counter = 0; @@ -352,7 +351,6 @@ play_step(void) { bar_counter++; } step_counter = (step_counter + 1) % 16; - redraw_piano_note = true; } void @@ -457,7 +455,6 @@ handle_channel_selection(void) { trig_selection_loc = 0; param_selection_loc = 0; input_handler = handle_trigger_selection; - redraw_piano_note = true; redraw_params = true; } else if (key_tap(KEY_LEFT)) { input_handler = handle_pattern_selection; @@ -503,7 +500,6 @@ stop_sound(void) { SOUND_NOISE_CTRL = 0; redraw_play_pause = true; redraw_pattern_buttons = true; - redraw_piano_note = true; } void @@ -544,7 +540,6 @@ toggle_playing(void) { SOUND_NOISE_CTRL = 0; redraw_play_pause = true; redraw_pattern_buttons = true; - redraw_piano_note = true; if (settings.sync == SYNC_IN_LINK) { return; } @@ -685,12 +680,18 @@ handle_right_col_selection(void) { } } break; case R_COL_SCALE: { - current_scale--; - if (current_scale < 0) { - current_scale = SCALE_NUM - 1; + if (key_hold(KEY_SELECT)) { + current_scale_root--; + if (current_scale_root < 0) { + current_scale_root = 11; + } + } else { + current_scale--; + if (current_scale < 0) { + current_scale = SCALE_NUM - 1; + } + redraw_scale = true; } - // TODO: add root note change & keyboard viz. - redraw_scale = true; } break; } } else if (key_tap(KEY_R)) { @@ -714,11 +715,15 @@ handle_right_col_selection(void) { } } break; case R_COL_SCALE: { - current_scale++; - if (current_scale >= SCALE_NUM) { - current_scale = 0; + if (key_hold(KEY_SELECT)) { + current_scale_root = (current_scale_root + 1) % 12; + } else { + current_scale++; + if (current_scale >= SCALE_NUM) { + current_scale = 0; + } + redraw_scale = true; } - redraw_scale = true; } break; } } else if (key_tap(KEY_B)) { @@ -1293,7 +1298,6 @@ handle_trigger_selection(void) { } trig->active ^= 1; redraw_trigs = true; - redraw_piano_note = true; } } else if (key_tap(KEY_L)) { s32 inc = -1; @@ -1305,7 +1309,6 @@ handle_trigger_selection(void) { trig->note = scale_note(trig->note, inc); } redraw_trigs = true; - redraw_piano_note = true; } else if (key_tap(KEY_R)) { s32 inc = 1; if (key_hold(KEY_SELECT)) { @@ -1316,7 +1319,6 @@ handle_trigger_selection(void) { trig->note = scale_note(trig->note, inc); } redraw_trigs = true; - redraw_piano_note = true; } // Move trigger cursor. @@ -1328,7 +1330,6 @@ handle_trigger_selection(void) { trig_selection_loc = MAX(trig_selection_loc - 1, 0); } redraw_params = true; - redraw_piano_note = true; } else if (key_tap(KEY_RIGHT)) { if (trig_selection_loc != 7 && trig_selection_loc != 15) { trig_selection_loc = MIN(trig_selection_loc + 1, 15); @@ -1340,11 +1341,9 @@ handle_trigger_selection(void) { input_handler = handle_right_col_selection; } redraw_params = true; - redraw_piano_note = true; } else if (key_tap(KEY_UP) || key_tap(KEY_DOWN)) { trig_selection_loc = (trig_selection_loc + 8) % 16; redraw_params = true; - redraw_piano_note = true; } else if (key_tap(KEY_A)) { if (key_hold(KEY_SELECT)) { if (patterns[pattern_selection_loc].empty) { @@ -1364,7 +1363,6 @@ handle_trigger_selection(void) { case 3: { input_handler = handle_param_selection_noise; } break; } redraw_params = true; - redraw_piano_note = true; } } } -- cgit v1.2.1