Getting the samplerate before process()

  1. Is there a way to know the current samplerate when a module is created (before the first process() call)?

  2. When the samplerate is changed do the modules recieve any “signal/callback” ? Or the only way to know that it has changed is during process() ?

Motivation: I would like to write some general routines/objects that are initialized with the samplerate, and then assume it constant during the normal processing (i.e. like most real hardware modules do).

Thanks in advance!

void onSampleRateChange() override

This should be the code you are looking for…

Thanks! Is onSampleRateChange() also called before the first process() ?

Is the samplerate also available on the module creation method ? (where the configParam/configInput/configOutput are placed )

I believe you can access APP->engine->getSampleRate from your constructor

2 Likes

Yes, it works! Thanks