Birch-san / juicysfplugin

Audio plugin (e.g. VST, AU) to play soundfonts on macOS, Windows, Linux
GNU General Public License v3.0
209 stars 27 forks source link

after loading saved Mixcraft project, Juicy SF VST3 doesn't accept MIDI #18

Closed mrbumpy409 closed 4 years ago

mrbumpy409 commented 4 years ago

First of all, thank you for making this plugin! Being able to use FluidSynth in my DAW is a godsend!

If I save a project in Acoustica Mixcraft 9 that uses the Juicy SF VST3, then later load the project, Juicy SF doesn't respond to MIDI input at all, though sound can still be produced by clicking on the keyboard in the Juicy SF GUI. Talking with Dan Goldstein at Acoustica, he suggests that a flaw in the plugin is causing it to not process MIDI properly after restoring save data. A new instance created by duplicating the track works fine. Mixcraft 9 uses Juce for its VST3 support, and this bug appeared after Mixcraft upgraded to the latest Juce version. Do you have any insight on what might be causing this?

You can download a free demo of Mixcraft 9 to test this out with.

Dan would be happy to chat with you about this. I wanted to send you a DM with his info, but there doesn't seem to be a way for me to contact you on GitHub. Are you able to DM me?

Birch-san commented 4 years ago

Hi Mr. Bumpy,

Glad you've enjoyed juicysfplugin.
I downloaded the Mixcraft trial, and the issue reproduces, just like you say.

I've attached a debugger to it, and my conclusion is that the DAW is not sending me MIDI events.

Every ~11.6ms, the DAW invokes this function:
https://github.com/Birch-san/juicysfplugin/blob/master/Source/PluginProcessor.cpp#L171

And if the DAW has any MIDI messages to give to me, they should be inside MidiBuffer& midiMessages.
I iterate over the MIDI messages. If there are any, I should hit this breakpoint inside my call to fluidSynthModel.processBlock():
https://github.com/Birch-san/juicysfplugin/blob/master/Source/FluidSynthModel.cpp#L316

But when the problem's in effect: I never hit that breakpoint. The DAW's not giving me any MIDI messages. Even though I see the "MIDI" light in the DAW (so the DAW knows I'm pressing keys).

I'm on a reasonably recent JUCE version myself (5.4.3), so I'd be surprised if compatibility's broken. I've checked the changelogs since then, and it doesn't look like anything interesting happened.

I could try updating to latest VST3 SDK and latest JUCE, but besides that I don't think the problem could be on my end.

Birch-san commented 4 years ago

Okay, I tried updating to latest Steinberg VST3 SDK (3.6.14) and latest JUCE (5.4.7) but nothing improved.

mrbumpy409 commented 4 years ago

Hi Birch-san, Dan at Acoustica looked into this and made a video for you of his debugging process, which I have uploaded here. If you e-mail me at s_chriscollins@hotmail.com, I can put you in touch with him.

Birch-san commented 4 years ago

Thanks @mrbumpy409 and Dan at Acoustica for investigating this off-Github with me.

Underlying cause (determined by Dan) was that in newer versions of JUCE, releaseResources() disables MIDI buses, so it ought only be invoked on shutdown of an audio plugin (rather than on reset).

Mixcraft 9 Build 461 Beta resolves this issue (presumably with new logic for resetting plugins).