Skip to content

Class daisysp::Oscillator

ClassList > daisysp > Oscillator

More...

  • #include <oscillator.h>

Public Types

Type Name
enum Oscillator

Public Functions

Type Name
void Init (float sample_rate)
bool IsEOC ()
bool IsEOR ()
bool IsFalling ()
bool IsRising ()
Oscillator ()
void PhaseAdd (float _phase)
float Process ()
void Reset (float _phase=0.0f)
void SetAmp (const float a)
void SetFreq (const float f)
void SetPw (const float pw)
void SetWaveform (const uint8_t wf)
~Oscillator ()

Detailed Description

Synthesis of several waveforms, including polyBLEP bandlimited waveforms.

Public Types Documentation

enum @

This enum is anonymous

enum {
    WAVE_SIN,
    WAVE_TRI,
    WAVE_SAW,
    WAVE_RAMP,
    WAVE_SQUARE,
    WAVE_POLYBLEP_TRI,
    WAVE_POLYBLEP_SAW,
    WAVE_POLYBLEP_SQUARE,
    WAVE_LAST,
};

Choices for output waveforms, POLYBLEP are appropriately labeled. Others are naive forms.


Public Functions Documentation

function Init

inline void daisysp::Oscillator::Init (
    float sample_rate
) 

Initializes the Oscillator

Parameters:

  • sample_rate - sample rate of the audio engine being run, and the frequency that the Process function will be called.

Defaults: * freq_ = 100 Hz * amp_ = 0.5 * waveform_ = sine wave.


function IsEOC

inline bool daisysp::Oscillator::IsEOC () 

Returns true if cycle is at end of cycle. Set during call to Process.


function IsEOR

inline bool daisysp::Oscillator::IsEOR () 

Returns true if cycle is at end of rise. Set during call to Process.


function IsFalling

inline bool daisysp::Oscillator::IsFalling () 

Returns true if cycle falling.


function IsRising

inline bool daisysp::Oscillator::IsRising () 

Returns true if cycle rising.


function Oscillator

inline daisysp::Oscillator::Oscillator () 

function PhaseAdd

inline void daisysp::Oscillator::PhaseAdd (
    float _phase
) 

Adds a value 0.0-1.0 (equivalent to 0.0-TWO_PI) to the current phase. Useful for PM and "FM" synthesis.


function Process

float daisysp::Oscillator::Process () 

Processes the waveform to be generated, returning one sample. This should be called once per sample period.


function Reset

inline void daisysp::Oscillator::Reset (
    float _phase=0.0f
) 

Resets the phase to the input argument. If no argumeNt is present, it will reset phase to 0.0;


function SetAmp

inline void daisysp::Oscillator::SetAmp (
    const  float a
) 

Sets the amplitude of the waveform.


function SetFreq

inline void daisysp::Oscillator::SetFreq (
    const  float f
) 

Changes the frequency of the Oscillator, and recalculates phase increment.


function SetPw

inline void daisysp::Oscillator::SetPw (
    const  float pw
) 

Sets the pulse width for WAVE_SQUARE and WAVE_POLYBLEP_SQUARE (range 0 - 1)


function SetWaveform

inline void daisysp::Oscillator::SetWaveform (
    const  uint8_t wf
) 

Sets the waveform to be synthesized by the Process() function.


function ~Oscillator

inline daisysp::Oscillator::~Oscillator () 


The documentation for this class was generated from the following file external-docs/DaisySP/Source/Synthesis/oscillator.h