Browse Source

Standalone plug-in: Fixed a mute button race condition

tags/2021-05-28
Tom Poole 6 years ago
parent
commit
22aa9bc682
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h

+ 8
- 5
modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h View File

@@ -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<bool> muteInput { false };
Value shouldMuteInput;
AudioBuffer<float> 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();


Loading…
Cancel
Save