File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,9 +46,16 @@ AudioProcessorEditor* CAR::createEditor()
4646}
4747
4848
49+ float CAR::getGainLevel ()
50+ {
51+ m_gainLevel.updateTarget ();
52+ return m_gainLevel.getNextValue ();
53+ }
54+
55+
4956void CAR::setGainLevel (float newGain)
5057{
51- m_gainLevel = newGain;
58+ m_gainLevel. setValue ( newGain) ;
5259}
5360
5461
@@ -80,7 +87,8 @@ void CAR::process (AudioSampleBuffer& buffer, MidiBuffer& events)
8087
8188 m_avgBuffer.applyGain (1 .0f / float (numReferenceChannels));
8289
83- const float gain = -1 .0f * m_gainLevel / 100 .f ;
90+ m_gainLevel.updateTarget ();
91+ const float gain = -1 .0f * m_gainLevel.getNextValue () / 100 .f ;
8492
8593 for (int i = 0 ; i < numAffectedChannels; ++i)
8694 {
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ class CAR : public GenericProcessor
7373 void process (AudioSampleBuffer& buffer, MidiBuffer& events) override ;
7474
7575 /* * Returns the current gain level that is set in the processor */
76- float getGainLevel () const { return m_gainLevel; }
76+ float getGainLevel ();
7777
7878 /* * Sets the new gain level that will be used in the processor */
7979 void setGainLevel (float newGain);
@@ -92,7 +92,7 @@ class CAR : public GenericProcessor
9292
9393
9494private:
95- float m_gainLevel;
95+ LinearSmoothedValueAtomic< float > m_gainLevel;
9696
9797 AudioSampleBuffer m_avgBuffer;
9898
You can’t perform that action at this time.
0 commit comments