2
0
Fork 0

Default voice count is 8

To ensure backward-compatibility with older banks, the program format has been updated to include a new "voiceCount" attribute (with value 32). When loading patches, the patch XML is checked, and if it does not include the "voiceCount" attribute, the value of the VOICE_COUNT parameter is scaled by 0.25, i.e., to the range 0-8, instead of the new range 0-32. Newly-saved patches will have the new attribute, and the parameter value will not be scaled when the patch is read in.
This commit is contained in:
Shane Dunne 2019-09-01 15:01:24 -04:00
parent b851517b85
commit d5cf54e76e
4 changed files with 53 additions and 22 deletions

1
.gitignore vendored
View file

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

View file

@ -136,8 +136,7 @@
<MODULEPATH id="juce_audio_basics" path="modules"/> <MODULEPATH id="juce_audio_basics" path="modules"/>
</MODULEPATHS> </MODULEPATHS>
</VS2013> </VS2013>
<VS2019 targetFolder="Builds/VisualStudio2019" smallIcon="nnY63W" bigIcon="nnY63W" <VS2019 targetFolder="Builds/VisualStudio2019" smallIcon="nnY63W" bigIcon="nnY63W">
vst3Folder="modules/vstsdk3">
<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"/>
@ -159,6 +158,28 @@
<MODULEPATH id="juce_audio_basics"/> <MODULEPATH id="juce_audio_basics"/>
</MODULEPATHS> </MODULEPATHS>
</VS2019> </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> </EXPORTFORMATS>
<MODULES> <MODULES>
<MODULES id="juce_audio_basics" showAllCode="1" useLocalCopy="1"/> <MODULES id="juce_audio_basics" showAllCode="1" useLocalCopy="1"/>
@ -178,5 +199,6 @@
<JUCEOPTIONS JUCE_QUICKTIME="disabled"/> <JUCEOPTIONS JUCE_QUICKTIME="disabled"/>
<LIVE_SETTINGS> <LIVE_SETTINGS>
<OSX/> <OSX/>
<WINDOWS/>
</LIVE_SETTINGS> </LIVE_SETTINGS>
</JUCERPROJECT> </JUCERPROJECT>

View file

@ -645,7 +645,7 @@ void ObxdAudioProcessorEditor::mouseUp(const MouseEvent& e)
DirectoryIterator it(getFilter()->getSkinFolder(), false, "*", File::findDirectories); DirectoryIterator it(getFilter()->getSkinFolder(), false, "*", File::findDirectories);
while (it.next()) while (it.next())
{ {
skins.addUsingDefaultSort(it.getFile());r skins.addUsingDefaultSort(it.getFile());
} }
for (int i = 0; i < skins.size(); ++i) for (int i = 0; i < skins.size(); ++i)

View file

@ -734,6 +734,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)
{ {
@ -752,10 +753,25 @@ 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 (std::unique_ptr<XmlElement> xmlState = getXmlFromBinary(data,sizeInBytes))
{ {
XmlElement* xprogs = xmlState->getFirstChildElement(); XmlElement* xprogs = xmlState->getFirstChildElement();
if (xprogs->hasTagName(S("programs"))) if (xprogs->hasTagName(S("programs")))
@ -763,11 +779,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"));
@ -787,13 +806,16 @@ void ObxdAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
void ObxdAudioProcessor::setCurrentProgramStateInformation(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(); 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"));
@ -801,20 +823,6 @@ void ObxdAudioProcessor::setCurrentProgramStateInformation(const void* data,int
setCurrentProgram(programs.currentProgram); setCurrentProgram(programs.currentProgram);
} }
} }
*/
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)