DaisySP
|
#include <oscillator.h>
Public Types | |
enum | { WAVE_SIN , WAVE_TRI , WAVE_SAW , WAVE_RAMP , WAVE_SQUARE , WAVE_POLYBLEP_TRI , WAVE_POLYBLEP_SAW , WAVE_POLYBLEP_SQUARE , WAVE_LAST } |
Public Member Functions | |
void | Init (float sample_rate) |
void | SetFreq (const float f) |
void | SetAmp (const float a) |
void | SetWaveform (const uint8_t wf) |
void | SetPw (const float pw) |
bool | IsEOR () |
bool | IsEOC () |
bool | IsRising () |
bool | IsFalling () |
float | Process () |
void | PhaseAdd (float _phase) |
void | Reset (float _phase=0.0f) |
Synthesis of several waveforms, including polyBLEP bandlimited waveforms.
Choices for output waveforms, POLYBLEP are appropriately labeled. Others are naive forms.
Initializes the Oscillator
sample_rate | - sample rate of the audio engine being run, and the frequency that the Process function will be called. |
Defaults:
|
inline |
Returns true if cycle is at end of cycle. Set during call to Process.
|
inline |
Returns true if cycle is at end of rise. Set during call to Process.
|
inline |
Returns true if cycle falling.
|
inline |
Returns true if cycle rising.
Adds a value 0.0-1.0 (equivalent to 0.0-TWO_PI) to the current phase. Useful for PM and "FM" synthesis.
float Oscillator::Process | ( | ) |
Processes the waveform to be generated, returning one sample. This should be called once per sample period.
Resets the phase to the input argument. If no argumeNt is present, it will reset phase to 0.0;
Changes the frequency of the Oscillator, and recalculates phase increment.
Sets the pulse width for WAVE_SQUARE and WAVE_POLYBLEP_SQUARE (range 0 - 1)
Sets the waveform to be synthesized by the Process() function.