From 719218c6f11f08df69480048ec5db2625d32f4e2 Mon Sep 17 00:00:00 2001 From: EvilDragon Date: Wed, 2 Mar 2022 17:06:37 +0100 Subject: [PATCH] "Activate individual scene outputs" overhaul (#5924) * "Activate individual scene outputs" overhaul Add it to DAWExtraState instead Show the menu option to enable scene outputs only for FL Studio --- src/common/SurgeStorage.h | 6 ++++-- src/common/SurgeSynthesizer.cpp | 8 ++------ src/common/UserDefaults.cpp | 1 + src/surge-xt/gui/SurgeGUIEditor.cpp | 20 ++++++++++++-------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/common/SurgeStorage.h b/src/common/SurgeStorage.h index 4972a403841..c02f6ebac3c 100644 --- a/src/common/SurgeStorage.h +++ b/src/common/SurgeStorage.h @@ -759,10 +759,12 @@ struct DAWExtraStateStorage int current_scene = 0; int current_fx = 0; int current_osc[n_scenes] = {0}; - modsources modsource = ms_lfo1, modsource_editor[n_scenes] = {ms_lfo1, ms_lfo1}; bool isMSEGOpen = false; - bool msegStateIsPopulated = false; + modsources modsource = ms_lfo1, modsource_editor[n_scenes] = {ms_lfo1, ms_lfo1}; + + bool activateExtraOutputs = true; + struct { int timeEditMode = 0; diff --git a/src/common/SurgeSynthesizer.cpp b/src/common/SurgeSynthesizer.cpp index f9eb0ed69eb..cb775e810c7 100644 --- a/src/common/SurgeSynthesizer.cpp +++ b/src/common/SurgeSynthesizer.cpp @@ -4300,12 +4300,8 @@ void SurgeSynthesizer::loadFromDawExtraState() void SurgeSynthesizer::setupActivateExtraOutputs() { - bool defval = true; - if (hostProgram.find("Fruit") == 0) // FruityLoops default off - defval = false; - - activateExtraOutputs = Surge::Storage::getUserDefaultValue( - &(storage), Surge::Storage::ActivateExtraOutputs, defval ? 1 : 0); + // default off for FL Studio + activateExtraOutputs = (hostProgram.find("Fruit") == 0) ? true : false; } void SurgeSynthesizer::swapMetaControllers(int c1, int c2) diff --git a/src/common/UserDefaults.cpp b/src/common/UserDefaults.cpp index 2a2e57b9d94..51df745d9b4 100644 --- a/src/common/UserDefaults.cpp +++ b/src/common/UserDefaults.cpp @@ -72,6 +72,7 @@ void initMaps() r = "useODDMTS"; break; case ActivateExtraOutputs: + // not used anymore, see GitHub issue #5657 r = "activateExtraOutputs"; break; case MonoPedalMode: diff --git a/src/surge-xt/gui/SurgeGUIEditor.cpp b/src/surge-xt/gui/SurgeGUIEditor.cpp index ca256de6ad6..18e1d7bc4c5 100644 --- a/src/surge-xt/gui/SurgeGUIEditor.cpp +++ b/src/surge-xt/gui/SurgeGUIEditor.cpp @@ -3430,15 +3430,14 @@ juce::PopupMenu SurgeGUIEditor::makeWorkflowMenu(const juce::Point &where) { auto wfMenu = juce::PopupMenu(); - wfMenu.addItem(Surge::GUI::toOSCaseForMenu("Activate Individual Scene Outputs"), true, - (synth->activateExtraOutputs), [this]() { - this->synth->activateExtraOutputs = !this->synth->activateExtraOutputs; - Surge::Storage::updateUserDefaultValue( - &(this->synth->storage), Surge::Storage::ActivateExtraOutputs, - this->synth->activateExtraOutputs ? 1 : 0); - }); + if (synth->hostProgram.find("Fruit") == 0) // only show this option for FL Studio + { + wfMenu.addItem(Surge::GUI::toOSCaseForMenu("Activate Individual Scene Outputs"), true, + (synth->activateExtraOutputs), + [this]() { synth->activateExtraOutputs = !synth->activateExtraOutputs; }); - wfMenu.addSeparator(); + wfMenu.addSeparator(); + } bool tabPosMem = Surge::Storage::getUserDefaultValue( &(this->synth->storage), Surge::Storage::RememberTabPositionsPerScene, false); @@ -6597,6 +6596,9 @@ void SurgeGUIEditor::populateDawExtraState(SurgeSynthesizer *synth) des->editor.current_scene = current_scene; des->editor.current_fx = current_fx; des->editor.modsource = modsource; + + des->editor.activateExtraOutputs = synth->activateExtraOutputs; + for (int i = 0; i < n_scenes; ++i) { des->editor.current_osc[i] = current_osc[i]; @@ -6652,6 +6654,8 @@ void SurgeGUIEditor::loadFromDAWExtraState(SurgeSynthesizer *synth) current_fx = des->editor.current_fx; modsource = des->editor.modsource; + synth->activateExtraOutputs = des->editor.activateExtraOutputs; + activateFromCurrentFx(); for (int i = 0; i < n_scenes; ++i)