From 2356d75f391b5d761b4463feb6c3a710b5f0dbd3 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 31 Jan 2019 12:18:52 +0000 Subject: AU: Implement dynamic buffer size and sample rate --- distrho/src/DistrhoPluginAU.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'distrho/src/DistrhoPluginAU.cpp') 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) }; -- cgit v1.2.3