Login / Register  0 items | $0.00 New#KVRDeals
Wild Hades
KVRist
 
161 posts since 6 Sep, 2007

Postby Wild Hades; Mon Dec 04, 2017 3:08 pm VST 2.4 Specs: setBlockSize always called before processing?

Hello,

kinda stupid question, but I couldn't figure it out from the VST 2.4 "specs" (or better, code comments...):

am I wrong supposing that setBlockSize(int) must be called at least once by the host, before calling processReplacing/processDoubleReplacing for the first time?

All the hosts I've tried so far are doing this, but I'm wondering if this is stated somewhere in the VST 2.4 code/specs.
I usually perform memory allocations on the setBlockSize method, so it would really suck if I'd need to call it explicitly from the audio thread if the host has never called it before (plus, I hate to put "ifs" in the audio processing routine).

Thanks in advance,
Federico
camsr
KVRAF
 
6720 posts since 16 Feb, 2005

Postby camsr; Mon Dec 04, 2017 9:34 pm Re: VST 2.4 Specs: setBlockSize always called before processing?

Here's the comment from the sdk:
///< Called when the Maximum block size changes (always in a suspend state). Note that the sampleFrames in Process Calls could be smaller than this block size, but NOT bigger.

I suppose the confusion comes from "always in a suspend state".

I have previously used the plugin Open() to do allocations with success. You can call getBlockSize() there and it should almost always return a valid size. (At least it did in FL studio). You can always allocate more than you'll ever need, it's not likely to cause any performance issue.
Image
mystran
KVRAF
 
4611 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Fri Dec 08, 2017 7:11 am Re: VST 2.4 Specs: setBlockSize always called before processing?

Wild Hades wrote:I usually perform memory allocations on the setBlockSize method, so it would really suck if I'd need to call it explicitly from the audio thread if the host has never called it before (plus, I hate to put "ifs" in the audio processing routine).


You can safely assume setBlockSize and setSampleRate get called at least once before the first resume(), which is always called before the first processXXX calls.
Image <- plugins | forum
Wild Hades
KVRist
 
161 posts since 6 Sep, 2007

Postby Wild Hades; Sat Dec 09, 2017 7:12 am Re: VST 2.4 Specs: setBlockSize always called before processing?

mystran wrote:You can safely assume setBlockSize and setSampleRate get called at least once before the first resume(), which is always called before the first processXXX calls.

That's nice to know! Thanks!

Moderator: Moderators (Main)

Return to DSP and Plug-in Development