I am a newby in VST and have started my first project starting from the delay example provided in the SDK. After the actual build the validator runs some tests which typically pass.
Unfortunately, the algorithm which I will implement involves FFT processing and runs at a specific samplerate. My question: is a variable buffersize and to cope with all samplerates a must to be accepted by the validator or may I somehow signalize that I support only 48 kHz and constant buffersizes? I report a kResultFalse on a samplerate other than 48 kHz which makes the validator return “test not passed”.
Thank you and best regards
If you implement a FFT the best way is to use a ringBuffer to buffer the incoming audio, your algo will consume the audio it needs from this ringBuffer, when there is enough audio required for the FFT.
In case of a FFT with 512 samples your plugin should report a latency of 512 samples to the host.
When it starts to process and if the block are smaller than 512, you have to fill your ringbuffer and return silence in outputbuffer.
As soon as you have enough sample (512) you could process your FFT algo and copy this result to your output ringbuffer. Then copy from this output ringBuffer to the plugin output
About samplerate you could use some on-the-fly samplerate converter if you could not adapt your algo to a given samplerate.
thank you for the response.
Yes, I could re-buffer. However, I would like to avoid that: if a short buffersize (e.g. 64) is used and I have to buffer 512 samples, the processing of 512 samples will be required to be realized in the time to obtain 64 samples. Hence, of 8 frames the processing of 7 frames happens in a short time period whereas the 8th will take much longer. In that case, I could move processing into another thread but than we need to synchronize threads - which may be suboptimal for real-time processing with low latency: I guess the host will take the additional delay into account and add to all other channels.
Does it happen that input and output buffersizes do NOT match? In that case we may suffer from an input/output drift…
I had the hope that the host inserts the samplerate conversion itself if it finds out that a specific samplerate is not supported by the processor. However, I understand that it is my task to comply with the samplerate adaption.
No not with the process call, input and output buffers have to have the same size (samples).
Perfect, thank you. Now I can work on my fallback strategies
Have a nice weekend!