diff options
author | falkTX <falktx@gmail.com> | 2019-01-31 12:18:52 +0000 |
---|---|---|
committer | falkTX <falktx@gmail.com> | 2019-01-31 12:18:52 +0000 |
commit | 2356d75f391b5d761b4463feb6c3a710b5f0dbd3 (patch) | |
tree | 5d58ab44eeb4fca29a90c0e1b20101501f50d7d9 | |
parent | b2ad7a09ec2ad5c30c3edf6fe9e91fca72433e55 (diff) |
AU: Implement dynamic buffer size and sample rate
-rw-r--r-- | distrho/src/DistrhoPluginAU.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/distrho/src/DistrhoPluginAU.cpp b/distrho/src/DistrhoPluginAU.cpp index 9986c3af..85bb1378 100644 --- a/distrho/src/DistrhoPluginAU.cpp +++ b/distrho/src/DistrhoPluginAU.cpp @@ -221,8 +221,6 @@ protected: for (uint32_t i = 0; i < DISTRHO_PLUGIN_NUM_OUTPUTS; ++i) destBuffer[i] = (float *)outBuffer.mBuffers[i].mData; - updateSampleRate(); - updateParameterInputs(); fPlugin.run(srcBuffer, destBuffer, inFramesToProcess); @@ -243,8 +241,7 @@ protected: if ((err = AUEffectBase::Initialize()) != noErr) return err; - updateSampleRate(); - + fPlugin.setSampleRate(GetSampleRate()); fPlugin.activate(); return noErr; @@ -256,6 +253,8 @@ protected: AUEffectBase::Cleanup(); } + // ------------------------------------------------------------------- + UInt32 SupportedNumChannels(const AUChannelInfo** outInfo) override { static const AUChannelInfo sChannels[1] = {{ DISTRHO_PLUGIN_NUM_INPUTS, DISTRHO_PLUGIN_NUM_OUTPUTS }}; @@ -266,6 +265,12 @@ protected: return 1; } + void SetMaxFramesPerSlice(UInt32 nFrames) override + { + fPlugin.setBufferSize(nFrames, true); + AUEffectBase::SetMaxFramesPerSlice(nFrames); + } + // ------------------------------------------------------------------- private: @@ -320,11 +325,6 @@ private: } } - void updateSampleRate() - { - d_lastSampleRate = GetSampleRate(); - } - DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginAU) }; |