Skip to content
Snippets Groups Projects
Commit 43bbeed5 authored by Septen's avatar Septen
Browse files

CAR: implemented race-condition free behaviour for gain parameter.

parent 7b9078ef
No related branches found
No related tags found
No related merge requests found
......@@ -46,9 +46,16 @@ AudioProcessorEditor* CAR::createEditor()
}
float CAR::getGainLevel()
{
m_gainLevel.updateTarget();
return m_gainLevel.getNextValue();
}
void CAR::setGainLevel (float newGain)
{
m_gainLevel = newGain;
m_gainLevel.setValue (newGain);
}
......@@ -80,7 +87,8 @@ void CAR::process (AudioSampleBuffer& buffer, MidiBuffer& events)
m_avgBuffer.applyGain (1.0f / float (numReferenceChannels));
const float gain = -1.0f * m_gainLevel / 100.f;
m_gainLevel.updateTarget();
const float gain = -1.0f * m_gainLevel.getNextValue() / 100.f;
for (int i = 0; i < numAffectedChannels; ++i)
{
......
......@@ -73,7 +73,7 @@ public:
void process (AudioSampleBuffer& buffer, MidiBuffer& events) override;
/** Returns the current gain level that is set in the processor */
float getGainLevel() const { return m_gainLevel; }
float getGainLevel();
/** Sets the new gain level that will be used in the processor */
void setGainLevel (float newGain);
......@@ -92,7 +92,7 @@ public:
private:
float m_gainLevel;
LinearSmoothedValueAtomic<float> m_gainLevel;
AudioSampleBuffer m_avgBuffer;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment