From 89502ec978305af3fa8e9e80f6cdea6782f92c62 Mon Sep 17 00:00:00 2001 From: jens Date: Wed, 3 May 2023 18:06:30 +0200 Subject: [PATCH] Refactored --- Source/PluginProcessor.cpp | 10 ++++----- Source/PluginProcessor.h | 46 ++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index ef9d28a..746f7a6 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -838,7 +838,7 @@ void JaySynthAudioProcessor::bankImportXml (const XmlElement *xml) if (xml->hasTagName ("JSYNTH_BANK")) { 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")) { - patchImportXml_legacy(*xml, patch); + patchDecodeXml_legacy(*xml, patch); } setCurrentProgram(getCurrentProgram()); } @@ -1003,7 +1003,7 @@ void JaySynthAudioProcessor::saveBankToFile (const File &file) 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.. patch->setName(xml.getStringAttribute("NAME")); @@ -1022,7 +1022,7 @@ void JaySynthAudioProcessor::patchImportXml_legacy(const XmlElement& xml, JaySyn ((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.. XmlElement *pXML = (XmlElement*)&xml; @@ -1034,7 +1034,7 @@ void JaySynthAudioProcessor::bankImportXml_legacy(const XmlElement& xml) break; JaySynthSound *pPatch = &patches[progID]; - patchImportXml_legacy(*pXML, pPatch); + patchDecodeXml_legacy(*pXML, pPatch); ((JaySynthMidiCC*)pPatch->getMidiCC())->importXML(pXML); pXML = pXML->getNextElement(); } diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index a8a2742..249bc50 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -207,27 +207,49 @@ public: XmlElement* getXmlFromBinary (const void* data, const int sizeInBytes); const String getParameterNameXML (int index); + // Patch encode void patchEncodeXml(XmlElement *xml, JaySynthSound const *patch); - void patchDecodeXml(const XmlElement *xml, JaySynthSound *patch); + // Bank encode 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 getStateInformation (MemoryBlock& destData); + // Bank import VST 2.4 void setStateInformation (const void* data, int sizeInBytes); - void loadPatchFromFile (const File &file, int index); - void savePatchToFile (const File &file, int index); - void loadBankFromFile (const File &file); - void saveBankToFile (const File &file); + // Patch export VST 2.4 + void getCurrentProgramStateInformation (MemoryBlock& destData); - void patchImportXml_legacy(const XmlElement& xml, JaySynthSound *patch); - void bankImportXml_legacy(const XmlElement& xml); - void bankImportXml (const XmlElement *xml); - void patchImportXml (const XmlElement *xml, JaySynthSound *patch); + // Bank export VST 2.4 + void getStateInformation (MemoryBlock& destData); + + // 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(); //==============================================================================