diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h index 9c73eca293..5be084f112 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h @@ -42,7 +42,8 @@ namespace juce @tags{Audio} */ class StandalonePluginHolder : private AudioIODeviceCallback, - private Timer + private Timer, + private Value::Listener { public: //============================================================================== @@ -78,9 +79,11 @@ public: : settings (settingsToUse, takeOwnershipOfSettings), channelConfiguration (channels), - shouldMuteInput (! isInterAppAudioConnected()), autoOpenMidiDevices (shouldAutoOpenMidiDevices) { + shouldMuteInput.addListener (this); + shouldMuteInput = ! isInterAppAudioConnected(); + createPlugin(); auto inChannels = (channelConfiguration.size() > 0 ? channelConfiguration[0].numIns @@ -158,6 +161,7 @@ public: //============================================================================== Value& getMuteInputValue() { return shouldMuteInput; } bool getProcessorHasPotentialFeedbackLoop() const { return processorHasPotentialFeedbackLoop; } + void valueChanged (Value& value) override { muteInput = (bool) value.getValue(); } //============================================================================== File getLastFile() const @@ -406,6 +410,7 @@ public: // avoid feedback loop by default bool processorHasPotentialFeedbackLoop = true; + std::atomic muteInput { false }; Value shouldMuteInput; AudioBuffer emptyBuffer; bool autoOpenMidiDevices; @@ -492,9 +497,7 @@ private: int numOutputChannels, int numSamples) override { - const bool inputMuted = shouldMuteInput.getValue(); - - if (inputMuted) + if (muteInput) { emptyBuffer.clear(); inputChannelData = emptyBuffer.getArrayOfReadPointers();