mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Standalone plug-in: Fixed a mute button race condition
This commit is contained in:
parent
1003579c5a
commit
22aa9bc682
1 changed files with 8 additions and 5 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue