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 752838eaf2..2a0d080a0b 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm @@ -724,6 +724,8 @@ public: ComponentResult RestoreState (CFPropertyListRef inData) override { + const ScopedValueSetter scope { restoringState, true }; + { // Remove the data entry from the state to prevent the superclass loading the parameters CFUniquePtr copyWithoutData (CFDictionaryCreateMutableCopy (nullptr, 0, (CFDictionaryRef) inData)); @@ -1151,6 +1153,9 @@ public: void sendAUEvent (const AudioUnitEventType type, const int juceParamIndex) { + if (restoringState) + return; + auEvent.mEventType = type; auEvent.mArgument.mParameter.mParameterID = getAUParameterIDForIndex (juceParamIndex); AUEventListenerNotify (nullptr, nullptr, &auEvent); @@ -1186,7 +1191,8 @@ public: // this will only ever be called by the bypass parameter void parameterValueChanged (int, float) override { - PropertyChanged (kAudioUnitProperty_BypassEffect, kAudioUnitScope_Global, 0); + if (! restoringState) + PropertyChanged (kAudioUnitProperty_BypassEffect, kAudioUnitScope_Global, 0); } void parameterGestureChanged (int, bool) override {} @@ -1811,7 +1817,7 @@ private: //============================================================================== AudioUnitHelpers::CoreAudioBufferList audioBuffer; MidiBuffer midiEvents, incomingEvents; - bool prepared = false, isBypassed = false; + bool prepared = false, isBypassed = false, restoringState = false; //============================================================================== #if JUCE_FORCE_USE_LEGACY_PARAM_IDS