|
@@ -35,6 +35,7 @@ static uint32_t beats = MAX_BEATS;
|
35
|
35
|
static uint32_t last_i = 0;
|
36
|
36
|
static uint32_t bank = 0;
|
37
|
37
|
static uint32_t max_banks_currently = 0;
|
|
38
|
+static uint32_t channel = 0;
|
38
|
39
|
|
39
|
40
|
static enum channels sequence[MAX_BEATS] = {0};
|
40
|
41
|
|
|
@@ -87,6 +88,14 @@ uint32_t sequence_get_bank(void) {
|
87
|
88
|
return bank;
|
88
|
89
|
}
|
89
|
90
|
|
|
91
|
+void sequence_set_channel(uint32_t new_channel) {
|
|
92
|
+ channel = (new_channel < NUM_CHANNELS) ? new_channel : 0;
|
|
93
|
+}
|
|
94
|
+
|
|
95
|
+uint32_t sequence_get_channel(void) {
|
|
96
|
+ return channel;
|
|
97
|
+}
|
|
98
|
+
|
90
|
99
|
uint64_t sequence_get_us(void) {
|
91
|
100
|
return us_per_beat;
|
92
|
101
|
}
|
|
@@ -167,27 +176,18 @@ void sequence_handle_button_loopstation(enum buttons btn, bool rec) {
|
167
|
176
|
}
|
168
|
177
|
|
169
|
178
|
void sequence_handle_button_drummachine(enum buttons btn) {
|
170
|
|
- uint32_t beat = 42; // TODO!!
|
171
|
|
-
|
172
|
179
|
switch (btn) {
|
173
|
|
- case BTN_A: {
|
174
|
|
- // TODO kick is wrong here
|
175
|
|
- bool val = !sequence_get(beat, CH_KICK);
|
176
|
|
- sequence_set(beat, CH_KICK, val);
|
177
|
|
- break;
|
178
|
|
- }
|
179
|
|
-
|
180
|
|
- case BTN_B: {
|
181
|
|
- // TODO snare is wrong here
|
182
|
|
- bool val = !sequence_get(beat, CH_SNARE);
|
183
|
|
- sequence_set(beat, CH_SNARE, val);
|
184
|
|
- break;
|
185
|
|
- }
|
186
|
|
-
|
187
|
|
- case BTN_C: {
|
188
|
|
- // TODO hihat is wrong here
|
189
|
|
- bool val = !sequence_get(beat, CH_HIHAT);
|
190
|
|
- sequence_set(beat, CH_HIHAT, val);
|
|
180
|
+ case BTN_A:
|
|
181
|
+ case BTN_B:
|
|
182
|
+ case BTN_C:
|
|
183
|
+ case BTN_D:
|
|
184
|
+ case BTN_E:
|
|
185
|
+ case BTN_F:
|
|
186
|
+ case BTN_G:
|
|
187
|
+ case BTN_H: {
|
|
188
|
+ uint32_t beat = (btn - BTN_A) + bank * LED_COUNT;
|
|
189
|
+ bool val = !sequence_get(beat, 1 << channel);
|
|
190
|
+ sequence_set(beat, 1 << channel, val);
|
191
|
191
|
break;
|
192
|
192
|
}
|
193
|
193
|
|