- added load of fxb through GUI

- added load of fxp through GUI
This commit is contained in:
2023-04-28 14:08:59 +02:00
parent b4add9e530
commit ea4397907f
3 changed files with 45 additions and 44 deletions
+36 -40
View File
@@ -796,15 +796,6 @@ void JaySynthAudioProcessor::getStateInformation (MemoryBlock& destData)
copyXmlToBinary (*xml, tmpBlock);
GZIPEnc.write(tmpBlock.getData(), tmpBlock.getSize());
outputStream.flush();
#if 0
{
File pluginfile = File::getSpecialLocation (File::currentExecutableFile).getParentDirectory();
File file(pluginfile.getFullPathName() + String("/bank.xml"));
file.create();
xml->writeToFile (/*const File &destinationFile*/file, /*const String &dtdToUse*/"JSYNTH_BANK_FILE" /*, const String &encodingType="UTF-8", int lineWrapLength=60*/);
}
#endif
}
void JaySynthAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
@@ -866,15 +857,6 @@ void JaySynthAudioProcessor::getCurrentProgramStateInformation (MemoryBlock& des
// then use this helper function to stuff it into the binary blob and return it..
copyXmlToBinary (*xml, tmpBlock);
GZIPEnc.write(tmpBlock.getData(), tmpBlock.getSize());
#if 0
//#ifdef SYNTH_DEBUG
{
File file(String("C:\\Users\\jens\\JaySynth\\") + String(currpatch->getName()) + String(".xml"));
file.create();
xml->writeToFile (/*const File &destinationFile*/file, /*const String &dtdToUse*/"JSYNTH_PATCH_FILE" /*, const String &encodingType="UTF-8", int lineWrapLength=60*/);
}
#endif
}
void JaySynthAudioProcessor::setCurrentProgramStateInformation (const void* data, int sizeInBytes)
@@ -909,33 +891,30 @@ void JaySynthAudioProcessor::setCurrentProgramStateInformation (const void* data
if (xmlState->hasTagName ("JSYNTH_PATCH"))
{
xml2patch(*xmlState, currpatch);
#if 0
// ok, now pull out our parameters..
currpatch->setName(xmlState->getStringAttribute("NAME"));
for (i=0; i < SYNTH_NUM_PARAMS; i++)
{
value = (synth_float_t) xmlState->getDoubleAttribute (getParameterNameXML(i), currpatch->getParameter(i));
if (i==SYNTH_PARAM_TUNE)
{
if (value > 400.0)
{
value = 1200*log(value/440)/log(2.0);
}
}
currpatch->setParameter(i, value);
}
((JaySynthMidiCC*)currpatch->getMidiCC())->importXML(xmlState);
#endif
setCurrentProgram(getCurrentProgram());
setCurrentProgram(getCurrentProgram());
}
}
}
void JaySynthAudioProcessor::loadPatch (const File &file, int index)
{
String filename(file.getFullPathName());
String ext = file.getFileExtension();
if (String(".fxp") == ext)
{
MemoryBlock mem;
file.loadFileAsData(mem);
fxProgram *program = (fxProgram*)mem.getData();
if (String((const char*)&program->chunkMagic) == String(cMagic))
{
bool is_regular = String((const char*)&program->fxMagic) == String(fMagic);
bool is_opaque = String((const char*)&program->fxMagic) == String(chunkPresetMagic);
if (is_opaque)
{
uint32_t size = ByteOrder::swap((uint32_t)program->content.data.size);
setCurrentProgramStateInformation(program->content.data.chunk, (int)size);
}
}
}
}
void JaySynthAudioProcessor::savePatch (const File &file, int index)
@@ -943,9 +922,26 @@ void JaySynthAudioProcessor::savePatch (const File &file, int index)
String filename(file.getFullPathName());
}
//#include <juce_ByteOrder.h>
void JaySynthAudioProcessor::loadBank (const File &file)
{
String filename(file.getFullPathName());
String ext = file.getFileExtension();
if (String(".fxb") == ext)
{
MemoryBlock mem;
file.loadFileAsData(mem);
fxBank *bank = (fxBank*)mem.getData();
if (String((const char*)&bank->chunkMagic) == String(cMagic))
{
bool is_regular = String((const char*)&bank->fxMagic) == String(bankMagic);
bool is_opaque = String((const char*)&bank->fxMagic) == String(chunkBankMagic);
if (is_opaque)
{
uint32_t size = ByteOrder::swap((uint32_t)bank->content.data.size);
setStateInformation(bank->content.data.chunk, (int)size);
}
}
}
}
void JaySynthAudioProcessor::saveBank (const File &file)