With my Juce based host, I seem to be having occasional issues with stopping the transport properly. Every now and then, after a stop, I see a NI Reaktor 5 plugin sending constant -1.0 for a certain span of time, resulting in a harsh digital "phooomp!", almost blasting my speakers. The plugin then becomes silent (input still indicated, but no output). Other plugins play nicely. I've received a report of EWQL PLAY on Windows also causing trouble after STOP, but could not reproduce that.
So I wonder how a proper implementation of a host transport is supposed to look like. What my transport currently does:
1. Stream an AudioProcessorGraph hooked into an AudioProcessorPlayer
2. Supply the graph with an AudioPlayhead that is incremented/modified in advance to each render call
3. On STOP, playhead.isPlaying = false and playhead.timeInSeconds, playhead.ppqPosition are no longer incremented
I wonder if I am missing something. Should timeInSeconds/ppqPosition continue to be incremented with each render call, even if the transport is stopped? Am I seeing a threading issue, i.e. the render callback possibly suspended/blocked for some reason?
Should I put "transport commands" (start, stop, locate, tempo change, etc) in a queue and have the render callback execute these as part of the render loop himself? (currently I have a lock around the playhead).
This sort of issue is extremely difficult to debug. How did you implement your transport? Any hint is much appreciated!