Oversampling buffer and nSampleFrames

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

I read in the VST/VST3 format info somewhere that “nSampleFrames” that a host sends a plugin can literally be of any size and can even vary from call-to-call.

I also understand that creating heap memory inside an audio thread is problematic.

So if you need a buffer for oversampling - but nSampleFrames is variable - and dynamic arrays inside audio threads are problematic - how is it done? What is the approach typically used for setting up oversample I/O buffer arrays?

Post

setBlockSize tells you the max buffersize that your process function is called with. So you can allocate a buffer for the max size and only use parts of it as needed.

Besides that you can basically buffer audio data yourself to any size that you want. You only need to report it as latency to the host.

Post

BlueprintInc wrote: Thu Jan 23, 2020 2:34 am setBlockSize tells you the max buffersize that your process function is called with. So you can allocate a buffer for the max size and only use parts of it as needed.
Yes, I thought about this after I hit “send”. The oversample I/o buffer arrays do not need to match nSampleFrames. They could, actually, be only as large as needed for the low pass FIR.

Post Reply

Return to “DSP and Plugin Development”