DISTRHO / DPF

DISTRHO Plugin Framework
ISC License
672 stars 97 forks source link

Clap: wrong Sample Rate on init #446

Closed brummer10 closed 10 months ago

brummer10 commented 10 months ago

Could it be that the DPF Clap wrapper init plugins with the wrong Sample Rate? I got a report for the StompTuner Clap format only working correct at 44100Hz. That doesn't affect vst2/3 format. https://github.com/brummer10/StompTuner/issues/3

falkTX commented 10 months ago

yes, not all plugin formats allow to know the correct sample rate when the plugin is created, the sampleRateChanged callback is used to indicate that the sample rate is not the same as when first initiated.

this is all normal and expected, not a bug. if that callback is missing that would be a bug, but dont think it is..?

falkTX commented 10 months ago

yeah looking at your code the sample rate changes are still TODO, and that would explain the issue.

as per docs in DPF, that callback is only triggered when the plugin is deactivated. so you can safely do reallocations in there.

brummer10 commented 10 months ago

Okay, Didn't know that. I'll correct that then.

falkTX commented 10 months ago

it is the same on VST3 by the way, the proper sample rate is only known on the "audio setup" section. DPF just has a value as fallback, if it matches the final sample rate then all is good, otherwise it needs a sample rate change. so you cant be sure if it is called or not, best to handle sample rate changes in full.