2
0
Fork 0

Merge pull request #8 from getdunne/master

Default voice count is 8
This commit is contained in:
reales 2019-09-01 21:17:26 +02:00 committed by GitHub
commit a57360d261
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 6 deletions

1
.gitignore vendored
View file

@ -318,3 +318,4 @@ __pycache__/
*.odx.cs
*.xsd.cs
*.exe
Source/Images/appIcon.png

View file

@ -137,8 +137,7 @@
<MODULEPATH id="juce_audio_basics" path="modules"/>
</MODULEPATHS>
</VS2013>
<VS2019 targetFolder="Builds/VisualStudio2019" smallIcon="nnY63W" bigIcon="nnY63W"
vst3Folder="modules/vstsdk3">
<VS2019 targetFolder="Builds/VisualStudio2019" smallIcon="nnY63W" bigIcon="nnY63W">
<CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug" useRuntimeLibDLL="0"/>
<CONFIGURATION isDebug="0" name="Release32" useRuntimeLibDLL="0" winArchitecture="Win32"/>
@ -160,6 +159,28 @@
<MODULEPATH id="juce_audio_basics"/>
</MODULEPATHS>
</VS2019>
<VS2017 targetFolder="Builds/VisualStudio2017">
<CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug"/>
<CONFIGURATION isDebug="0" name="Release32" winArchitecture="Win32"/>
<CONFIGURATION isDebug="0" name="Release64" winArchitecture="x64"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_opengl"/>
<MODULEPATH id="juce_gui_extra"/>
<MODULEPATH id="juce_gui_basics"/>
<MODULEPATH id="juce_graphics"/>
<MODULEPATH id="juce_events"/>
<MODULEPATH id="juce_data_structures"/>
<MODULEPATH id="juce_core"/>
<MODULEPATH id="juce_audio_utils"/>
<MODULEPATH id="juce_audio_processors"/>
<MODULEPATH id="juce_audio_plugin_client"/>
<MODULEPATH id="juce_audio_formats"/>
<MODULEPATH id="juce_audio_devices"/>
<MODULEPATH id="juce_audio_basics"/>
</MODULEPATHS>
</VS2017>
</EXPORTFORMATS>
<MODULES>
<MODULES id="juce_audio_basics" showAllCode="1" useLocalCopy="1"/>
@ -179,5 +200,6 @@
<JUCEOPTIONS JUCE_QUICKTIME="disabled"/>
<LIVE_SETTINGS>
<OSX/>
<WINDOWS/>
</LIVE_SETTINGS>
</JUCERPROJECT>

View file

@ -734,6 +734,7 @@ void ObxdAudioProcessor::getStateInformation (MemoryBlock& destData)
{
XmlElement* xpr = new XmlElement("program");
xpr->setAttribute(S("programName"), programs.programs[i].name);
xpr->setAttribute(S("voiceCount"), Motherboard::MAX_VOICES);
for (int k = 0; k < PARAM_COUNT; ++k)
{
@ -753,9 +754,25 @@ void ObxdAudioProcessor::getStateInformation (MemoryBlock& 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)
{
if (XmlElement* const xmlState = getXmlFromBinary(data,sizeInBytes))
if (std::unique_ptr<XmlElement> xmlState = getXmlFromBinary(data,sizeInBytes))
{
XmlElement* xprogs = xmlState->getFirstChildElement();
if (xprogs->hasTagName(S("programs")))
@ -763,11 +780,14 @@ void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
int i = 0;
forEachXmlChildElement(*xprogs, e)
{
bool newFormat = e->hasAttribute("voiceCount");
programs.programs[i].setDefaultValues();
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"));
@ -789,13 +809,16 @@ void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
void ObxdAudioProcessor::setCurrentProgramStateInformation(const void* data,int sizeInBytes)
{
if (XmlElement* const e = getXmlFromBinary(data, sizeInBytes))
if (std::unique_ptr<XmlElement> e = getXmlFromBinary(data, sizeInBytes))
{
programs.currentProgramPtr->setDefaultValues();
bool newFormat = e->hasAttribute("voiceCount");
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"));
@ -820,6 +843,7 @@ void ObxdAudioProcessor::getCurrentProgramStateInformation(MemoryBlock& destData
copyXmlToBinary(xmlState, destData);
}
//==============================================================================
bool ObxdAudioProcessor::loadFromFXBFile(const File& fxbFile)
{