2
0
Fork 0

Merge pull request #9 from getdunne/new-juce-more-voices

JUCE 5.4.3 and 5.4.4 compatibility, 32 voices (defaults to 8 for legacy banks)
This commit is contained in:
reales 2019-09-02 20:05:42 +02:00 committed by GitHub
commit efc86a22c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 166 additions and 151 deletions

View file

@ -65,8 +65,7 @@
</GROUP> </GROUP>
</MAINGROUP> </MAINGROUP>
<EXPORTFORMATS> <EXPORTFORMATS>
<XCODE_MAC targetFolder="Builds/MacOSX" bigIcon="nnY63W" smallIcon="nnY63W" <XCODE_MAC targetFolder="Builds/MacOSX" bigIcon="nnY63W" smallIcon="nnY63W">
vst3Folder="modules/vstsdk3">
<CONFIGURATIONS> <CONFIGURATIONS>
<CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="Obxd" stripLocalSymbols="0" <CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="Obxd" stripLocalSymbols="0"
osxCompatibility="10.6 SDK" linkTimeOptimisation="0"/> osxCompatibility="10.6 SDK" linkTimeOptimisation="0"/>
@ -75,19 +74,19 @@
osxArchitecture="64BitIntel"/> osxArchitecture="64BitIntel"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl" path="modules"/> <MODULEPATH id="juce_opengl" path="~/JUCE/modules"/>
<MODULEPATH id="juce_gui_extra" path="modules"/> <MODULEPATH id="juce_gui_extra" path="~/JUCE/modules"/>
<MODULEPATH id="juce_gui_basics" path="modules"/> <MODULEPATH id="juce_gui_basics" path="~/JUCE/modules"/>
<MODULEPATH id="juce_graphics" path="modules"/> <MODULEPATH id="juce_graphics" path="~/JUCE/modules"/>
<MODULEPATH id="juce_events" path="modules"/> <MODULEPATH id="juce_events" path="~/JUCE/modules"/>
<MODULEPATH id="juce_data_structures" path="modules"/> <MODULEPATH id="juce_data_structures" path="~/JUCE/modules"/>
<MODULEPATH id="juce_core" path="modules"/> <MODULEPATH id="juce_core" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_processors" path="modules"/> <MODULEPATH id="juce_audio_processors" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_plugin_client" path="modules"/> <MODULEPATH id="juce_audio_plugin_client" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_formats" path="modules"/> <MODULEPATH id="juce_audio_formats" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_devices" path="modules"/> <MODULEPATH id="juce_audio_devices" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_basics" path="modules"/> <MODULEPATH id="juce_audio_basics"/>
<MODULEPATH id="juce_audio_utils" path="modules"/> <MODULEPATH id="juce_audio_utils" path="~/JUCE/modules"/>
</MODULEPATHS> </MODULEPATHS>
</XCODE_MAC> </XCODE_MAC>
<LINUX_MAKE targetFolder="Builds/LinuxMakefile" smallIcon="nnY63W" bigIcon="nnY63W"> <LINUX_MAKE targetFolder="Builds/LinuxMakefile" smallIcon="nnY63W" bigIcon="nnY63W">
@ -96,19 +95,19 @@
targetName="Obxd64"/> targetName="Obxd64"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl" path="modules"/> <MODULEPATH id="juce_opengl" path="~/JUCE/modules"/>
<MODULEPATH id="juce_gui_extra" path="modules"/> <MODULEPATH id="juce_gui_extra" path="~/JUCE/modules"/>
<MODULEPATH id="juce_gui_basics" path="modules"/> <MODULEPATH id="juce_gui_basics" path="~/JUCE/modules"/>
<MODULEPATH id="juce_graphics" path="modules"/> <MODULEPATH id="juce_graphics" path="~/JUCE/modules"/>
<MODULEPATH id="juce_events" path="modules"/> <MODULEPATH id="juce_events" path="~/JUCE/modules"/>
<MODULEPATH id="juce_data_structures" path="modules"/> <MODULEPATH id="juce_data_structures" path="~/JUCE/modules"/>
<MODULEPATH id="juce_core" path="modules"/> <MODULEPATH id="juce_core" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_utils" path="modules"/> <MODULEPATH id="juce_audio_utils" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_processors" path="modules"/> <MODULEPATH id="juce_audio_processors" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_plugin_client" path="modules"/> <MODULEPATH id="juce_audio_plugin_client" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_formats" path="modules"/> <MODULEPATH id="juce_audio_formats" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_devices" path="modules"/> <MODULEPATH id="juce_audio_devices" path="~/JUCE/modules"/>
<MODULEPATH id="juce_audio_basics" path="modules"/> <MODULEPATH id="juce_audio_basics"/>
</MODULEPATHS> </MODULEPATHS>
</LINUX_MAKE> </LINUX_MAKE>
<VS2013 targetFolder="Builds/VisualStudio2013"> <VS2013 targetFolder="Builds/VisualStudio2013">
@ -139,22 +138,22 @@
<VS2019 targetFolder="Builds/VisualStudio2019" smallIcon="nnY63W" bigIcon="nnY63W"> <VS2019 targetFolder="Builds/VisualStudio2019" smallIcon="nnY63W" bigIcon="nnY63W">
<CONFIGURATIONS> <CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug" useRuntimeLibDLL="0"/> <CONFIGURATION isDebug="1" name="Debug" useRuntimeLibDLL="0"/>
<CONFIGURATION isDebug="0" name="Release32" useRuntimeLibDLL="0"/> <CONFIGURATION isDebug="0" name="Release32" useRuntimeLibDLL="0" winArchitecture="Win32"/>
<CONFIGURATION isDebug="0" name="Release64" useRuntimeLibDLL="0" winArchitecture="Win32"/> <CONFIGURATION isDebug="0" name="Release64" useRuntimeLibDLL="0" winArchitecture="x64"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl"/> <MODULEPATH id="juce_opengl" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_gui_extra"/> <MODULEPATH id="juce_gui_extra" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_gui_basics"/> <MODULEPATH id="juce_gui_basics" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_graphics"/> <MODULEPATH id="juce_graphics" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_events"/> <MODULEPATH id="juce_events" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_data_structures"/> <MODULEPATH id="juce_data_structures" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_core"/> <MODULEPATH id="juce_core" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_utils"/> <MODULEPATH id="juce_audio_utils" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_processors"/> <MODULEPATH id="juce_audio_processors" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_plugin_client"/> <MODULEPATH id="juce_audio_plugin_client" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_formats"/> <MODULEPATH id="juce_audio_formats" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_devices"/> <MODULEPATH id="juce_audio_devices" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_basics"/> <MODULEPATH id="juce_audio_basics"/>
</MODULEPATHS> </MODULEPATHS>
</VS2019> </VS2019>
@ -165,36 +164,37 @@
<CONFIGURATION isDebug="0" name="Release64" winArchitecture="x64"/> <CONFIGURATION isDebug="0" name="Release64" winArchitecture="x64"/>
</CONFIGURATIONS> </CONFIGURATIONS>
<MODULEPATHS> <MODULEPATHS>
<MODULEPATH id="juce_opengl"/> <MODULEPATH id="juce_opengl" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_gui_extra"/> <MODULEPATH id="juce_gui_extra" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_gui_basics"/> <MODULEPATH id="juce_gui_basics" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_graphics"/> <MODULEPATH id="juce_graphics" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_events"/> <MODULEPATH id="juce_events" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_data_structures"/> <MODULEPATH id="juce_data_structures" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_core"/> <MODULEPATH id="juce_core" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_utils"/> <MODULEPATH id="juce_audio_utils" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_processors"/> <MODULEPATH id="juce_audio_processors" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_plugin_client"/> <MODULEPATH id="juce_audio_plugin_client" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_formats"/> <MODULEPATH id="juce_audio_formats" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_devices"/> <MODULEPATH id="juce_audio_devices" path="C:\JUCE\modules"/>
<MODULEPATH id="juce_audio_basics"/> <MODULEPATH id="juce_audio_basics"/>
</MODULEPATHS> </MODULEPATHS>
</VS2017> </VS2017>
</EXPORTFORMATS> </EXPORTFORMATS>
<MODULES> <MODULES>
<MODULES id="juce_audio_basics" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_audio_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_audio_devices" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_audio_devices" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_audio_formats" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_audio_formats" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_audio_plugin_client" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_audio_plugin_client" showAllCode="1" useLocalCopy="0"
<MODULES id="juce_audio_processors" showAllCode="1" useLocalCopy="1"/> useGlobalPath="1"/>
<MODULE id="juce_audio_utils" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_audio_processors" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_core" showAllCode="1" useLocalCopy="1"/> <MODULE id="juce_audio_utils" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_data_structures" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_core" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_events" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_data_structures" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_graphics" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_events" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_gui_basics" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_graphics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_gui_extra" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_gui_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_opengl" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_gui_extra" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_opengl" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
</MODULES> </MODULES>
<JUCEOPTIONS JUCE_QUICKTIME="disabled"/> <JUCEOPTIONS JUCE_QUICKTIME="disabled"/>
<LIVE_SETTINGS> <LIVE_SETTINGS>

View file

@ -48,8 +48,9 @@ public:
bool vibratoEnabled; bool vibratoEnabled;
float Volume; float Volume;
const static int MAX_VOICES=8; const static int MAX_VOICES = 32;
float pannings[MAX_VOICES]; const static int MAX_PANNINGS = 8;
float pannings[MAX_PANNINGS];
ObxdVoice voices[MAX_VOICES]; ObxdVoice voices[MAX_VOICES];
bool uni; bool uni;
bool Oversample; bool Oversample;
@ -79,7 +80,7 @@ public:
// pannings = new float[MAX_VOICES]; // pannings = new float[MAX_VOICES];
totalvc = MAX_VOICES; totalvc = MAX_VOICES;
vq = VoiceQueue(MAX_VOICES,voices); vq = VoiceQueue(MAX_VOICES,voices);
for(int i = 0 ; i < MAX_VOICES;++i) for(int i = 0 ; i < MAX_PANNINGS;++i)
{ {
pannings[i]= 0.5; pannings[i]= 0.5;
} }
@ -362,11 +363,12 @@ public:
float x1 = processSynthVoice(voices[i],lfovalue,viblfo); float x1 = processSynthVoice(voices[i],lfovalue,viblfo);
if(Oversample) if(Oversample)
{ {
float x2 = processSynthVoice(voices[i],lfovalue2,viblfo2); vlo+=x2*(1-pannings[i]); float x2 = processSynthVoice(voices[i],lfovalue2,viblfo2);
vro+=x2*(pannings[i]); vlo+=x2*(1-pannings[i % MAX_PANNINGS]);
vro+=x2*(pannings[i % MAX_PANNINGS]);
} }
vl+=x1*(1-pannings[i]); vl+=x1*(1-pannings[i % MAX_PANNINGS]);
vr+=x1*(pannings[i]); vr+=x1*(pannings[i % MAX_PANNINGS]);
} }
if(Oversample) if(Oversample)
{ {

View file

@ -166,7 +166,7 @@ public:
} }
void setVoiceCount(float param) void setVoiceCount(float param)
{ {
synth.setVoiceCount(roundToInt((param*7) +1)); synth.setVoiceCount(roundToInt((param*(synth.MAX_VOICES-1)) +1));
} }
void procPitchWheelAmount(float param) void procPitchWheelAmount(float param)
{ {
@ -184,7 +184,7 @@ public:
} }
void processPan(float param,int idx) void processPan(float param,int idx)
{ {
synth.pannings[idx-1] = param; synth.pannings[(idx-1) % synth.MAX_PANNINGS] = param;
} }
void processTune(float param) void processTune(float param)
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -287,14 +287,8 @@ void ObxdAudioProcessorEditor::rebuildComponents()
envelopeDetuneKnob = addTinyKnob(1353,300,ownerFilter,ENVDER,"Env",0.2); envelopeDetuneKnob = addTinyKnob(1353,300,ownerFilter,ENVDER,"Env",0.2);
voiceSwitch = addNormalButtonList(124,338,17,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromMemory(BinaryData::voices_png,BinaryData::voices_pngSize)); voiceSwitch = addNormalButtonList(124,338,17,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromMemory(BinaryData::voices_png,BinaryData::voices_pngSize));
voiceSwitch ->addChoise("1"); for (int i=1; i <= 32; i++)
voiceSwitch ->addChoise("2"); voiceSwitch ->addChoise(String(i));
voiceSwitch ->addChoise("3");
voiceSwitch ->addChoise("4");
voiceSwitch ->addChoise("5");
voiceSwitch ->addChoise("6");
voiceSwitch ->addChoise("7");
voiceSwitch ->addChoise("8");
voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification); voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification);
legatoSwitch = addNormalButtonList(25,338,65,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromMemory(BinaryData::legato_png,BinaryData::legato_pngSize)); legatoSwitch = addNormalButtonList(25,338,65,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromMemory(BinaryData::legato_png,BinaryData::legato_pngSize));
@ -400,14 +394,8 @@ void ObxdAudioProcessorEditor::rebuildComponents()
bendLfoRateKnob = addNormalKnobClassic(364,345,ownerFilter,BENDLFORATE,"ModRate",0.4); bendLfoRateKnob = addNormalKnobClassic(364,345,ownerFilter,BENDLFORATE,"ModRate",0.4);
voiceSwitch = addNormalButtonListClassic(172,321,38,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromFile(skinFolder.getChildFile("voices.png"))); voiceSwitch = addNormalButtonListClassic(172,321,38,ownerFilter,VOICE_COUNT,"VoiceCount",ImageCache::getFromFile(skinFolder.getChildFile("voices.png")));
voiceSwitch ->addChoise("1"); for (int i=1; i <= 32; i++)
voiceSwitch ->addChoise("2"); voiceSwitch->addChoise(String(i));
voiceSwitch ->addChoise("3");
voiceSwitch ->addChoise("4");
voiceSwitch ->addChoise("5");
voiceSwitch ->addChoise("6");
voiceSwitch ->addChoise("7");
voiceSwitch ->addChoise("8");
voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification); voiceSwitch ->setValue(ownerFilter->getParameter(VOICE_COUNT),dontSendNotification);
legatoSwitch = addNormalButtonListClassic(65,321,95,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromFile(skinFolder.getChildFile("legato.png"))); legatoSwitch = addNormalButtonListClassic(65,321,95,ownerFilter,LEGATOMODE,"Legato",ImageCache::getFromFile(skinFolder.getChildFile("legato.png")));
@ -676,7 +664,7 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
for (int i = 0; i < banks.size(); ++i) for (int i = 0; i < banks.size(); ++i)
{ {
const File bank = banks.getUnchecked(i); const File bank = banks.getUnchecked(i);
bankMenu.addItem(i + bankStart + 1, bank.getFileNameWithoutExtension(), true, bank.getFileName() == currentBank); bankMenu.addItem(i + bankStart + 1, bank.getFileName(), true, bank.getFileName() == currentBank);
} }
menu.addSubMenu("Banks", bankMenu); menu.addSubMenu("Banks", bankMenu);

