From 2fc0de42f2bb665bf191402914da26b98d2caa02 Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 2 Nov 2014 11:01:09 +0000 Subject: [PATCH] Made the AU wrapper send notifications about parameter name changes. --- .../AU/juce_AU_Wrapper.mm | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm index 051348d9e3..9e611be58c 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm @@ -647,7 +647,9 @@ public: void audioProcessorChanged (AudioProcessor*) { - PropertyChanged (kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0); + PropertyChanged (kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0); + PropertyChanged (kAudioUnitProperty_ParameterList, kAudioUnitScope_Global, 0); + PropertyChanged (kAudioUnitProperty_ParameterInfo, kAudioUnitScope_Global, 0); } bool StreamFormatWritable (AudioUnitScope, AudioUnitElement) override @@ -664,9 +666,9 @@ public: ComponentResult Initialize() override { #if ! JucePlugin_IsSynth - const int numIns = GetInput(0) != 0 ? (int) GetInput(0)->GetStreamFormat().mChannelsPerFrame : 0; + const int numIns = findNumInputChannels(); #endif - const int numOuts = GetOutput(0) != 0 ? (int) GetOutput(0)->GetStreamFormat().mChannelsPerFrame : 0; + const int numOuts = findNumOutputChannels(); bool isValidChannelConfig = false; @@ -710,19 +712,32 @@ public: return JuceAUBaseClass::Reset (inScope, inElement); } + int findNumInputChannels() + { + #if JucePlugin_IsSynth + if (AUInputElement* e = GetInput(0)) + return (int) e->GetStreamFormat().mChannelsPerFrame; + #endif + + return 0; + } + + int findNumOutputChannels() + { + if (AUOutputElement* e = GetOutput(0)) + return (int) e->GetStreamFormat().mChannelsPerFrame; + + return 0; + } + void prepareToPlay() { if (juceFilter != nullptr) { - juceFilter->setPlayConfigDetails ( - #if ! JucePlugin_IsSynth - (int) GetInput(0)->GetStreamFormat().mChannelsPerFrame, - #else - 0, - #endif - (int) GetOutput(0)->GetStreamFormat().mChannelsPerFrame, - getSampleRate(), - (int) GetMaxFramesPerSlice()); + juceFilter->setPlayConfigDetails (findNumInputChannels(), + findNumOutputChannels(), + getSampleRate(), + (int) GetMaxFramesPerSlice()); bufferSpace.setSize (juceFilter->getNumInputChannels() + juceFilter->getNumOutputChannels(), (int) GetMaxFramesPerSlice() + 32);