aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-04-05 11:55:14 +0200
committerBad Diode <bd@badd10de.dev>2023-04-05 11:55:14 +0200
commit8cdbb1a2ceba6f4d0c0d8453a9e07268e248e3a6 (patch)
tree83056041456666e0a2dc19d7624bed4f5e8c87c7
parent76be354cf2d924a8cbdd7fb4ac4f6b9c1546762f (diff)
downloadstepper-8cdbb1a2ceba6f4d0c0d8453a9e07268e248e3a6.tar.gz
stepper-8cdbb1a2ceba6f4d0c0d8453a9e07268e248e3a6.zip
Improve parameter adjustment by using key_released
-rw-r--r--src/sequencer.c23
1 files changed, 18 insertions, 5 deletions
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) {
16} 16}
17 17
18void set_time(int bpm); 18void set_time(int bpm);
19void clipboard_paste(void);
20void clipboard_copy(void);
19 21
20// 22//
21// Color indexes. 23// Color indexes.
@@ -2130,10 +2132,11 @@ handle_pattern_selection(void) {
2130void 2132void
2131handle_param_selection_sq1(void) { 2133handle_param_selection_sq1(void) {
2132 // Go back to trigger selection. 2134 // Go back to trigger selection.
2133 if (key_tap(KEY_A)) { 2135 if (key_released(KEY_A)) {
2134 draw_params_cursor(param_selection_loc, COL_BG); 2136 draw_params_cursor(param_selection_loc, COL_BG);
2135 input_handler = handle_trigger_selection; 2137 input_handler = handle_trigger_selection;
2136 draw_trig_cursor(trig_selection_loc, COL_CURSOR); 2138 draw_trig_cursor(trig_selection_loc, COL_CURSOR);
2139 return;
2137 } 2140 }
2138 2141
2139 // Cursor movement. 2142 // Cursor movement.
@@ -2223,10 +2226,11 @@ handle_param_selection_sq1(void) {
2223void 2226void
2224handle_param_selection_sq2(void) { 2227handle_param_selection_sq2(void) {
2225 // Go back to trigger selection. 2228 // Go back to trigger selection.
2226 if (key_tap(KEY_A)) { 2229 if (key_released(KEY_A)) {
2227 draw_params_cursor(param_selection_loc, COL_BG); 2230 draw_params_cursor(param_selection_loc, COL_BG);
2228 input_handler = handle_trigger_selection; 2231 input_handler = handle_trigger_selection;
2229 draw_trig_cursor(trig_selection_loc, COL_CURSOR); 2232 draw_trig_cursor(trig_selection_loc, COL_CURSOR);
2233 return;
2230 } 2234 }
2231 2235
2232 // Cursor movement. 2236 // Cursor movement.
@@ -2277,10 +2281,11 @@ handle_param_selection_wave(void) {
2277 Pattern *pat = &patterns[pattern_selection_loc]; 2281 Pattern *pat = &patterns[pattern_selection_loc];
2278 2282
2279 // Go back to trigger selection. 2283 // Go back to trigger selection.
2280 if (key_tap(KEY_A)) { 2284 if (key_released(KEY_A)) {
2281 draw_params_cursor(param_selection_loc, COL_BG); 2285 draw_params_cursor(param_selection_loc, COL_BG);
2282 input_handler = handle_trigger_selection; 2286 input_handler = handle_trigger_selection;
2283 draw_trig_cursor(trig_selection_loc, COL_CURSOR); 2287 draw_trig_cursor(trig_selection_loc, COL_CURSOR);
2288 return;
2284 } 2289 }
2285 2290
2286 // Cursor movement. 2291 // Cursor movement.
@@ -2452,10 +2457,11 @@ handle_param_selection_wave(void) {
2452void 2457void
2453handle_param_selection_noise(void) { 2458handle_param_selection_noise(void) {
2454 // Go back to trigger selection. 2459 // Go back to trigger selection.
2455 if (key_tap(KEY_A)) { 2460 if (key_released(KEY_A)) {
2456 draw_params_cursor(param_selection_loc, COL_BG); 2461 draw_params_cursor(param_selection_loc, COL_BG);
2457 input_handler = handle_trigger_selection; 2462 input_handler = handle_trigger_selection;
2458 draw_trig_cursor(trig_selection_loc, COL_CURSOR); 2463 draw_trig_cursor(trig_selection_loc, COL_CURSOR);
2464 return;
2459 } 2465 }
2460 2466
2461 // Cursor movement. 2467 // Cursor movement.
@@ -2922,8 +2928,15 @@ handle_sequencer_input(void) {
2922 // Stop the sequencer or start playing from the beginning. 2928 // Stop the sequencer or start playing from the beginning.
2923 toggle_playing(); 2929 toggle_playing();
2924 } else if (key_hold(KEY_SELECT)) { 2930 } else if (key_hold(KEY_SELECT)) {
2931 if (input_handler == handle_param_selection_sq1 ||
2932 input_handler == handle_param_selection_sq2 ||
2933 input_handler == handle_param_selection_wave ||
2934 input_handler == handle_param_selection_noise) {
2935 clipboard_copy();
2936 input_handler();
2937 }
2925 // Clipboard combo. 2938 // Clipboard combo.
2926 if (key_tap(KEY_A)) { 2939 else if (key_tap(KEY_A)) {
2927 clipboard_paste(); 2940 clipboard_paste();
2928 } else if (key_tap(KEY_B)){ 2941 } else if (key_tap(KEY_B)){
2929 clipboard_copy(); 2942 clipboard_copy();