Dodgy Hack in VSTPluginInstance::prepareToPlay()


#1

Does anyone have any idea regarding the origin of this "dodgy hack" or an example case of where it's needed to initialize sampling rate?

https://github.com/julianstorer/JUCE/blob/master/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp#L960

This caused an issue with a VST I was working with. I tweaked the VST to circumvent the problem but now I'm curious. It seems like there'd be a way to force sample rate without tweaking parameters, but without a test case where things aren't initialized properly I can't investigate further.


#2

It's many years old, and too far back in time to remember exactly which plugins were at fault.. TBH I'd be fairly comfortable in removing it, as it's pretty hacky. But on the other hand, your plugin code should be able to cope with things like this, because you can't expect all hosts to never do anything unexpected!