Dynamic notification for sample rate change in externals ?

sletz's icon

Our external C++ object would need to react when the user change the sample rate in the audio setup. Is there a way to get notified when sample rate changes?

Peter Castine's icon

If the sample rate is changed you'll get a new dsp message. The sample rate is in each of the DSP vectors (second parameter to your dsp() method).

sletz's icon

Do you mean a *single* samplerate notification is received in this case? Or do I need to check the samplerate value at each audio cycle?

Emmanuel Jourdan's icon

The sample rate won't change in the middle of the perform method. When the sample rate changes the dsp message is sent to every objects (so you can cache that in your object structure, do some calculation... and defines what perform method you'd like to add).

sletz's icon

Problem solved thanks.