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?
Oversampling buffer and nSampleFrames
-
- KVRist
- 135 posts since 9 Apr, 2017
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.
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.
-
- KVRian
- Topic Starter
- 626 posts since 30 Aug, 2012
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.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.