Skip to content

Commit 09a29f1

Browse files
authored
Turn off edge presets (#621)
* Turn off edge presets in Cubase Since cubase calls setState and then setCurrentProgram on restore if you have presets and modify one and save a project, edge presets are not really viable. * Respond to review * Always off
1 parent 094f418 commit 09a29f1

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

src/PluginProcessor.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ ObxfAudioProcessor::ObxfAudioProcessor()
4949

5050
isHostAutomatedChange = true;
5151

52+
if (juce::PluginHostType().isCubase() || juce::PluginHostType().isNuendo() ||
53+
juce::PluginHostType().isSteinberg())
54+
{
55+
// see KVR thread. Cubase sends a setProgram not only when user selects but also after a
56+
// state restore. https://www.kvraudio.com/forum/viewtopic.php?p=9220240#p9220240
57+
supportEdgePrograms = false;
58+
}
59+
else
60+
{
61+
// Make a decision to just not bother. Too many funky host edge cases
62+
supportEdgePrograms = false;
63+
}
64+
5265
initializeCallbacks();
5366

5467
juce::PropertiesFile::Options options;
@@ -216,10 +229,16 @@ bool ObxfAudioProcessor::producesMidi() const
216229
bool ObxfAudioProcessor::isMidiEffect() const { return false; }
217230
double ObxfAudioProcessor::getTailLengthSeconds() const { return 0.0; }
218231

219-
int ObxfAudioProcessor::getNumPrograms() { return utils->lastFactoryPatch + 1; }
220-
int ObxfAudioProcessor::getCurrentProgram() { return currentDawProgram; }
232+
int ObxfAudioProcessor::getNumPrograms()
233+
{
234+
return supportEdgePrograms ? utils->lastFactoryPatch + 1 : 1;
235+
}
236+
int ObxfAudioProcessor::getCurrentProgram() { return supportEdgePrograms ? currentDawProgram : 0; }
221237
void ObxfAudioProcessor::setCurrentProgram(const int index)
222238
{
239+
if (!supportEdgePrograms)
240+
return;
241+
223242
if (index < 0 || index > utils->lastFactoryPatch + 1 ||
224243
(size_t)index > utils->patchesAsLinearList.size() + 1)
225244
return;

src/PluginProcessor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class ObxfAudioProcessor final : public juce::AudioProcessor,
7878
void changeProgramName(int index, const juce::String &newName) override {};
7979
int currentDawProgram{0}; // doesn't change for non-factory
8080
int lastLoadedProgram{0}; // always the index of last utils fxp loaded
81+
bool supportEdgePrograms{true};
8182
Utils::PatchTreeNode::weakptr_t lastLoadedPatchNode;
8283

8384
void resetLastLoadedProgramTo(int idx);

0 commit comments

Comments
 (0)