OpenWareLaboratory
PolyBlepOscillator Class Reference
Inheritance diagram for PolyBlepOscillator:
Collaboration diagram for PolyBlepOscillator:

Public Member Functions

float generate ()
 Produce the next consecutive sample. More...
 
float generate (float fm)
 Produce a sample with frequency modulation. More...
 
void generate (FloatArray output)
 Produce a block of samples. More...
 
void generate (FloatArray output, FloatArray fm)
 Produce a block of samples with frequency modulation. More...
 
float getFrequency ()
 Get oscillator frequency in Hertz. More...
 
float getNextSample ()
 
float getNextSample (float fm)
 
float getPhase ()
 Get current oscillator phase in radians. More...
 
float getPulseWidth ()
 
float getSampleRate ()
 
void getSamples (FloatArray output)
 
void getSamples (FloatArray output, FloatArray freq)
 
float getShape ()
 
 PolyBlepOscillator (float freq, float sr)
 
 PolyBlepOscillator (float sr=48000)
 
void reset ()
 Reset oscillator (typically resets phase) More...
 
void setFrequency (float freq)
 Set oscillator frequency in Hertz. More...
 
void setPhase (float phase)
 Set current oscillator phase in radians. More...
 
void setPulseWidth (float value)
 set square wave pulse width: 0.0 to 1.0 for 0% to 100% More...
 
void setSampleRate (float sr)
 Set oscillator sample rate. More...
 
void setShape (float value)
 set waveform shape: 0.0 for saw, 1.0 for square wave More...
 

Static Public Member Functions

static PolyBlepOscillatorcreate (float freq, float sr)
 
static PolyBlepOscillatorcreate (float sr)
 
static void destroy (PolyBlepOscillator *osc)
 

Detailed Description

Definition at line 8 of file PolyBlepOscillator.h.

Constructor & Destructor Documentation

◆ PolyBlepOscillator() [1/2]

PolyBlepOscillator::PolyBlepOscillator ( float  sr = 48000)

Definition at line 4 of file PolyBlepOscillator.cpp.

Referenced by create().

◆ PolyBlepOscillator() [2/2]

PolyBlepOscillator::PolyBlepOscillator ( float  freq,
float  sr 
)

Definition at line 12 of file PolyBlepOscillator.cpp.

References setFrequency().

Member Function Documentation

◆ create() [1/2]

PolyBlepOscillator * PolyBlepOscillator::create ( float  freq,
float  sr 
)
static

Definition at line 92 of file PolyBlepOscillator.cpp.

References PolyBlepOscillator().

◆ create() [2/2]

PolyBlepOscillator * PolyBlepOscillator::create ( float  sr)
static

Definition at line 88 of file PolyBlepOscillator.cpp.

References PolyBlepOscillator().

◆ destroy()

void PolyBlepOscillator::destroy ( PolyBlepOscillator osc)
static

Definition at line 96 of file PolyBlepOscillator.cpp.

◆ generate() [1/4]

float PolyBlepOscillator::generate ( )
virtual

Produce the next consecutive sample.

Reimplemented from SignalGenerator.

Definition at line 60 of file PolyBlepOscillator.cpp.

◆ generate() [2/4]

float PolyBlepOscillator::generate ( float  fm)
virtual

Produce a sample with frequency modulation.

Implements Oscillator.

Definition at line 66 of file PolyBlepOscillator.cpp.

◆ generate() [3/4]

void PolyBlepOscillator::generate ( FloatArray  output)
virtual

Produce a block of samples.

Reimplemented from SignalGenerator.

Definition at line 72 of file PolyBlepOscillator.cpp.

References SimpleArray< T >::getSize().

◆ generate() [4/4]

void PolyBlepOscillator::generate ( FloatArray  output,
FloatArray  fm 
)
virtual

Produce a block of samples with frequency modulation.

Reimplemented from Oscillator.

Definition at line 76 of file PolyBlepOscillator.cpp.

References FloatArray::add(), SimpleArray< T >::copyFrom(), SimpleArray< T >::getSize(), and FloatArray::multiply().

◆ getFrequency()

float PolyBlepOscillator::getFrequency ( )
virtual

Get oscillator frequency in Hertz.

Implements Oscillator.

Definition at line 32 of file PolyBlepOscillator.cpp.

◆ getNextSample() [1/2]

float Oscillator::getNextSample ( )
inlineinherited

Definition at line 55 of file Oscillator.h.

References Oscillator::generate().

◆ getNextSample() [2/2]

float Oscillator::getNextSample ( float  fm)
inlineinherited

Definition at line 57 of file Oscillator.h.

References Oscillator::generate().

◆ getPhase()

float PolyBlepOscillator::getPhase ( )
virtual

Get current oscillator phase in radians.

Returns
a value between 0 and 2*pi

Implements Oscillator.

Definition at line 52 of file PolyBlepOscillator.cpp.

References M_PI.

◆ getPulseWidth()

float PolyBlepOscillator::getPulseWidth ( )

Definition at line 48 of file PolyBlepOscillator.cpp.

◆ getSampleRate()

float PolyBlepOscillator::getSampleRate ( )

Definition at line 24 of file PolyBlepOscillator.cpp.

◆ getSamples() [1/2]

void Oscillator::getSamples ( FloatArray  output)
inlineinherited

Definition at line 59 of file Oscillator.h.

References Oscillator::generate().

◆ getSamples() [2/2]

void PolyBlepOscillator::getSamples ( FloatArray  output,
FloatArray  freq 
)

Definition at line 83 of file PolyBlepOscillator.cpp.

References SimpleArray< T >::getSize(), and FloatArray::multiply().

◆ getShape()

float PolyBlepOscillator::getShape ( )

Definition at line 40 of file PolyBlepOscillator.cpp.

◆ reset()

void PolyBlepOscillator::reset ( )
inlinevirtual

Reset oscillator (typically resets phase)

Implements Oscillator.

Definition at line 28 of file PolyBlepOscillator.h.

References setPhase().

◆ setFrequency()

void PolyBlepOscillator::setFrequency ( float  value)
virtual

Set oscillator frequency in Hertz.

Implements Oscillator.

Definition at line 28 of file PolyBlepOscillator.cpp.

Referenced by PolyBlepOscillator().

◆ setPhase()

void PolyBlepOscillator::setPhase ( float  phase)
virtual

Set current oscillator phase in radians.

Parameters
phasea value between 0 and 2*pi

Implements Oscillator.

Definition at line 56 of file PolyBlepOscillator.cpp.

References M_PI.

Referenced by reset().

◆ setPulseWidth()

void PolyBlepOscillator::setPulseWidth ( float  value)

set square wave pulse width: 0.0 to 1.0 for 0% to 100%

Definition at line 44 of file PolyBlepOscillator.cpp.

◆ setSampleRate()

void PolyBlepOscillator::setSampleRate ( float  value)
virtual

Set oscillator sample rate.

Reimplemented from Oscillator.

Definition at line 20 of file PolyBlepOscillator.cpp.

◆ setShape()

void PolyBlepOscillator::setShape ( float  value)

set waveform shape: 0.0 for saw, 1.0 for square wave

Definition at line 36 of file PolyBlepOscillator.cpp.


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