View file

@ -11,6 +11,9 @@ It contains the basic startup code for a Juce application.
#include "PluginEditor.h" #include "PluginEditor.h"
#include "Engine/Params.h" #include "Engine/Params.h"
// Compare JUCE_VERSION against this to check for JUCE 5.4.3 and earlier
#define JUCE_543 328707
//only sse2 version on windows //only sse2 version on windows
#ifdef _WINDOWS #ifdef _WINDOWS
#define __SSE2__ #define __SSE2__
@ -734,6 +737,7 @@ void ObxdAudioProcessor::getStateInformation (MemoryBlock& destData)
{ {
XmlElement* xpr = new XmlElement("program"); XmlElement* xpr = new XmlElement("program");
xpr->setAttribute(S("programName"), programs.programs[i].name); xpr->setAttribute(S("programName"), programs.programs[i].name);
xpr->setAttribute(S("voiceCount"), Motherboard::MAX_VOICES);
for (int k = 0; k < PARAM_COUNT; ++k) for (int k = 0; k < PARAM_COUNT; ++k)
{ {
@ -753,9 +757,29 @@ void ObxdAudioProcessor::getStateInformation (MemoryBlock& destData)
copyXmlToBinary(xmlState, destData); copyXmlToBinary(xmlState, destData);
} }
void ObxdAudioProcessor::getCurrentProgramStateInformation(MemoryBlock& destData)
{
XmlElement xmlState = XmlElement("Datsounds");
for (int k = 0; k < PARAM_COUNT; ++k)
{
xmlState.setAttribute(String(k), programs.currentProgramPtr->values[k]);
}
xmlState.setAttribute(S("voiceCount"), Motherboard::MAX_VOICES);
xmlState.setAttribute(S("programName"), programs.currentProgramPtr->name);
copyXmlToBinary(xmlState, destData);
}
void ObxdAudioProcessor::setStateInformation(const void* data, int sizeInBytes) void ObxdAudioProcessor::setStateInformation(const void* data, int sizeInBytes)
{ {
if (XmlElement* const xmlState = getXmlFromBinary(data,sizeInBytes)) #if JUCE_VERSION <= JUCE_543
XmlElement * const xmlState = getXmlFromBinary(data, sizeInBytes);
#else
std::unique_ptr<XmlElement> xmlState = getXmlFromBinary(data, sizeInBytes);
#endif
if (xmlState)
{ {
XmlElement* xprogs = xmlState->getFirstChildElement(); XmlElement* xprogs = xmlState->getFirstChildElement();
if (xprogs->hasTagName(S("programs"))) if (xprogs->hasTagName(S("programs")))
@ -763,11 +787,14 @@ void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
int i = 0; int i = 0;
forEachXmlChildElement(*xprogs, e) forEachXmlChildElement(*xprogs, e)
{ {
bool newFormat = e->hasAttribute("voiceCount");
programs.programs[i].setDefaultValues(); programs.programs[i].setDefaultValues();
for (int k = 0; k < PARAM_COUNT; ++k) for (int k = 0; k < PARAM_COUNT; ++k)
{ {
programs.programs[i].values[k] = e->getDoubleAttribute(String(k), programs.programs[i].values[k]); float value = float(e->getDoubleAttribute(String(k), programs.programs[i].values[k]));
if (!newFormat && k == VOICE_COUNT) value *= 0.25f;
programs.programs[i].values[k] = value;
} }
programs.programs[i].name = e->getStringAttribute(S("programName"), S("Default")); programs.programs[i].name = e->getStringAttribute(S("programName"), S("Default"));
@ -783,43 +810,41 @@ void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"), 0)); setCurrentProgram(xmlState->getIntAttribute(S("currentProgram"), 0));
#if JUCE_VERSION <= JUCE_543
delete xmlState; delete xmlState;
#endif
} }
} }
void ObxdAudioProcessor::setCurrentProgramStateInformation(const void* data, int sizeInBytes) void ObxdAudioProcessor::setCurrentProgramStateInformation(const void* data, int sizeInBytes)
{ {
if (XmlElement* const e = getXmlFromBinary(data, sizeInBytes)) #if JUCE_VERSION <= JUCE_543
XmlElement * const e = getXmlFromBinary(data, sizeInBytes);
#else
std::unique_ptr<XmlElement> e = getXmlFromBinary(data, sizeInBytes);
#endif
if (e)
{ {
programs.currentProgramPtr->setDefaultValues(); programs.currentProgramPtr->setDefaultValues();
bool newFormat = e->hasAttribute("voiceCount");
for (int k = 0; k < PARAM_COUNT; ++k) for (int k = 0; k < PARAM_COUNT; ++k)
{ {
programs.currentProgramPtr->values[k] = e->getDoubleAttribute(String(k), programs.currentProgramPtr->values[k]); float value = float(e->getDoubleAttribute(String(k), programs.currentProgramPtr->values[k]));
if (!newFormat && k == VOICE_COUNT) value *= 0.25f;
programs.currentProgramPtr->values[k] = value;
} }
programs.currentProgramPtr->name = e->getStringAttribute(S("programName"), S("Default")); programs.currentProgramPtr->name = e->getStringAttribute(S("programName"), S("Default"));
setCurrentProgram(programs.currentProgram); setCurrentProgram(programs.currentProgram);
#if JUCE_VERSION <= JUCE_543
delete e; delete e;
#endif
} }
} }
void ObxdAudioProcessor::getCurrentProgramStateInformation(MemoryBlock& destData)
{
XmlElement xmlState = XmlElement("Datsounds");
for (int k = 0; k < PARAM_COUNT; ++k)
{
xmlState.setAttribute(String(k), programs.currentProgramPtr->values[k]);
}
xmlState.setAttribute(S("programName"), programs.currentProgramPtr->name);
copyXmlToBinary(xmlState, destData);
}
//============================================================================== //==============================================================================
bool ObxdAudioProcessor::loadFromFXBFile(const File& fxbFile) bool ObxdAudioProcessor::loadFromFXBFile(const File& fxbFile)
{ {