Browse Source

Do not reset pitch when receiving all-notes-off

Closes #464
Signed-off-by: falkTX <falktx@falktx.com>
tags/23.02
falkTX 2 years ago
parent
commit
fcbed2797c
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 13 additions and 8 deletions
  1. +13
    -8
      plugins/Cardinal/src/HostMIDI.cpp

+ 13
- 8
plugins/Cardinal/src/HostMIDI.cpp 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(); }
)); ));
} }
}; };


Loading…
Cancel
Save