Get sampleRate info for standalone and plugin

Hi, I’m writing to ask for a clarification:

My class is inheriting ChangeListener because I want on samplerate-changes to do some stuffs.

on my changeListenerCallback is enough to write for example:

void changeListenerCallback(ChangeBroadcaster* broadcaster) 
{ 
    if (broadcaster == &edit.engine.getDeviceManager().deviceManager) 
    { 
        DBG("Do some stuffs"); 
        DBG(edit.engine.getDeviceManager().deviceManager.getSampleRate()); 
    } 
}

And in my constructor :

edit.engine.getDeviceManager().deviceManager.addChangeListener(this);

I’m a bit confused, HostedAudioDeviceInterface serves only to manage buffers from host but what is sync with samplerate and exc is the device manager of the main engine, correct?

If you’re using a plugin, you probably want to respond to sample rate changes in your prepareToPlay callback. But I’m not sure I fully understand the question.

1 Like

Yes I supposed that, I’d like to know if code I posted in the previous message will work (actually only Graphic app it works) if I’ll use the component I created (that uses those line of code) in a plugin receiving callback when I change sample rate in host. Thank you :pray:t2: