- refactored kml import/export
- added ability to import patch file with midicc defined without patch parameter - fixed notes cut off by calling getStateInformation() - disabled limiter - increased version to v1.1.0-pre
This commit is contained in:
@@ -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<XmlElement> 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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "PluginProcessor.h"
|
||||
#include "JaySynthAudioProcessorEditor.h"
|
||||
#include "synth/vco.h"
|
||||
#include <synth/vector_utils.h>
|
||||
|
||||
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 <numSamples; i++)
|
||||
{
|
||||
buf1[i] = (float)(buf[0][i]*limiter_gain[i]);
|
||||
buf1[i] = (float)(master_gain*buf[0][i]*limiter_gain[i]);
|
||||
}
|
||||
|
||||
for (i=0; i <numSamples; i++)
|
||||
{
|
||||
buf2[i] = (float)(buf[1][i]*limiter_gain[i]);
|
||||
buf2[i] = (float)(master_gain*buf[1][i]*limiter_gain[i]);
|
||||
}
|
||||
#else
|
||||
for (i=0; i <numSamples; i++)
|
||||
{
|
||||
buf1[i] = (float)(buf[0][i]);
|
||||
buf1[i] = (float)(master_gain*buf[0][i]);
|
||||
}
|
||||
|
||||
for (i=0; i <numSamples; i++)
|
||||
{
|
||||
buf2[i] = (float)(buf[1][i]);
|
||||
buf2[i] = (float)(master_gain*buf[1][i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -734,7 +741,8 @@ void JaySynthAudioProcessor::patchEncodeXml(XmlElement *xml, JaySynthSound const
|
||||
synth_float_t value = patch->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 <XmlElement> 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<XmlElement> 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<XmlElement> 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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user