Skip to content

Commit

Permalink
Turn off Midi PC Factory Backfill (#7177)
Browse files Browse the repository at this point in the history
We initially made the unused banks fill in order
with Factory. We decided this was probably too volatile
so just turned it off.

Doing so means in most cases midi program change does
nothing so also remove the menu item for ignore midi program
change.

Also push MIDI Programs to bottom of user list after a separator
and only show it if it has contents

Closes #576
  • Loading branch information
baconpaul authored Aug 12, 2023
1 parent aa46018 commit 7367738
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 31 deletions.
26 changes: 15 additions & 11 deletions src/common/SurgeStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,17 +790,21 @@ void SurgeStorage::refresh_patchlist()
}
}

if (currBank < 128)
{
for (auto c : patchCategoryOrdering)
{
loadCategoryIntoBank(c, currBank);

currBank++;
if (currBank >= 128)
break;
}
}
/*
* Our initial implementation loaded factory banks
* in order into unused upper banks. We decided we don't want
* this but if you do, you do something like this:
* if (currBank < 128)
* {
* for (auto c : patchCategoryOrdering)
* {
* loadCategoryIntoBank(c, currBank);
* currBank++;
* if (currBank >= 128)
* break;
* }
* }
*/
}

void SurgeStorage::refreshPatchlistAddDir(bool userDir, string subdir)
Expand Down
6 changes: 0 additions & 6 deletions src/common/SurgeSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1922,12 +1922,6 @@ 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;

auto pid = storage.patchIdToMidiBankAndProgram[CC0][PCH];
Expand Down
2 changes: 1 addition & 1 deletion src/common/UserDefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ std::string defaultKeyToString(DefaultKey k)
r = "focusModEditorAfterAddModulationFrom";
break;

case IgnoreMIDIProgramChange:
case IgnoreMIDIProgramChange_Deprecated:
r = "ignoreMidiProgramChange";
break;

Expand Down
2 changes: 1 addition & 1 deletion src/common/UserDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ enum DefaultKey
FXUnitAssumeFixedBlock,
FXUnitDefaultZoom,

IgnoreMIDIProgramChange,
IgnoreMIDIProgramChange_Deprecated, // better PC support means skip this

DontShowAudioErrorsAgain,

Expand Down
11 changes: 0 additions & 11 deletions src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4756,17 +4756,6 @@ juce::PopupMenu SurgeGUIEditor::makeMidiMenu(const juce::Point<int> &where)
!useMIDICh2Ch3);
});

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

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

midiSubMenu.addSeparator();

auto chanSubMenu = juce::PopupMenu();
Expand Down
14 changes: 13 additions & 1 deletion src/surge-xt/gui/widgets/PatchSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void PatchSelector::showClassicMenu(bool single_category)
bool has_3rdparty = false;
int last_category = current_category;
auto patch_cat_size = storage->patch_category.size();
int tutorialCat = -1;
int tutorialCat = -1, midiPCCat = -1;

if (single_category)
{
Expand Down Expand Up @@ -587,6 +587,11 @@ void PatchSelector::showClassicMenu(bool single_category)
{
tutorialCat = c;
}
else if (!storage->patch_category[c].isFactory &&
storage->patch_category[c].name == storage->midiProgramChangePatchesSubdir)
{
midiPCCat = c;
}
else
{
populatePatchMenuForCategory(c, contextMenu, single_category, main_e, true);
Expand All @@ -599,6 +604,13 @@ void PatchSelector::showClassicMenu(bool single_category)
}
}

if (midiPCCat >= 0 &&
storage->patch_category[midiPCCat].numberOfPatchesInCategoryAndChildren > 0)
{
contextMenu.addSeparator();
populatePatchMenuForCategory(midiPCCat, contextMenu, single_category, main_e, true);
}

contextMenu.addColumnBreak();
Surge::Widgets::MenuCenteredBoldLabel::addToMenuAsSectionHeader(contextMenu, "FUNCTIONS");

Expand Down

0 comments on commit 7367738

Please sign in to comment.