:)
Loading...
Searching...
No Matches
RustyLFO Class Reference

LFO class to perform modulation on RustyProcessor Parameters. More...

#include <RustyLFO.hpp>

Inheritance diagram for RustyLFO:
RustyModulator

Public Member Functions

 RustyLFO (double frequency, double minValue, double maxValue)
 Constructor for RustyLFO.
 
double getCurrentValue () override
 Returns a modulator value for use on a RustyProcessor.
 
void updateState () override
 Update modulator state and iterate forward a step.
 
void setParameter (std::string parameter, std::string value) override
 Sets RustyModulator parameter to new value.
 
std::string getModulatorType () override
 Function to get modulator type.
 
std::string getParams () override
 Function to get modulator params.
 
- Public Member Functions inherited from RustyModulator
virtual double getCurrentValue ()=0
 Returns a modulator value for use on a RustyProcessor.
 
virtual void updateState ()=0
 Update modulator state and iterate forward a step.
 
virtual void setParameter (std::string parameter, std::string value)=0
 Sets RustyModulator parameter to new value.
 
void addReference ()
 Tells RustyModulator that a RustyProcessor has been attached.
 
void removeReference ()
 Tells RustyModulator that a RustyProcessor has been removed.
 
void usedByProcessor ()
 Called after every modulator read.
 
bool isNumeric (const std::string &str)
 Function to test if value contains numeric characters.
 
virtual std::string getModulatorType ()=0
 Function to get modulator type.
 
virtual std::string getParams ()=0
 Function to get modulator params.
 

Private Member Functions

double oscillate ()
 Calculates LFO position.
 

Private Attributes

double _value
 Oscillator value after being bound to range.
 
double _phase
 Phase position used to update LFO.
 
double _frequency
 Frequency of Oscillator in ms.
 
double _minValue
 Minimum value of LFO range.
 
double _maxValue
 Maximum value of LFO range.
 
double _sampleRate
 Sample rate to calculate LFO positions against.
 

Additional Inherited Members

- Protected Attributes inherited from RustyModulator
int _refCount = 0
 Count of RustyProcessors that modulator is attached to.
 
int _useCount = 0
 Count of RustyProcessors usage at that moment in time.
 

Detailed Description

LFO class to perform modulation on RustyProcessor Parameters.

Simple LFO class designed to allow user to manipulate parameters on processing units.

Inherited from RustyModulator

Definition at line 21 of file RustyLFO.hpp.

Constructor & Destructor Documentation

◆ RustyLFO()

RustyLFO::RustyLFO ( double  frequency,
double  minValue,
double  maxValue 
)

Constructor for RustyLFO.


Takes initial parameters for RustyLFO and preps the object for processing.

Parameters
frequencyFloat of LFO frequency
minValueFloat of LFO minimum range
maxValueFloat of LFO maximum range

Definition at line 3 of file RustyLFO.cpp.

Member Function Documentation

◆ getCurrentValue()

double RustyLFO::getCurrentValue ( )
overridevirtual

Returns a modulator value for use on a RustyProcessor.


This pure virtual function will get the state of the modulator at that moment in time. Ie. LFO position.

Returns
Double corresponding to a modulator position.

Implements RustyModulator.

Definition at line 9 of file RustyLFO.cpp.

◆ updateState()

void RustyLFO::updateState ( )
overridevirtual

Update modulator state and iterate forward a step.


This function iterates the modulator. This isn't called directly by any RustyProcessor but is instead called from within the RustyModulator when it has been informed that all attached processors have used the modulator.

See also
usedByProcessor()

Implements RustyModulator.

Definition at line 16 of file RustyLFO.cpp.

◆ setParameter()

void RustyLFO::setParameter ( std::string  parameter,
std::string  value 
)
overridevirtual

Sets RustyModulator parameter to new value.


This is pure virtual function that assigns a new value to a parameter of RustyModulator derived units. This function is used at runtime from CLI interaction.

Parameters
parameterString of the parameter to affect.
modulatorPointer to instance of RustyModulator.

Implements RustyModulator.

Definition at line 22 of file RustyLFO.cpp.

◆ getModulatorType()

std::string RustyLFO::getModulatorType ( )
overridevirtual

Function to get modulator type.


Simple function allows CLI to test modulator types for user interaction.

Returns
Returns string of RustyModulator child type.

Implements RustyModulator.

Definition at line 67 of file RustyLFO.cpp.

◆ getParams()

std::string RustyLFO::getParams ( )
overridevirtual

Function to get modulator params.


Simple function allows CLI to get available params for RustyModulator child.

Returns
Returns string of parameters available for RustyModulator child.

Implements RustyModulator.

Definition at line 72 of file RustyLFO.cpp.

◆ oscillate()

double RustyLFO::oscillate ( )
private

Calculates LFO position.


Uses phase calculated across the sample rate to calculate LFO's sine wave position.

See also
getCurrentValue()

Definition at line 60 of file RustyLFO.cpp.

Member Data Documentation

◆ _value

double RustyLFO::_value
private

Oscillator value after being bound to range.

Definition at line 45 of file RustyLFO.hpp.

◆ _phase

double RustyLFO::_phase
private

Phase position used to update LFO.

Definition at line 46 of file RustyLFO.hpp.

◆ _frequency

double RustyLFO::_frequency
private

Frequency of Oscillator in ms.

Definition at line 47 of file RustyLFO.hpp.

◆ _minValue

double RustyLFO::_minValue
private

Minimum value of LFO range.

Definition at line 48 of file RustyLFO.hpp.

◆ _maxValue

double RustyLFO::_maxValue
private

Maximum value of LFO range.

Definition at line 49 of file RustyLFO.hpp.

◆ _sampleRate

double RustyLFO::_sampleRate
private

Sample rate to calculate LFO positions against.

Definition at line 50 of file RustyLFO.hpp.


The documentation for this class was generated from the following files: