Studio One: isNonRealtime () always false in prepareToPlay ()

Hi JUCErs,

I am testing my plugin in Studio One 3 Professional (v3.5.2.44603) and I noticed that offline rendering doesn’t work.

What I found is that, although prepareToPlay is always called on my processor, isNonRealtime () always returns false in it.

In the processBlock, though, I can see that is, in fact, non-realtime rendering…

I am having the same issue in FinalCutProX (AU). I realised, that the value can change anywhere. I got only one call to prepareToPlay, even though the settings change later…

I had to call isNonRealtime each processBlock() (not sure if I stick to that solution…)

Help me out, which plugin format is this? AU or VST(3)?

VST’s (2 & 3) prepareToPlay don’t get to see the actual isNonRealtime () value.
AU’s see the correct value.

Weirdly I still get silence when exporting (Export Mixdown) even when using the AU…

Are you using any BufferingAudioSources by any chance?
If so, add a blocking command, so the buffer can be refilled:

if (isNonRealtime())
    if (auto* buff = dynamic_cast<BufferingAudioSource*> (source))
        buff->waitForNextAudioBlockReady (info, 500);

source->getNextAudioBlock (info);

Nope, but I have a bunch of threads that I collapse into a single-thread execution when it’s non-realtime rendering. Still don’t understand why the AU produce complete silence, while it gets to know it’s offline rendering… I am sure I am to blame about this (will debug), but the issue for VST and VST3 not getting to know whether it’s realtime rendering or not in their prepareToPlay remains.

Update:
Testing Ableton Live I get even more inconsistencies with prepareToPlay… VST’s get their prepareToPlay called and isNonRealtime () returns the correct value, but after export their prepareToPlay is called twice more, both times with isNonRealtime () saying true, so if you switch to offline rendering - that’s what will be used next in realtime processBlock calls. AU’s in Live don’t get their prepareToPlay called at all on export (neither before, nor after) so it renders your plugin in realtime at all times.

The only consistency I find so far is isNonRealtime () calls within the processBlock. Only there I haven’t found a case where it is incorrect.

VST: I’m afraid that we can’t do anything about the missing prepareToPlay call in VSTs as VST2 does not provide any callback mechanism when the host switches to non-realtime mode. We can only probe if the plug-in is in non-realtime mode and the earliest time ableton seems to disable non-realtime mode flag (after an offline render), is in the processBlock callback.

AUs: please find a fix for the missing prepareToPlay call on the develop branch with commit 55a917e.

1 Like

Thanks @fabian.