Changing sample rate in real time

I’m hosting a VST inside a VST Plugin. I need to change sample-rate in real-time so I can oversample the original VST. But somehow my calls to prepareToPlay are not passing to the target VST. Should I be doing something different? Or maybe my VSTs are not prepared to change sample-rate in real-time. What should I do to do that? Right now I just do that in the prepareToPlay call, but maybe it should be somewhere else? In other plugins it seems to be working, so the problem looks to be on my code…

So, resuming. It looks like I’m not doing things right when it comes to changing the sample rate on my plugins.

Cheers, WilliamK

That is not possible. To change the sample rate, you have to call prepareToPlay. This may take any amount of time.
While prepareToPlay is executing, the audio thread must not call processBlock, otherwise you are in undefined behaviour.
The only option you have is to create a second instance with your oversampling and once they are both set up, do a hot swap.

Thank you so much. Yeah, I will just restart the plugin. :slight_smile: