# Get sampleRate info for standalone and plugin

**URL:** <https://forum.juce.com/t/get-samplerate-info-for-standalone-and-plugin/49515>\
**Category:** Tracktion Engine\
**Created:** [January 4, 2022, 5:43pm UTC](https://forum.juce.com/t/get-samplerate-info-for-standalone-and-plugin/49515 "2022-01-04T17:43:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ayra](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ayra/32/5775_2.png) [@Ayra](https://forum.juce.com/u/Ayra)\
**Post date:** [January 4, 2022, 5:43pm UTC](https://forum.juce.com/t/get-samplerate-info-for-standalone-and-plugin/49515/1 "2022-01-04T17:43:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dave96](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/dave96/32/8487_2.png) [@dave96](https://forum.juce.com/u/dave96)\
**Post date:** [January 4, 2022, 6:04pm UTC](https://forum.juce.com/t/get-samplerate-info-for-standalone-and-plugin/49515/2 "2022-01-04T18:04:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ayra](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ayra/32/5775_2.png) [@Ayra](https://forum.juce.com/u/Ayra)\
**Post date:** [January 5, 2022, 2:14am UTC](https://forum.juce.com/t/get-samplerate-info-for-standalone-and-plugin/49515/3 "2022-01-05T02:14:11Z")

</div>

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 🙏🏻
