diff --git a/Makefile b/Makefile index db1bfd1..40e291b 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ include make/defaults.mk CONFIG ?= release TARGET ?= JaySynth.so -APP_VERSION := 1.0.1b +APP_VERSION := 1.1.0 APP_VERSION_HEX := 0x010001 LIBSRC_PATH ?= $(realpath ./submodule) JUCE_PATH := $(realpath ./sdk/juce/JUCE-3.1.1) diff --git a/src/plug/JaySynthMidiCC.cpp b/src/plug/JaySynthMidiCC.cpp index 90c1ecd..4747034 100644 --- a/src/plug/JaySynthMidiCC.cpp +++ b/src/plug/JaySynthMidiCC.cpp @@ -185,14 +185,13 @@ void JaySynthMidiCC::exportXML(String name) xml.writeToFile (/*const File &destinationFile*/file, /*const String &dtdToUse*/"JSYNTH_MIDICC_TABLE_FILE" /*, const String &encodingType="UTF-8", int lineWrapLength=60*/); } -void JaySynthMidiCC::exportXML(XmlElement *pXML_doc) const +void JaySynthMidiCC::exportXML(XmlElement *pXML_root) const { int paramID; midiCC_container_t const *pMidiContainer; - XmlElement *pXML, *pXML_root, *pXML_PARAM, *pXML_PARAM_INFO; + XmlElement *pXML, *pXML_PARAM, *pXML_PARAM_INFO; // Store controller and slider infos - pXML_root = pXML_doc->createNewChildElement (String("JSYNTH_MIDICONTROLLER_TABLE")); pXML = pXML_root->createNewChildElement (String("TARGETS")); for (paramID=0; paramID < SYNTH_NUM_PARAMS; paramID++) { @@ -267,30 +266,19 @@ void JaySynthMidiCC::exportXML(XmlElement *pXML_doc) const */ } -int JaySynthMidiCC::importXML(String name) -{ - File file(name); - XmlDocument xml(file); - - ScopedPointer pXML_root (xml.getDocumentElement()); - - return importXML(pXML_root); -} - -int JaySynthMidiCC::importXML(XmlElement const *pXML_doc) +int JaySynthMidiCC::importXML(XmlElement const *pXML_MidiCc) { int i, paramID; midiCC_container_t *pMidiContainer; - XmlElement *pXML, *pXML_root, *pXML_PARAM, *pXML_PARAM_INFO; + XmlElement *pXML, *pXML_PARAM, *pXML_PARAM_INFO; for (i=0; i < NUM_MIDI_CONTROLLERS; i++) removeDestinations(i); - pXML_root = pXML_doc->getChildByName ("JSYNTH_MIDICONTROLLER_TABLE"); // make sure that it's actually our type of XML object.. - if (pXML_root) + if (pXML_MidiCc) { - pXML = pXML_root->getFirstChildElement(); + pXML = pXML_MidiCc->getFirstChildElement(); while(pXML) { pXML_PARAM = pXML->getFirstChildElement(); diff --git a/src/plug/JaySynthMidiCC.h b/src/plug/JaySynthMidiCC.h index bbe251a..530ea3d 100644 --- a/src/plug/JaySynthMidiCC.h +++ b/src/plug/JaySynthMidiCC.h @@ -57,7 +57,6 @@ public: int findParamID_byName(String name); void exportXML(String name); void exportXML(XmlElement *pXML_doc) const; - int importXML(String name); int importXML(XmlElement const *pXML_doc); void add(midiCC_container_t *pObj, int controllerID); void remove(midiCC_container_t *pObj, int controllerID); diff --git a/src/plug/PluginProcessor.cpp b/src/plug/PluginProcessor.cpp index 1a5b6ba..6da95a8 100644 --- a/src/plug/PluginProcessor.cpp +++ b/src/plug/PluginProcessor.cpp @@ -11,6 +11,7 @@ #include "PluginProcessor.h" #include "JaySynthAudioProcessorEditor.h" +#include "synth/vco.h" #include using namespace juce; @@ -296,6 +297,10 @@ const String JaySynthAudioProcessor::getParameterText (int index) return "Tri"; case OSC_WAVEFORM_SINE: return "Sine"; + case OSC_WAVEFORM_WAVETABLE: + return "Wavetable"; + case OSC_WAVEFORM_IMPULSE: + return "Impulse"; default: return "Unknown (" + String((int)pSynth->getParameter(index)) + ")"; } @@ -576,6 +581,8 @@ void JaySynthAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer m_limiter_active = 0; + synth_float_t master_gain = 0.5; + #ifdef WITH_LIMITER synth_float_t limiter_env[SYNTH_MAX_BUFSIZE]; synth_float_t limiter_gain[SYNTH_MAX_BUFSIZE]; @@ -613,22 +620,22 @@ void JaySynthAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer for (i=0; i getParameter(i); xml_patch->setAttribute (getParameterNameXML(i), String(value, 10)); } - patch->getMidiCC()->exportXML(xml_patch); + XmlElement *xml_midiCC = xml->createNewChildElement("MidiCC"); + patch->getMidiCC()->exportXML(xml_midiCC); } void JaySynthAudioProcessor::patchDecodeXml(const XmlElement *xml, JaySynthSound *patch) @@ -753,7 +761,11 @@ void JaySynthAudioProcessor::patchDecodeXml(const XmlElement *xml, JaySynthSound } patch->setParameter(i, value); } - ((JaySynthMidiCC*)patch->getMidiCC())->importXML(xml); + XmlElement *pXML_MidiCc = xml->getChildByName ("JSYNTH_MIDICONTROLLER_TABLE"); + if (pXML_MidiCc) + { + ((JaySynthMidiCC*)patch->getMidiCC())->importXML(pXML_MidiCc); + } } @@ -782,12 +794,7 @@ void JaySynthAudioProcessor::bankDecodeXml(const XmlElement *_xml) } JaySynthSound *pPatch = &patches[progID]; { - XmlElement *xml2 = xml->getFirstChildElement(); - if (xml2->hasTagName ("Patch")) - { - // Read patch - patchDecodeXml(xml2, pPatch); - } + patchImportXml(xml, pPatch); } xml = xml->getNextElement(); } @@ -801,8 +808,6 @@ void JaySynthAudioProcessor::getStateInformation (MemoryBlock& destData) ScopedPointer xml = new XmlElement("JSynth"); bankEncodeXml(xml); - setCurrentProgram(getCurrentProgram()); - MemoryOutputStream outputStream(destData, false); MemoryBlock tmpBlock(destData.getSize(), /*initialiseToZero*/true); GZIPCompressorOutputStream GZIPEnc(&outputStream, /*compressionLevel*/0, /*deleteDestStreamWhenDestroyed*/false, /*windowBits*/0); @@ -933,24 +938,33 @@ void JaySynthAudioProcessor::loadPatchFromFile (const File &file, int index) else if (String(".xmp") == ext) { ScopedPointer xml = XmlDocument::parse(file); - patchImportXml(xml, currpatch); + if (xml->hasTagName ("JSynth")) + { + patchImportXml(xml, currpatch); + } } } void JaySynthAudioProcessor::patchImportXml (const XmlElement *xml, JaySynthSound *patch) { - if (xml->hasTagName ("JSynth")) + XmlElement *xml2 = xml->getFirstChildElement(); + while(xml2) { - XmlElement *xml2 = xml->getFirstChildElement(); if (xml2->hasTagName ("Patch")) { patchDecodeXml(xml2, patch); } - } - else if (xml->hasTagName ("JSYNTH_PATCH")) - { - patchDecodeXml_legacy(*xml, patch); - } + else if (xml->hasTagName ("JSYNTH_PATCH")) + { + patchDecodeXml_legacy(*xml, patch); + } + else if (xml2->hasTagName ("MidiCC")) + { + XmlElement *pXML_MidiCc = xml->getChildByName ("MidiCC"); + ((JaySynthMidiCC*)patch->getMidiCC())->importXML(pXML_MidiCc); + } + xml2 = xml2->getNextElement(); + }; setCurrentProgram(getCurrentProgram()); } @@ -980,7 +994,11 @@ void JaySynthAudioProcessor::setCurrentProgramStateInformation (const void* data ScopedPointer xml = getXmlFromBinary(pData, size); if (xml) { - patchImportXml(xml, currpatch); + if (xml->hasTagName ("JSynth")) + { + XmlElement *xml2 = xml->getFirstChildElement(); + patchImportXml(xml2, currpatch); + } } } @@ -1001,6 +1019,8 @@ void JaySynthAudioProcessor::savePatchToFile (const File &file, int index) // Write XML to file xml->writeToFile (/*const File &destinationFile*/file, /*dtdToUse*/""); + setCurrentProgram(getCurrentProgram()); + } } @@ -1039,7 +1059,8 @@ void JaySynthAudioProcessor::patchDecodeXml_legacy(const XmlElement& xml, JaySyn } patch->setParameter(i, value); } - ((JaySynthMidiCC*)patch->getMidiCC())->importXML(&xml); + XmlElement *pXML_MidiCc = xml.getChildByName ("JSYNTH_MIDICONTROLLER_TABLE"); + ((JaySynthMidiCC*)patch->getMidiCC())->importXML(pXML_MidiCc); } void JaySynthAudioProcessor::bankDecodeXml_legacy(const XmlElement& xml) @@ -1055,7 +1076,8 @@ void JaySynthAudioProcessor::bankDecodeXml_legacy(const XmlElement& xml) JaySynthSound *pPatch = &patches[progID]; patchDecodeXml_legacy(*pXML, pPatch); - ((JaySynthMidiCC*)pPatch->getMidiCC())->importXML(pXML); + XmlElement *pXML_MidiCc = pXML->getChildByName ("JSYNTH_MIDICONTROLLER_TABLE"); + ((JaySynthMidiCC*)pPatch->getMidiCC())->importXML(pXML_MidiCc); pXML = pXML->getNextElement(); } }