Switch VST plugin to 192 KHz

Hello, how to switch VST plugin to 192 KHz?
For example project recorded in 44.1 KHz and later switched to 192 KHz for render.
Is it possible to make such switching automatically.

Your question is not very clear. Are you building a host or a plugin?
If your question is about how to convert the sample rate of some audio, you should take a look at ResamplingAudioSource

In any case, if the sample rate of the audio fed into a plugin changes at runtime, prepareToPlay should/will be called again in order to inform the plugin about the sample rate change.

Thank you.
I’m building VST plugin for guitar. And I would using switching to 192
KHz for hi-quality render instead of oversampling.

If the sample rate in the host is changed, the plugin’s prepareToPlay method will called with the new sample rate and you can do whatever changes might be needed in the plugin’s processing. You can’t control that yourself from the plugin, it’s up to the host and the user of the host if the sample rate is changed during offline rendering.

So if I would switch plugin to another sample rate I should simply
reopen project or reload plugin on track after switching DAW to new
sample rate?

You cannot control the host sample rate from the plugin. If the user sets the DAW sample rate to 44.1kHz, then your plugin must output audio at 44.1kHz. you’ll know the sample rate in prepareToPlay

I see, thanks.
But what if plugin would not switch to 192 KHz automatically?

Hi feww,

In-case it isn’t clear what others are telling you, there is nothing you need to do in order to handle someone telling their DAW to render something at any specific rate.

Before processing, the DAW will call prepareToPlay and let the plugin know what rate to process samples. Then, during rendering, the DAW will send samples at that same rate.

So, everything is lined up without any additional effort on the plugin developer’s part.

Good luck!

Unless, there’s some DSP algorithm that needs something special done for different sample rates, but those are not common.

As they said, your plugin must respond to AudioProcessor::prepareToPlay() and it’s your responsibility to handle the sample rate change reported.



Thanks for all, respect.
Switching is working, but not as expect, tester said some spoil in sound on 192 KHz.
Maybe it is because project settings 44.1 and render 192 KHz
or Reaper compatibility.
Anyway 96 KHz sounds good for me.

if your algorithm sounds different on different sampleRates it usually means you have some processor in it that asked for prepareToPlay’s sampleRate argument, but only got a fixed number like “96000”