Skip to content

Commit

Permalink
Optionally blanket ignore midi program change
Browse files Browse the repository at this point in the history
Since most of the time it won't do what you want if it does arrive
make it an opt out. Keep the behavior unchanged though to 1.1 so
we don't break people who had engineeredf around the deficiencies

Closes surge-synthesizer#6803
  • Loading branch information
baconpaul committed Jan 24, 2023
1 parent 9cd18b2 commit 0d3451f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/common/SurgeSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1839,6 +1839,12 @@ void SurgeSynthesizer::polyAftertouch(char channel, int key, int value)

void SurgeSynthesizer::programChange(char channel, int value)
{
auto ignorePC = Surge::Storage::getUserDefaultValue(
&(storage), Surge::Storage::IgnoreMIDIProgramChange, false);

if (ignorePC)
return;

PCH = value;
// load_patch((CC0<<7) + PCH);
patchid_queue = (CC0 << 7) + PCH;
Expand Down
4 changes: 4 additions & 0 deletions src/common/UserDefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ std::string defaultKeyToString(DefaultKey k)
r = "focusModEditorAfterAddModulationFrom";
break;

case IgnoreMIDIProgramChange:
r = "ignoreMidiProgramChange";
break;

case nKeys:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/common/UserDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ enum DefaultKey
FXUnitAssumeFixedBlock,
FXUnitDefaultZoom,

IgnoreMIDIProgramChange,

nKeys
};

Expand Down
10 changes: 10 additions & 0 deletions src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4641,6 +4641,16 @@ juce::PopupMenu SurgeGUIEditor::makeMidiMenu(const juce::Point<int> &where)
[this, p] { this->synth->storage.loadMidiMappingByName(p.first); });
}

midiSubMenu.addSeparator();
bool igMID = Surge::Storage::getUserDefaultValue(
&(this->synth->storage), Surge::Storage::IgnoreMIDIProgramChange, false);

midiSubMenu.addItem(
Surge::GUI::toOSCase("Ignore MIDI Program Change Messages"), true, igMID, [this, igMID]() {
Surge::Storage::updateUserDefaultValue(&(this->synth->storage),
Surge::Storage::IgnoreMIDIProgramChange, !igMID);
});

return midiSubMenu;
}

Expand Down

0 comments on commit 0d3451f

Please sign in to comment.