Skip to content

Commit 2e8278f

Browse files
committed
Fix bug in signal chain loading
1 parent 4df335f commit 2e8278f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Source/UI/EditorViewport.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ void SignalChainTabButton::paintButton(Graphics& g, bool isMouseOver, bool isBut
11411141

11421142
// how about some loading and saving?
11431143

1144-
XmlElement* EditorViewport::createNodeXml(GenericProcessor* source)
1144+
XmlElement* EditorViewport::createNodeXml(GenericProcessor* source, bool isStartOfSignalChain)
11451145
{
11461146

11471147
XmlElement* e = new XmlElement("PROCESSOR");
@@ -1162,7 +1162,10 @@ XmlElement* EditorViewport::createNodeXml(GenericProcessor* source)
11621162
//std::cout << name << std::endl;
11631163

11641164
e->setAttribute("name", name);
1165-
e->setAttribute("insertionPoint", 1);
1165+
if (isStartOfSignalChain)
1166+
e->setAttribute("insertionPoint", 0);
1167+
else
1168+
e->setAttribute("insertionPoint", 1);
11661169
e->setAttribute("pluginName", source->getPluginName());
11671170
e->setAttribute("pluginType", (int)(source->getPluginType()));
11681171
e->setAttribute("pluginIndex", source->getIndex());
@@ -1248,11 +1251,13 @@ const String EditorViewport::saveState(File fileToUse, String* xmlText)
12481251

12491252
XmlElement* machineName = info->createNewChildElement("MACHINE");
12501253
machineName->addTextElement(SystemStats::getComputerName());
1251-
1254+
12521255
for (int n = 0; n < signalChainArray.size(); n++)
12531256
{
12541257
XmlElement* signalChain = new XmlElement("SIGNALCHAIN");
1255-
1258+
1259+
bool isStartOfSignalChain = true;
1260+
12561261
GenericProcessor* processor = signalChainArray[n]->getEditor()->getProcessor();
12571262

12581263
while (processor != nullptr)
@@ -1273,7 +1278,7 @@ const String EditorViewport::saveState(File fileToUse, String* xmlText)
12731278
}
12741279

12751280
// create a new XML element
1276-
signalChain->addChildElement(createNodeXml(processor));
1281+
signalChain->addChildElement(createNodeXml(processor, isStartOfSignalChain));
12771282
processor->saveOrder = saveOrder;
12781283
allProcessors.addIfNotAlreadyThere(processor);
12791284
saveOrder++;
@@ -1283,6 +1288,7 @@ const String EditorViewport::saveState(File fileToUse, String* xmlText)
12831288
// continue until the end of the chain
12841289
//std::cout << " Moving forward along signal chain." << std::endl;
12851290
processor = processor->getDestNode();
1291+
isStartOfSignalChain = false;
12861292

12871293
if (processor == nullptr)
12881294
{
@@ -1301,6 +1307,7 @@ const String EditorViewport::saveState(File fileToUse, String* xmlText)
13011307
//std::cout << " End of chain." << std::endl;
13021308
}
13031309
}
1310+
13041311
}
13051312

13061313
xml->addChildElement(signalChain);

Source/UI/EditorViewport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class EditorViewport : public Component,
157157
const String loadState(File filename);
158158

159159
/** Converts information about a given editor to XML. */
160-
XmlElement* createNodeXml(GenericProcessor*);
160+
XmlElement* createNodeXml(GenericProcessor*, bool isStartOfSignalChain);
161161

162162
/** Converts information about a splitter or merge to XML. */
163163
XmlElement* switchNodeXml(GenericProcessor*);

0 commit comments

Comments
 (0)