In my VST audio Plugin, I allow users to select which output audio device to use for outputting audio. The first and default option, is to use Host audio.
So users have two options:
1- Use host audio and let DAW handle the audio (calls to processBlock)
2- Use one of the output devices (calls to audioDeviceIOCallback)
in either of these functions I have some if/else conditions that returns from them if they are not required at that moment, e.g if host audio is not selected processBlock will set the output buffers that is passed to it to zero and returns.
Now here comes my issue:
My default output device on macOS has a IO buffer size of 512. If my DAW’s (Logic Pro for example) buffer size is also set to 512 everything is ok. If it differs then this is what happens:
when the Plugin starts, audio output is set to host audio and audio comes out right. Then user changes to default output device, again everything ok. Then user changes back to using host audio, now the audio that comes out is wrong.
By wrong I mean, if for example host’s buffer size is 1024 then the audio plays back pretty fast. Is DAW’s buffer size is 128 then audio plays really slow.
So it seems using system audio directly and then switching back to using host audio somehow affects the way DAWs interpret the audio.
I am already taking care of the cases where Host’s sample rate and audio’s sample rate are different using LagrangeInterpolator. Should I take special care for different IO buffer sizes?
Sorry if the explanation got too complicated.