Skip to content

Commit 4df335f

Browse files
committed
Reset splitter state to activePath instead of 0
1 parent 0522004 commit 4df335f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Source/UI/EditorViewport.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,7 @@ const String EditorViewport::saveState(File fileToUse, String* xmlText)
12221222

12231223
Array<GenericProcessor*> splitPoints;
12241224
Array<GenericProcessor*> allSplitters;
1225+
Array<int> splitterStates;
12251226
/** Used to reset saveOrder at end, to allow saving the same processor multiple times*/
12261227
Array<GenericProcessor*> allProcessors;
12271228

@@ -1262,7 +1263,12 @@ const String EditorViewport::saveState(File fileToUse, String* xmlText)
12621263
{
12631264
// add to list of splitters to come back to
12641265
splitPoints.add(processor);
1265-
allSplitters.add(processor);
1266+
1267+
//keep track of all splitters and their inital states
1268+
allSplitters.add(processor);
1269+
Splitter* sp = (Splitter*)processor;
1270+
splitterStates.add(sp->getPath());
1271+
12661272
processor->switchIO(0);
12671273
}
12681274

@@ -1296,14 +1302,15 @@ const String EditorViewport::saveState(File fileToUse, String* xmlText)
12961302
}
12971303
}
12981304
}
1299-
1300-
for (GenericProcessor* sp : allSplitters) {
1301-
sp->switchIO(0);
1302-
}
13031305

13041306
xml->addChildElement(signalChain);
13051307
}
13061308

1309+
// Loop through all splitters and reset their states to original values
1310+
for (int i = 0; i < allSplitters.size(); i++) {
1311+
allSplitters[i]->switchIO(splitterStates[i]);
1312+
}
1313+
13071314
XmlElement* audioSettings = new XmlElement("AUDIO");
13081315

13091316
AccessClass::getAudioComponent()->saveStateToXml(audioSettings);

Source/UI/EditorViewport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "../Processors/ProcessorGraph/ProcessorGraph.h"
2929
#include "../Processors/Editors/GenericEditor.h"
3030
#include "../Processors/Splitter/SplitterEditor.h"
31+
#include "../Processors/Splitter/Splitter.h"
3132
#include "../Processors/Merger/MergerEditor.h"
3233

3334
#include "ControlPanel.h"

0 commit comments

Comments
 (0)