SoundFontInfoLib
2.21.6
Library for parsing and rendering SF2 files
|
Implementation of a low-frequency triangular oscillator. More...
#include <LFO.hpp>
Classes | |
struct | Config |
Configures an LFO via a "fluent" interface. More... | |
struct | State |
Public Member Functions | |
LFO (Float sampleRate, Float frequency, Float delay) | |
Create a new instance. More... | |
void | initialize (Float sampleRate, Float frequency, Float delay) |
Initialize the LFO with the given parameters. More... | |
void | setFrequency (Float frequency) |
Set the frequency of the oscillator. More... | |
void | setDelay (Float delay) |
Set the delay of the oscillator in seconds. More... | |
void | reset () |
Restart from a known zero state. More... | |
State | saveState () const |
Save the state of the oscillator. More... | |
void | restoreState (const State &state) |
Restore the oscillator to a previously-saved state. More... | |
void | increment () |
Increment the oscillator to the next value. More... | |
Float | valueAndIncrement () |
Obtain the next value of the oscillator. More... | |
Float | value () |
Obtain the current value of the oscillator. More... | |
Implementation of a low-frequency triangular oscillator.
By design, this LFO emits bipolar values from -1.0 to 1.0 in order to be useful in SF2 processing. One can obtain unipolar values via the DSP::bipolarToUnipolar method. An LFO will start emitting with value 0.0, again by design, in order to smoothly transition from a paused LFO into a running one.
Create a new instance.
sampleRate | number of samples per second |
frequency | the frequency of the oscillator |
delay | the number of seconds to wait before starting the LFO. |
References initialize().
Referenced by SF2::Render::LFO::Config::make().
|
inline |
Increment the oscillator to the next value.
Referenced by valueAndIncrement().
|
inline |
Restart from a known zero state.
Referenced by initialize(), and setDelay().
|
inline |
Restore the oscillator to a previously-saved state.
state | the state to restore to |
References SF2::Render::LFO::State::counter_, and SF2::Render::LFO::State::delaySampleCount_.
|
inline |
Save the state of the oscillator.
|
inline |
Set the delay of the oscillator in seconds.
NOTE: resets the counter.
delay | the number of seconds to wait before starting the LFO. |
References reset().
|
inline |
Set the frequency of the oscillator.
NOTE: it does not reset the counter.
frequency | the frequency to operate at |
|
inline |
Obtain the current value of the oscillator.
|
inline |
Obtain the next value of the oscillator.
Advances counter before returning, so this is not idempotent.
References increment().
Referenced by SF2::Render::Voice::Voice::render().