aboutsummaryrefslogtreecommitdiffstats
path: root/src/sequencer.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-04-23 19:43:33 +0200
committerBad Diode <bd@badd10de.dev>2023-04-23 19:43:33 +0200
commiteeeacde00c589cb227746b164a39372356d1eeec (patch)
treebc95e0501f4b1cee72d1e9939ef4c1a0a033e0cd /src/sequencer.c
parentec5c1ad9f16772434f0f49811c87ec58a3569e83 (diff)
downloadstepper-eeeacde00c589cb227746b164a39372356d1eeec.tar.gz
stepper-eeeacde00c589cb227746b164a39372356d1eeec.zip
Fix a couple of rendering corner cases
Diffstat (limited to 'src/sequencer.c')
-rw-r--r--src/sequencer.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/sequencer.c b/src/sequencer.c
index a560bcb..34e2695 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -749,16 +749,16 @@ handle_trigger_selection(void) {
749 // Decrease note. 749 // Decrease note.
750 if (trig->active) { 750 if (trig->active) {
751 trig->note = MAX(trig->note - 1, NOTE_C_2); 751 trig->note = MAX(trig->note - 1, NOTE_C_2);
752 redraw_trigs = true;
753 redraw_piano_note = true;
754 } 752 }
753 redraw_trigs = true;
754 redraw_piano_note = true;
755 } else if (key_tap(KEY_R)) { 755 } else if (key_tap(KEY_R)) {
756 // Increase note. 756 // Increase note.
757 if (trig->active) { 757 if (trig->active) {
758 trig->note = MIN( trig->note + 1, NOTE_C_8 - 1); 758 trig->note = MIN( trig->note + 1, NOTE_C_8 - 1);
759 redraw_trigs = true;
760 redraw_piano_note = true;
761 } 759 }
760 redraw_trigs = true;
761 redraw_piano_note = true;
762 } 762 }
763 763
764 // Move trigger cursor. 764 // Move trigger cursor.
@@ -766,30 +766,27 @@ handle_trigger_selection(void) {
766 if (trig_selection_loc == 0 || trig_selection_loc == 8) { 766 if (trig_selection_loc == 0 || trig_selection_loc == 8) {
767 // We are at the boundary, switch to channel selection. 767 // We are at the boundary, switch to channel selection.
768 input_handler = handle_channel_selection; 768 input_handler = handle_channel_selection;
769 redraw_params = true;
770 } else { 769 } else {
771 trig_selection_loc = MAX(trig_selection_loc - 1, 0); 770 trig_selection_loc = MAX(trig_selection_loc - 1, 0);
772 redraw_piano_note = true;
773 redraw_params = true;
774 } 771 }
772 redraw_params = true;
773 redraw_piano_note = true;
775 } else if (key_tap(KEY_RIGHT)) { 774 } else if (key_tap(KEY_RIGHT)) {
776 if (trig_selection_loc != 7 && trig_selection_loc != 15) { 775 if (trig_selection_loc != 7 && trig_selection_loc != 15) {
777 trig_selection_loc = MIN(trig_selection_loc + 1, 15); 776 trig_selection_loc = MIN(trig_selection_loc + 1, 15);
778 redraw_piano_note = true;
779 redraw_params = true;
780 } else if (trig_selection_loc == 7) { 777 } else if (trig_selection_loc == 7) {
781 input_handler = handle_right_col_selection; 778 input_handler = handle_right_col_selection;
782 right_col_selection_loc = R_COL_STOP; 779 right_col_selection_loc = R_COL_STOP;
783 redraw_params = true;
784 } else if (trig_selection_loc == 15) { 780 } else if (trig_selection_loc == 15) {
785 right_col_selection_loc = R_COL_BPM; 781 right_col_selection_loc = R_COL_BPM;
786 input_handler = handle_right_col_selection; 782 input_handler = handle_right_col_selection;
787 redraw_params = true;
788 } 783 }
784 redraw_params = true;
785 redraw_piano_note = true;
789 } else if (key_tap(KEY_UP) || key_tap(KEY_DOWN)) { 786 } else if (key_tap(KEY_UP) || key_tap(KEY_DOWN)) {
790 trig_selection_loc = (trig_selection_loc + 8) % 16; 787 trig_selection_loc = (trig_selection_loc + 8) % 16;
791 redraw_piano_note = true;
792 redraw_params = true; 788 redraw_params = true;
789 redraw_piano_note = true;
793 } else if (key_tap(KEY_A)) { 790 } else if (key_tap(KEY_A)) {
794 // Switch to parameter selection. 791 // Switch to parameter selection.
795 switch (channel_selection_loc) { 792 switch (channel_selection_loc) {
@@ -806,8 +803,8 @@ handle_trigger_selection(void) {
806 input_handler = handle_param_selection_noise; 803 input_handler = handle_param_selection_noise;
807 } break; 804 } break;
808 } 805 }
809 redraw_piano_note = true;
810 redraw_params = true; 806 redraw_params = true;
807 redraw_piano_note = true;
811 } 808 }
812} 809}
813 810
@@ -817,7 +814,7 @@ handle_sequencer_input(void) {
817 // Stop the sequencer or start playing from the beginning. 814 // Stop the sequencer or start playing from the beginning.
818 toggle_playing(); 815 toggle_playing();
819 } else if (key_hold(KEY_SELECT)) { 816 } else if (key_hold(KEY_SELECT)) {
820 if (input_handler == handle_param_selection_sq1 || 817 if (input_handler == handle_param_selection_sq1 ||
821 input_handler == handle_param_selection_sq2 || 818 input_handler == handle_param_selection_sq2 ||
822 input_handler == handle_param_selection_wave || 819 input_handler == handle_param_selection_wave ||
823 input_handler == handle_param_selection_noise) { 820 input_handler == handle_param_selection_noise) {