From 5385102d45d403f264d0cbd60f20e74a48b5e9df Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 6 Apr 2018 16:53:01 +0100 Subject: [PATCH] AU: Modified AudioUnitPluginInstance::hasEditor() to check if iOS AUs have an editor instead of always returning true --- .../juce_AudioUnitPluginFormat.mm | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index 8dbdd6e87a..61943535aa 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -600,7 +600,7 @@ public: } } - // called from the destructer above + // called from the destructor above void cleanup() { #if JUCE_MAC @@ -1132,8 +1132,24 @@ public: } //============================================================================== - AudioProcessorParameter* getBypassParameter() const override { return auSupportsBypass ? bypassParam.get() : nullptr; } - bool hasEditor() const override { return true; } + AudioProcessorParameter* getBypassParameter() const override { return auSupportsBypass ? bypassParam.get() : nullptr; } + + bool hasEditor() const override + { + #if JUCE_MAC + return true; + #elif JUCE_SUPPORTS_AUv3 + UInt32 dataSize; + Boolean isWritable; + + return (AudioUnitGetPropertyInfo (audioUnit, kAudioUnitProperty_RequestViewController, + kAudioUnitScope_Global, 0, &dataSize, &isWritable) == noErr + && dataSize == sizeof (uintptr_t) && isWritable != 0); + #else + return false; + #endif + } + AudioProcessorEditor* createEditor() override; static AudioProcessor::BusesProperties getBusesProperties (AudioComponentInstance comp) @@ -2314,9 +2330,7 @@ private: #if JUCE_SUPPORTS_AUv3 if (AudioUnitGetPropertyInfo (plugin.audioUnit, kAudioUnitProperty_RequestViewController, kAudioUnitScope_Global, 0, &dataSize, &isWritable) == noErr - && dataSize == sizeof (ViewControllerCallbackBlock) - && AudioUnitGetPropertyInfo (plugin.audioUnit, kAudioUnitProperty_RequestViewController, kAudioUnitScope_Global, - 0, &dataSize, &isWritable) == noErr) + && dataSize == sizeof (ViewControllerCallbackBlock)) { waitingForViewCallback = true; ViewControllerCallbackBlock callback; @@ -2752,11 +2766,11 @@ StringArray AudioUnitPluginFormat::searchPathsForPlugins (const FileSearchPath&, { ignoreUnused (allowPluginsWhichRequireAsynchronousInstantiation); - #if JUCE_SUPPORTS_AUv3 + #if JUCE_SUPPORTS_AUv3 bool isAUv3 = ((desc.componentFlags & kAudioComponentFlag_IsV3AudioUnit) != 0); if (allowPluginsWhichRequireAsynchronousInstantiation || ! isAUv3) - #endif + #endif result.add (AudioUnitFormatHelpers::createPluginIdentifier (desc)); } }