DaisySP
Loading...
Searching...
No Matches
daisysp::Oscillator Class Reference

#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)
 

Detailed Description

Synthesis of several waveforms, including polyBLEP bandlimited waveforms.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

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

Member Function Documentation

◆ Init()

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

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.

◆ IsEOC()

bool daisysp::Oscillator::IsEOC ( )
inline

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

◆ IsEOR()

bool daisysp::Oscillator::IsEOR ( )
inline

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

◆ IsFalling()

bool daisysp::Oscillator::IsFalling ( )
inline

Returns true if cycle falling.

◆ IsRising()

bool daisysp::Oscillator::IsRising ( )
inline

Returns true if cycle rising.

◆ PhaseAdd()

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

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

◆ Process()

float Oscillator::Process ( )

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

◆ Reset()

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

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

◆ SetAmp()

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

Sets the amplitude of the waveform.

◆ SetFreq()

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

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

◆ SetPw()

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

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

◆ SetWaveform()

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

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


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