aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-01-06 15:30:18 +0100
committerBad Diode <bd@badd10de.dev>2024-01-06 15:30:18 +0100
commita5f47ed59a29486c7ad3ee60811c5928862b24f8 (patch)
treea70326fe7ca6517ce64486b5a354501878a53658
parentd908768c07b0db26ac24610eac5edd627490a77b (diff)
downloadstepper-a5f47ed59a29486c7ad3ee60811c5928862b24f8.tar.gz
stepper-a5f47ed59a29486c7ad3ee60811c5928862b24f8.zip
Fix bank switching behaviour bug
-rw-r--r--Makefile2
-rw-r--r--src/main.c6
-rw-r--r--src/sequencer.c22
3 files changed, 20 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index e867ed3..6b7ec3a 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS))
27INC_FLAGS += -I$(LIBGBA_SRC) 27INC_FLAGS += -I$(LIBGBA_SRC)
28 28
29# Output library names and executables. 29# Output library names and executables.
30TARGET := STEPPER-v1.8-dev-05 30TARGET := STEPPER-v1.8-dev-06
31ELF := $(BUILD_DIR)/$(TARGET).elf 31ELF := $(BUILD_DIR)/$(TARGET).elf
32BIN := $(BUILD_DIR)/$(TARGET).gba 32BIN := $(BUILD_DIR)/$(TARGET).gba
33 33
diff --git a/src/main.c b/src/main.c
index 2e64275..a6d02e1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -13,13 +13,13 @@ WITH REGARD TO THIS SOFTWARE.
13// 13//
14// High priority: 14// High priority:
15// + Higher resolution clock to allow for microtiming and more accurate tempo. 15// + Higher resolution clock to allow for microtiming and more accurate tempo.
16// - Look back again at the emulator issues... 16// + Look back again at the emulator issues... (I give up)
17// + Sync via MIDI with the Analogue cables.
18// + Fix bank switching behaviour (bug)
17// - Fix any bugs we currently have 19// - Fix any bugs we currently have
18// - Possible that when we switched banks there is some weird ui behaviour.
19// - Add an envelope to ch3, would need to work with a timer in order to make 20// - Add an envelope to ch3, would need to work with a timer in order to make
20// it work I think. 21// it work I think.
21// - Hold L/R retriggers at short intervals? 22// - Hold L/R retriggers at short intervals?
22// - Sync via MIDI with the Analogue cables.
23// - Channel params should show if there are some already on all triggers and 23// - Channel params should show if there are some already on all triggers and
24// modify only the selected parameter, not all of them. 24// modify only the selected parameter, not all of them.
25// - Should scale mode be toggleable? 25// - Should scale mode be toggleable?
diff --git a/src/sequencer.c b/src/sequencer.c
index 56279bc..9f7f1ad 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -102,10 +102,6 @@ should_play(u8 prob) {
102 102
103void 103void
104select_bank(int i) { 104select_bank(int i) {
105 chain.current = 15;
106 chain.current = find_next_pattern();
107 current_pattern = 0;
108 next_pattern = 0;
109 next_bank = i; 105 next_bank = i;
110 clipboard.type = CLIP_EMPTY; 106 clipboard.type = CLIP_EMPTY;
111 if (settings.auto_save) { 107 if (settings.auto_save) {
@@ -117,6 +113,16 @@ select_bank(int i) {
117 if (current_bank != i) { 113 if (current_bank != i) {
118 load_bank(i); 114 load_bank(i);
119 } 115 }
116 chain.current = 15;
117 chain.current = find_next_pattern();
118 if (chain.len > 0 && chain.enabled) {
119 chain.playing = true;
120 next_pattern = chain.chain[chain.current];
121 current_pattern = next_pattern;
122 } else {
123 current_pattern = 0;
124 next_pattern = 0;
125 }
120 current_bank = i; 126 current_bank = i;
121 redraw_pattern_buttons = true; 127 redraw_pattern_buttons = true;
122 redraw_trigs = true; 128 redraw_trigs = true;
@@ -129,13 +135,13 @@ void
129play_step(void) { 135play_step(void) {
130 static s8 pan[4] = {0}; 136 static s8 pan[4] = {0};
131 Pattern *pat = &patterns[current_pattern]; 137 Pattern *pat = &patterns[current_pattern];
138 bool switch_bank = false;
132 if (current_pattern != next_pattern && step_counter == 15) { 139 if (current_pattern != next_pattern && step_counter == 15) {
133 current_pattern = next_pattern; 140 current_pattern = next_pattern;
134 redraw_pattern_buttons = true; 141 redraw_pattern_buttons = true;
135 update_bpm = true; 142 update_bpm = true;
136 } else if (current_bank != next_bank && step_counter == 15) { 143 } else if (current_bank != next_bank && step_counter == 15) {
137 select_bank(next_bank); 144 switch_bank = true;
138 update_bpm = true;
139 } else if (chain.len != 0 && step_counter == 15 && chain.enabled) { 145 } else if (chain.len != 0 && step_counter == 15 && chain.enabled) {
140 redraw_pattern_buttons = true; 146 redraw_pattern_buttons = true;
141 update_bpm = true; 147 update_bpm = true;
@@ -336,6 +342,10 @@ play_step(void) {
336 bar_counter++; 342 bar_counter++;
337 } 343 }
338 step_counter = (step_counter + 1) % 16; 344 step_counter = (step_counter + 1) % 16;
345 if (switch_bank) {
346 select_bank(next_bank);
347 update_bpm = true;
348 }
339} 349}
340 350
341static int nseq_ticks = 0; 351static int nseq_ticks = 0;