Drop mono mode

This commit is contained in:
Dejvino
2026-02-19 10:48:55 +01:00
parent 4ec306b8b9
commit 8ae1f5f501
5 changed files with 77 additions and 112 deletions
+8 -11
View File
@@ -11,12 +11,11 @@ bool wasPlaying = false;
static void handlePlayback() {
bool nowPlaying = isPlaying;
int tracksToPlay = (playMode == MODE_POLY) ? NUM_TRACKS : 1;
if (!wasPlaying && nowPlaying) {
midi.sendRealtime(0xFA); // MIDI Start
} else if (wasPlaying && !nowPlaying) {
midi.sendRealtime(0xFC); // MIDI Stop
for (int i=0; i<tracksToPlay; i++) midi.panic(midiChannels[i]);
for (int i=0; i<NUM_TRACKS; i++) midi.panic(midiChannels[i]);
}
wasPlaying = nowPlaying;
@@ -45,8 +44,8 @@ static void handlePlayback() {
memcpy(local_nextSequence, nextSequence, sizeof(local_nextSequence));
midi.unlock();
for(int t=0; t<tracksToPlay; t++) {
int trackChannel = playMode == MODE_POLY ? midiChannels[t] : midiChannels[0];
for(int t=0; t<NUM_TRACKS; t++) {
int trackChannel = midiChannels[t];
int nextStep = playbackStep + 1;
if (nextStep >= NUM_STEPS) nextStep = 0;
@@ -83,7 +82,7 @@ static void handlePlayback() {
midi.unlock();
}
for (int i=0; i<tracksToPlay; i++) midi.panic(midiChannels[i]);
for (int i=0; i<NUM_TRACKS; i++) midi.panic(midiChannels[i]);
if (sequenceChangeScheduled) {
memcpy(local_sequence, local_nextSequence, sizeof(local_sequence));
@@ -111,8 +110,8 @@ static void handlePlayback() {
}
// Note On for new step
for(int t=0; t<tracksToPlay; t++) {
int trackChannel = playMode == MODE_POLY ? midiChannels[t] : midiChannels[0];
for(int t=0; t<NUM_TRACKS; t++) {
int trackChannel = midiChannels[t];
if (!trackMute[t] && local_sequence[t][playbackStep].note != -1) {
uint8_t velocity = local_sequence[t][playbackStep].accent ? 127 : 100;
midi.sendNoteOn(local_sequence[t][playbackStep].note, velocity, trackChannel);
@@ -131,10 +130,8 @@ static void handlePlayback() {
void loopPlayback() {
if (needsPanic) {
if (playMode == MODE_POLY) {
for (int i=0; i<NUM_TRACKS; i++) midi.panic(midiChannels[i]);
} else {
midi.panic(midiChannels[0]);
for (int i=0; i<NUM_TRACKS; i++) {
midi.panic(midiChannels[i]);
}
needsPanic = false;
}