Skip to content

Commit

Permalink
"Activate individual scene outputs" overhaul (surge-synthesizer#5924)
Browse files Browse the repository at this point in the history
* "Activate individual scene outputs" overhaul
Add it to DAWExtraState instead
Show the menu option to enable scene outputs only for FL Studio
  • Loading branch information
mkruselj authored Mar 2, 2022
1 parent 2b914a6 commit 719218c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
6 changes: 4 additions & 2 deletions src/common/SurgeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions src/common/SurgeSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/common/UserDefaults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void initMaps()
r = "useODDMTS";
break;
case ActivateExtraOutputs:
// not used anymore, see GitHub issue #5657
r = "activateExtraOutputs";
break;
case MonoPedalMode:
Expand Down
20 changes: 12 additions & 8 deletions src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3430,15 +3430,14 @@ juce::PopupMenu SurgeGUIEditor::makeWorkflowMenu(const juce::Point<int> &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);
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 719218c

Please sign in to comment.