diff --git a/Source/FluidSynthModel.cpp b/Source/FluidSynthModel.cpp index bab6c34..a64b2df 100644 --- a/Source/FluidSynthModel.cpp +++ b/Source/FluidSynthModel.cpp @@ -20,6 +20,10 @@ FluidSynthModel::~FluidSynthModel() { } void FluidSynthModel::initialise() { + if (initialised) { + delete_fluid_synth(synth); + delete_fluid_settings(settings); + } settings = new_fluid_settings(); // https://sourceforge.net/p/fluidsynth/wiki/FluidSettings/ fluid_settings_setstr(settings, "synth.verbose", "yes"); diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 63fe898..5e37aae 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -152,6 +152,10 @@ void JuicySFAudioProcessor::processBlock (AudioBuffer& buffer, MidiBuffer synth.renderNextBlock (buffer, midiMessages, 0, numSamples); fluid_synth_process(fluidSynth, numSamples, 1, nullptr, buffer.getNumChannels(), buffer.getArrayOfWritePointers()); + // (see juce_VST3_Wrapper.cpp for the assertion this would trip otherwise) + // we are !JucePlugin_ProducesMidiOutput, so clear remaining MIDI messages from our buffer + midiMessages.clear(); + // In case we have more outputs than inputs, this code clears any output // channels that didn't contain input data, (because these aren't // guaranteed to be empty - they may contain garbage).