Do not reset pitch when receiving all-notes-off

Closes #464
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2023-02-25 16:36:58 +01:00
parent fdfe20b606
commit fcbed2797c
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0

View file

@ -148,22 +148,27 @@ struct HostMIDI : TerminalModule {
channels = 1; channels = 1;
polyMode = ROTATE_MODE; polyMode = ROTATE_MODE;
pwRange = 0; pwRange = 0;
panic(); panic(true);
} }
/** Resets performance state */ /** Resets performance state */
void panic() void panic(const bool resetPitch)
{ {
for (int c = 0; c < 16; c++) { for (int c = 0; c < 16; c++) {
notes[c] = 60; notes[c] = 60;
gates[c] = false; gates[c] = false;
velocities[c] = 0; velocities[c] = 0;
aftertouches[c] = 0; aftertouches[c] = 0;
pws[c] = 8192;
mods[c] = 0;
pwFilters[c].reset(); pwFilters[c].reset();
modFilters[c].reset(); modFilters[c].reset();
} }
if (resetPitch) {
for (int c = 0; c < 16; c++) {
notes[c] = 60;
pws[c] = 8192;
mods[c] = 0;
}
}
pedal = false; pedal = false;
rotateIndex = -1; rotateIndex = -1;
heldNotes.clear(); heldNotes.clear();
@ -374,7 +379,7 @@ struct HostMIDI : TerminalModule {
// all notes off (panic) // all notes off (panic)
case 0x7b: { case 0x7b: {
if (msg.getValue() == 0) { if (msg.getValue() == 0) {
panic(); panic(false);
} }
} break; } break;
default: break; default: break;
@ -529,7 +534,7 @@ struct HostMIDI : TerminalModule {
if (channels == this->channels) if (channels == this->channels)
return; return;
this->channels = channels; this->channels = channels;
panic(); panic(true);
} }
void setPolyMode(const PolyMode polyMode) void setPolyMode(const PolyMode polyMode)
@ -537,7 +542,7 @@ struct HostMIDI : TerminalModule {
if (polyMode == this->polyMode) if (polyMode == this->polyMode)
return; return;
this->polyMode = polyMode; this->polyMode = polyMode;
panic(); panic(true);
} }
} midiInput; } midiInput;
@ -886,7 +891,7 @@ struct HostMIDIWidget : ModuleWidgetWith9HP {
menu->addChild(createMenuLabel("MIDI Input & Output")); menu->addChild(createMenuLabel("MIDI Input & Output"));
menu->addChild(createMenuItem("Panic", "", menu->addChild(createMenuItem("Panic", "",
[=]() { module->midiInput.panic(); module->midiOutput.panic(); } [=]() { module->midiInput.panic(true); module->midiOutput.panic(); }
)); ));
} }
}; };