Refactored

This commit is contained in:
2023-05-03 18:06:30 +02:00
parent 6bd4590a54
commit 89502ec978
2 changed files with 39 additions and 17 deletions
+5 -5
View File
@@ -838,7 +838,7 @@ void JaySynthAudioProcessor::bankImportXml (const XmlElement *xml)
if (xml->hasTagName ("JSYNTH_BANK")) if (xml->hasTagName ("JSYNTH_BANK"))
{ {
XmlElement *xml2 = xml->getFirstChildElement(); XmlElement *xml2 = xml->getFirstChildElement();
bankImportXml_legacy(*xml2); bankDecodeXml_legacy(*xml2);
} }
} }
@@ -929,7 +929,7 @@ void JaySynthAudioProcessor::patchImportXml (const XmlElement *xml, JaySynthSoun
} }
else if (xml->hasTagName ("JSYNTH_PATCH")) else if (xml->hasTagName ("JSYNTH_PATCH"))
{ {
patchImportXml_legacy(*xml, patch); patchDecodeXml_legacy(*xml, patch);
} }
setCurrentProgram(getCurrentProgram()); setCurrentProgram(getCurrentProgram());
} }
@@ -1003,7 +1003,7 @@ void JaySynthAudioProcessor::saveBankToFile (const File &file)
xml->writeToFile (/*const File &destinationFile*/file, /*dtdToUse*/""); xml->writeToFile (/*const File &destinationFile*/file, /*dtdToUse*/"");
} }
} }
void JaySynthAudioProcessor::patchImportXml_legacy(const XmlElement& xml, JaySynthSound *patch) void JaySynthAudioProcessor::patchDecodeXml_legacy(const XmlElement& xml, JaySynthSound *patch)
{ {
// ok, now pull out our parameters.. // ok, now pull out our parameters..
patch->setName(xml.getStringAttribute("NAME")); patch->setName(xml.getStringAttribute("NAME"));
@@ -1022,7 +1022,7 @@ void JaySynthAudioProcessor::patchImportXml_legacy(const XmlElement& xml, JaySyn
((JaySynthMidiCC*)patch->getMidiCC())->importXML(&xml); ((JaySynthMidiCC*)patch->getMidiCC())->importXML(&xml);
} }
void JaySynthAudioProcessor::bankImportXml_legacy(const XmlElement& xml) void JaySynthAudioProcessor::bankDecodeXml_legacy(const XmlElement& xml)
{ {
// make sure that it's actually our type of XML object.. // make sure that it's actually our type of XML object..
XmlElement *pXML = (XmlElement*)&xml; XmlElement *pXML = (XmlElement*)&xml;
@@ -1034,7 +1034,7 @@ void JaySynthAudioProcessor::bankImportXml_legacy(const XmlElement& xml)
break; break;
JaySynthSound *pPatch = &patches[progID]; JaySynthSound *pPatch = &patches[progID];
patchImportXml_legacy(*pXML, pPatch); patchDecodeXml_legacy(*pXML, pPatch);
((JaySynthMidiCC*)pPatch->getMidiCC())->importXML(pXML); ((JaySynthMidiCC*)pPatch->getMidiCC())->importXML(pXML);
pXML = pXML->getNextElement(); pXML = pXML->getNextElement();
} }
+34 -12
View File
@@ -207,27 +207,49 @@ public:
XmlElement* getXmlFromBinary (const void* data, const int sizeInBytes); XmlElement* getXmlFromBinary (const void* data, const int sizeInBytes);
const String getParameterNameXML (int index); const String getParameterNameXML (int index);
// Patch encode
void patchEncodeXml(XmlElement *xml, JaySynthSound const *patch); void patchEncodeXml(XmlElement *xml, JaySynthSound const *patch);
void patchDecodeXml(const XmlElement *xml, JaySynthSound *patch);
// Bank encode
void bankEncodeXml(XmlElement *xml); void bankEncodeXml(XmlElement *xml);
void bankDecodeXml(const XmlElement *xml);
void getCurrentProgramStateInformation (MemoryBlock& destData); // Patch decode
void patchDecodeXml(const XmlElement *xml, JaySynthSound *patch);
void patchDecodeXml_legacy(const XmlElement& xml, JaySynthSound *patch);
// Bank decode
void bankDecodeXml(const XmlElement *xml);
void bankDecodeXml_legacy(const XmlElement& xml);
// Patch import, main entry
void patchImportXml (const XmlElement *xml, JaySynthSound *patch);
// Bank import, main entry
void bankImportXml (const XmlElement *xml);
// Patch import VST 2.4
void setCurrentProgramStateInformation (const void* data, int sizeInBytes); void setCurrentProgramStateInformation (const void* data, int sizeInBytes);
void getStateInformation (MemoryBlock& destData); // Bank import VST 2.4
void setStateInformation (const void* data, int sizeInBytes); void setStateInformation (const void* data, int sizeInBytes);
void loadPatchFromFile (const File &file, int index); // Patch export VST 2.4
void savePatchToFile (const File &file, int index); void getCurrentProgramStateInformation (MemoryBlock& destData);
void loadBankFromFile (const File &file);
void saveBankToFile (const File &file);
void patchImportXml_legacy(const XmlElement& xml, JaySynthSound *patch); // Bank export VST 2.4
void bankImportXml_legacy(const XmlElement& xml); void getStateInformation (MemoryBlock& destData);
void bankImportXml (const XmlElement *xml);
void patchImportXml (const XmlElement *xml, JaySynthSound *patch); // Patch load from file
void loadPatchFromFile (const File &file, int index);
// Bank load from file
void loadBankFromFile (const File &file);
// Patch save to file
void savePatchToFile (const File &file, int index);
// Bank save to file
void saveBankToFile (const File &file);
void commitEditBuffer(); void commitEditBuffer();
//============================================================================== //==============================================================================