From 8cdbb1a2ceba6f4d0c0d8453a9e07268e248e3a6 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Wed, 5 Apr 2023 11:55:14 +0200 Subject: Improve parameter adjustment by using key_released --- src/sequencer.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/sequencer.c b/src/sequencer.c index 6944b39..285b4ef 100644 --- a/src/sequencer.c +++ b/src/sequencer.c @@ -16,6 +16,8 @@ sram_write(u8 *src, u16 pos, u16 n_bytes) { } void set_time(int bpm); +void clipboard_paste(void); +void clipboard_copy(void); // // Color indexes. @@ -2130,10 +2132,11 @@ handle_pattern_selection(void) { void handle_param_selection_sq1(void) { // Go back to trigger selection. - if (key_tap(KEY_A)) { + if (key_released(KEY_A)) { draw_params_cursor(param_selection_loc, COL_BG); input_handler = handle_trigger_selection; draw_trig_cursor(trig_selection_loc, COL_CURSOR); + return; } // Cursor movement. @@ -2223,10 +2226,11 @@ handle_param_selection_sq1(void) { void handle_param_selection_sq2(void) { // Go back to trigger selection. - if (key_tap(KEY_A)) { + if (key_released(KEY_A)) { draw_params_cursor(param_selection_loc, COL_BG); input_handler = handle_trigger_selection; draw_trig_cursor(trig_selection_loc, COL_CURSOR); + return; } // Cursor movement. @@ -2277,10 +2281,11 @@ handle_param_selection_wave(void) { Pattern *pat = &patterns[pattern_selection_loc]; // Go back to trigger selection. - if (key_tap(KEY_A)) { + if (key_released(KEY_A)) { draw_params_cursor(param_selection_loc, COL_BG); input_handler = handle_trigger_selection; draw_trig_cursor(trig_selection_loc, COL_CURSOR); + return; } // Cursor movement. @@ -2452,10 +2457,11 @@ handle_param_selection_wave(void) { void handle_param_selection_noise(void) { // Go back to trigger selection. - if (key_tap(KEY_A)) { + if (key_released(KEY_A)) { draw_params_cursor(param_selection_loc, COL_BG); input_handler = handle_trigger_selection; draw_trig_cursor(trig_selection_loc, COL_CURSOR); + return; } // Cursor movement. @@ -2922,8 +2928,15 @@ handle_sequencer_input(void) { // Stop the sequencer or start playing from the beginning. toggle_playing(); } else if (key_hold(KEY_SELECT)) { + if (input_handler == handle_param_selection_sq1 || + input_handler == handle_param_selection_sq2 || + input_handler == handle_param_selection_wave || + input_handler == handle_param_selection_noise) { + clipboard_copy(); + input_handler(); + } // Clipboard combo. - if (key_tap(KEY_A)) { + else if (key_tap(KEY_A)) { clipboard_paste(); } else if (key_tap(KEY_B)){ clipboard_copy(); -- cgit v1.2.1