iPlug2 Forum

Getting GetSamplerate() from IControl?

Is there any way to get GetSamplerate() function from IPlugProcessor inside IControl without manually sending data between audio and GUI thread?

TestControl.h …

#pragma once

#include "IControl.h"
#include "IPlugProcessor.h"

using namespace iplug;
using namespace igraphics;

class TestControl : public IControl {
public:
  TestControl(const IRECT& bounds) : IControl(bounds) {}
  
  void Draw(IGraphics& g)
  {
    WDL_String str;
    str.SetFormatted(32, "%f", dynamic_cast<IPlugProcessor*>(GetDelegate())->GetSampleRate());
    g.DrawText(IText(36), str.Get(), mRECT);
  }
};
1 Like

Awesome, thanks a lot!