Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
the_plugin_processor [2017/08/30 17:41] shane [The preset-handling functions] |
the_plugin_processor [2017/08/30 17:47] (current) shane |
</code> | </code> |
This code changes the //pParams// pointer inside the shared //SynthSound// object, which propagates the change to subsequently-played notes (we don't attempt to change currently-sounding notes in response to program changes), then calls //sendChangeMessage()// to notify the GUI editor, so it can update its display accordingly. | This code changes the //pParams// pointer inside the shared //SynthSound// object, which propagates the change to subsequently-played notes (we don't attempt to change currently-sounding notes in response to program changes), then calls //sendChangeMessage()// to notify the GUI editor, so it can update its display accordingly. |
| |
| ===== changeProgramName() ===== |
| |
| The //changeProgramName()// function gets called whenever the user edits the name of the current preset through the plugin host: |
| <code cpp> |
| void VanillaJuceAudioProcessor::changeProgramName (int index, const String& newName) |
| { |
| newName.copyToUTF8(programBank[index].programName, kMaxProgramNameLength); |
| sendChangeMessage(); |
| } |
| </code> |
| |
| The present VanillaJuce GUI does not display program names, but I've included a call to //sendChangeMessage()// to notify the GUI anyway, so I won't forget it. If and when I do add a program-name display to the GUI, it will get updated whenever the name is changed through the plugin host. |
| |
===== The preset-handling functions ===== | ===== The preset-handling functions ===== |
| |
The plugin host can call //getCurrentProgramStateInformation()// to get the current preset as a "blob" of binary data (which it can e.g. save to a ''.fxp'' file), or call //setCurrentProgramStateInformation()// to do the reverse operation. In an early version of VanillaJuce, I simply did a binary copy of the //SynthParameters// ''struct'', but I realized that would cause problems as I changed the structure over time, so the new code uses JUCE's XML capabilities to save and restore the data in XML format: | The plugin host can call //getCurrentProgramStateInformation()// to get the current preset as a "blob" of binary data (which it can e.g. save to a ''.fxp'' file), or call //setCurrentProgramStateInformation()// to do the reverse operation. In an early version of VanillaJuce, I simply did a binary copy of the //SynthParameters// ''struct'', but I realized that would cause problems as I changed the structure over time, so the new code uses JUCE's XML capabilities to save and restore the data in XML format. (I based my code on that in [[https://github.com/2DaT/Obxd|Obxd]].) |
<code cpp> | <code cpp> |
void VanillaJuceAudioProcessor::getCurrentProgramStateInformation(MemoryBlock& destData) | void VanillaJuceAudioProcessor::getCurrentProgramStateInformation(MemoryBlock& destData) |