Advertisement
ErnstHot

Sample rate test

Jun 3rd, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. struct SRateTest : Module
  2. {
  3.     float srate;
  4.  
  5.     SRateTest() : Module(0, 0, 1, 0), srate(0)  { srate = engineGetSampleRate(); }
  6.  
  7.     void onSampleRateChange() override          { srate = engineGetSampleRate(); }
  8.     void onCreate() override                    { srate = engineGetSampleRate(); }
  9.  
  10.     void step() override                        { outputs[0].value = srate > 0.0f ? 1.0f : 0.0f; }
  11. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement