Oscilloscope 0.5.0
A simple oscilloscope VST
Loading...
Searching...
No Matches
DecayCounter.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 DecayCounter.cpp
5 Created: 23 Mar 2023 8:10:55pm
6 Author: covariant
7
8 ==============================================================================
9*/
10
11#include "DecayCounter.h"
12
13DecayCounter::DecayCounter(int framesPerSecond, float decaySeconds)
14{
15 // save parameters.
16 this->framesPerSecond = framesPerSecond;
17 this->decaySeconds = decaySeconds;
18 this->decayTime = framesPerSecond * decaySeconds;
19 this->maxDecayTime = OSCILLOSCOPE_MAX_DECAY_TIME();
20}
21
23{
24}
25
27{
28 // decrement decayTime and return whether it hit 0
29 if (decayTime-- > 0)
30 {
31 return false;
32 }
33 else
34 {
36 return true;
37 }
38}
39
41{
42 // reset to initial value.
43 decayTime = framesPerSecond * decaySeconds;
44}
45
46void DecayCounter::parameterChanged(const juce::String &parameterID, float newValue)
47{
48 // reset decay time
49 decaySeconds = newValue * maxDecayTime;
51}
DecayCounter(int framesPerSecond, float decaySeconds)
bool refreshNeeded()
void resetDecayTime()
void parameterChanged(const juce::String &parameterID, float newValue) override