For the past month or so, my primary JUCE synthesiser (which I learned JUCE to build) has been in good working order from a functionality standpoint. I have been very, very happy with it.
However, I have been increasingly frustrated by an abnormal behavior I can’t explain or understand. I have narrowed down the exact operation that is causing the problem, which I will describe here.
I am using Cubase 10 as my DAW and the synth as VST3.
The synth displays an abnormal behavior whenever a MIDI track feeding it has its “Record Enable” button clicked off. Ie. In this screencap, “MIDI 01 (D)” is a MIDI track feeding “C Guit A L” which is my JUCE synthesiser as a Track Instrument. By default, Cubase enables recording on any MIDI track you select. But if I deactivate this red button, either by manually clicking it, or clicking to another MIDI track instead, there is a significant chance that my Synthesiser will crap out and no longer be able to process any MIDI after doing so. This abnormal behavior can be triggered during playback or when the project is stopped.
I can then typically restore function to the synth by powering it on/off in the Synth Rack (works 95% of the time) or by resetting its parameter tree with a “reset” button build into the synth.
If I trigger this abnormal behavior during playback, the synth will continue to render the existing MIDI note without Note Off as long as playback continues. (ie. The last playing notes will hang until they naturally decay.) However, no further MIDI is processed (it is silent to new notes until ‘reset’ as above). This makes me wonder if there is something specifically in the MIDI handling that is going awry, as it can clearly still output audio after the glitch occurs - it just can’t process new MIDI data.
Is there anything that should be happening inside the synthesiser when the “Record Enable” button is clicked off? Is there any way I can figure out what is happening when this button is clicked off?
My understanding is that when Record Enable is red (on), the synthesiser is getting MIDI both from the recorded track data and from any MIDI inputs that are live within Cubase. When you click it “off”, Cubase turns off the MIDI routing from external devices to the synth, and only the recorded track data continues to be fed to the synth. There is a momentary “lag” when you do this and playback hangs momentarily whenever you click it off.
My best idea is that possibly during the Cubase delay when playback “hangs” from doing this, something is being disrupted in the MIDI buffer and it is being corrupted. I have locked my entire void AudioPlugInAudioProcessor::processBlock in pluginProcessor.cpp with const ScopedLock renderLock(lock); as its first line. Wouldn’t that protect it against this sort of problem? Is there anything else I should try locking to see if it fixes it?
I need to solve this as now although my synth sounds great, I cannot practically use it in projects. Instances constantly crap out even just from me clicking around the project from MIDI track to MIDI track, and then I must constantly audit which instances are still running or not and keep disabling/enabling them in the Synth Rack to try to bring them back. It’s become impossible.
This is the only abnormal behavior I can observe in the synth after weeks of playing with it and this is the only way I can trigger it.
I would greatly appreciate any thoughts or ideas on what this might represent or what I could try next. Thanks.

