- added load of fxb through GUI
- added load of fxp through GUI
This commit is contained in:
@@ -4931,7 +4931,8 @@ void JaySynthAudioProcessorEditor::buttonClicked (Button* buttonThatWasClicked)
|
|||||||
|
|
||||||
if (buttonThatWasClicked == m_button_bank_load)
|
if (buttonThatWasClicked == m_button_bank_load)
|
||||||
{
|
{
|
||||||
FileChooser fc("Load bank");
|
String filePatterns("*.fxb;*.xml");
|
||||||
|
FileChooser fc("Load bank", File::nonexistent, filePatterns, false);
|
||||||
if (fc.browseForFileToOpen())
|
if (fc.browseForFileToOpen())
|
||||||
{
|
{
|
||||||
File const &file = fc.getResult();
|
File const &file = fc.getResult();
|
||||||
@@ -4940,7 +4941,8 @@ void JaySynthAudioProcessorEditor::buttonClicked (Button* buttonThatWasClicked)
|
|||||||
}
|
}
|
||||||
else if (buttonThatWasClicked == m_button_bank_save)
|
else if (buttonThatWasClicked == m_button_bank_save)
|
||||||
{
|
{
|
||||||
FileChooser fc("Save bank");
|
String filePatterns("*.fxb;*.xml");
|
||||||
|
FileChooser fc("Save bank", File::nonexistent, filePatterns, false);
|
||||||
if (fc.browseForFileToSave(true))
|
if (fc.browseForFileToSave(true))
|
||||||
{
|
{
|
||||||
File const &file = fc.getResult();
|
File const &file = fc.getResult();
|
||||||
@@ -4949,7 +4951,8 @@ void JaySynthAudioProcessorEditor::buttonClicked (Button* buttonThatWasClicked)
|
|||||||
}
|
}
|
||||||
else if (buttonThatWasClicked == m_button_patch_load)
|
else if (buttonThatWasClicked == m_button_patch_load)
|
||||||
{
|
{
|
||||||
FileChooser fc("Load patch");
|
String filePatterns("*.fxp;*.xml");
|
||||||
|
FileChooser fc("Load patch", File::nonexistent, filePatterns, false);
|
||||||
if (fc.browseForFileToOpen())
|
if (fc.browseForFileToOpen())
|
||||||
{
|
{
|
||||||
File const &file = fc.getResult();
|
File const &file = fc.getResult();
|
||||||
@@ -4958,7 +4961,8 @@ void JaySynthAudioProcessorEditor::buttonClicked (Button* buttonThatWasClicked)
|
|||||||
}
|
}
|
||||||
else if (buttonThatWasClicked == m_button_patch_save)
|
else if (buttonThatWasClicked == m_button_patch_save)
|
||||||
{
|
{
|
||||||
FileChooser fc("Save patch");
|
String filePatterns("*.fxp;*.xml");
|
||||||
|
FileChooser fc("Save patch", File::nonexistent, filePatterns, false);
|
||||||
if (fc.browseForFileToSave(true))
|
if (fc.browseForFileToSave(true))
|
||||||
{
|
{
|
||||||
File const &file = fc.getResult();
|
File const &file = fc.getResult();
|
||||||
|
|||||||
+36
-40
@@ -796,15 +796,6 @@ void JaySynthAudioProcessor::getStateInformation (MemoryBlock& destData)
|
|||||||
copyXmlToBinary (*xml, tmpBlock);
|
copyXmlToBinary (*xml, tmpBlock);
|
||||||
GZIPEnc.write(tmpBlock.getData(), tmpBlock.getSize());
|
GZIPEnc.write(tmpBlock.getData(), tmpBlock.getSize());
|
||||||
outputStream.flush();
|
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)
|
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..
|
// then use this helper function to stuff it into the binary blob and return it..
|
||||||
copyXmlToBinary (*xml, tmpBlock);
|
copyXmlToBinary (*xml, tmpBlock);
|
||||||
GZIPEnc.write(tmpBlock.getData(), tmpBlock.getSize());
|
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)
|
void JaySynthAudioProcessor::setCurrentProgramStateInformation (const void* data, int sizeInBytes)
|
||||||
@@ -909,33 +891,30 @@ void JaySynthAudioProcessor::setCurrentProgramStateInformation (const void* data
|
|||||||
if (xmlState->hasTagName ("JSYNTH_PATCH"))
|
if (xmlState->hasTagName ("JSYNTH_PATCH"))
|
||||||
{
|
{
|
||||||
xml2patch(*xmlState, currpatch);
|
xml2patch(*xmlState, currpatch);
|
||||||
|
setCurrentProgram(getCurrentProgram());
|
||||||
#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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JaySynthAudioProcessor::loadPatch (const File &file, int index)
|
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)
|
void JaySynthAudioProcessor::savePatch (const File &file, int index)
|
||||||
@@ -943,9 +922,26 @@ void JaySynthAudioProcessor::savePatch (const File &file, int index)
|
|||||||
String filename(file.getFullPathName());
|
String filename(file.getFullPathName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#include <juce_ByteOrder.h>
|
||||||
void JaySynthAudioProcessor::loadBank (const File &file)
|
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)
|
void JaySynthAudioProcessor::saveBank (const File &file)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "JaySynthSound.h"
|
#include "JaySynthSound.h"
|
||||||
#include "JaySynth.h"
|
#include "JaySynth.h"
|
||||||
#include "JK_MidiClock.h"
|
#include "JK_MidiClock.h"
|
||||||
|
#include <pluginterfaces/vst2.x/vstfxstore.h>
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user