mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-24 01:54:22 +00:00
APVTS: Fix apvts parameter update recursion
This commit is contained in:
parent
120d6cc3ff
commit
d37cee72e8
2 changed files with 15 additions and 4 deletions
|
|
@ -71,7 +71,9 @@ void AudioProcessorValueTreeState::Parameter::valueChanged (float newValue)
|
|||
return;
|
||||
|
||||
lastValue = newValue;
|
||||
sendValueChangedMessageToListeners (newValue);
|
||||
|
||||
if (onValueChanged != nullptr)
|
||||
onValueChanged();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -87,6 +89,9 @@ public:
|
|||
unnormalisedValue (getRange().convertFrom0to1 (parameter.getDefaultValue()))
|
||||
{
|
||||
parameter.addListener (this);
|
||||
|
||||
if (auto* ptr = dynamic_cast<Parameter*> (¶meter))
|
||||
ptr->onValueChanged = [this] { parameterValueChanged ({}, {}); };
|
||||
}
|
||||
|
||||
~ParameterAdapter() override { parameter.removeListener (this); }
|
||||
|
|
|
|||
|
|
@ -362,6 +362,10 @@ public:
|
|||
UndoManager* const undoManager;
|
||||
|
||||
//==============================================================================
|
||||
private:
|
||||
class ParameterAdapter;
|
||||
|
||||
public:
|
||||
/** A parameter class that maintains backwards compatibility with deprecated
|
||||
AudioProcessorValueTreeState functionality.
|
||||
|
||||
|
|
@ -416,9 +420,13 @@ public:
|
|||
private:
|
||||
void valueChanged (float) override;
|
||||
|
||||
std::function<void()> onValueChanged;
|
||||
|
||||
const float unsnappedDefault;
|
||||
const bool metaParameter, automatable, discrete, boolean;
|
||||
float lastValue = 0.0f;
|
||||
float lastValue = -1.0f;
|
||||
|
||||
friend class AudioProcessorValueTreeState::ParameterAdapter;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -523,8 +531,6 @@ private:
|
|||
bool, bool, bool, AudioProcessorParameter::Category, bool));
|
||||
|
||||
//==============================================================================
|
||||
class ParameterAdapter;
|
||||
|
||||
#if JUCE_UNIT_TESTS
|
||||
friend struct ParameterAdapterTests;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue