From ec08dc29a447db98ae19542ed3eb6003a6f1c49e Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 16 Jan 2012 09:57:40 +0000 Subject: [PATCH] AU hosting fix for plugins without UIs. --- .../format_types/juce_AudioUnitPluginFormat.mm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index 77cf3ad63a..cce0ee2558 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -1173,6 +1173,7 @@ public: AudioUnitPluginWindowCarbon (AudioUnitPluginInstance& plugin_) : AudioProcessorEditor (&plugin_), plugin (plugin_), + componentRecord (nullptr), viewComponent (0) { addAndMakeVisible (innerWrapper = new InnerWrapperComponent (*this)); @@ -1181,12 +1182,19 @@ public: setVisible (true); setSize (400, 300); - ComponentDescription viewList [16] = { 0 }; - UInt32 viewListSize = sizeof (viewList); - AudioUnitGetProperty (plugin.audioUnit, kAudioUnitProperty_GetUIComponentList, kAudioUnitScope_Global, - 0, &viewList, &viewListSize); + UInt32 propertySize; + if (AudioUnitGetPropertyInfo (plugin.audioUnit, kAudioUnitProperty_GetUIComponentList, + kAudioUnitScope_Global, 0, &propertySize, NULL) == noErr + && propertySize > 0) + { + ComponentDescription views [propertySize / sizeof (ComponentDescription)]; - componentRecord = FindNextComponent (0, &viewList[0]); + if (AudioUnitGetProperty (plugin.audioUnit, kAudioUnitProperty_GetUIComponentList, + kAudioUnitScope_Global, 0, &views[0], &propertySize) == noErr) + { + componentRecord = FindNextComponent (0, &views[0]); + } + } } ~AudioUnitPluginWindowCarbon()