From 5d328f20387bba9ce7e3c8c0477b899176267b85 Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 21 Jul 2022 12:31:25 +0100 Subject: [PATCH] AU Host: Tidy and refactor --- .../juce_AudioUnitPluginFormat.mm | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index e5d40290fc..693853c86d 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -1137,24 +1137,20 @@ public: return false; // did anything actually change - if (layoutHasChanged) - { - bool success = (AudioUnitInitialize (audioUnit) == noErr); + if (! layoutHasChanged) + return true; - // Some plug-ins require the LayoutTag to be set after initialization - if (success) - success = syncBusLayouts (layouts, true, layoutHasChanged); + // Some plug-ins require the LayoutTag to be set after initialization + const auto success = (AudioUnitInitialize (audioUnit) == noErr) + && syncBusLayouts (layouts, true, layoutHasChanged); - AudioUnitUninitialize (audioUnit); + AudioUnitUninitialize (audioUnit); - if (! success) - // make sure that the layout is back to it's original state - syncBusLayouts (getBusesLayout(), false, layoutHasChanged); + if (! success) + // make sure that the layout is back to its original state + syncBusLayouts (getBusesLayout(), false, layoutHasChanged); - return success; - } - - return true; + return success; } //==============================================================================