OpenWareLaboratory
InterpolatingWavetableOscillator< im > Class Template Reference
Inheritance diagram for InterpolatingWavetableOscillator< im >:
Collaboration diagram for InterpolatingWavetableOscillator< im >:

Public Member Functions

float generate ()
 Produce the next consecutive sample. More...
 
float generate (float fm)
 Produce a sample with frequency modulation. More...
 
virtual void generate (FloatArray output)
 Produce a block of samples. More...
 
virtual 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 getSample ()
 
float getSampleRate ()
 
void getSamples (FloatArray output)
 
void getSamples (FloatArray output, FloatArray fm)
 
FloatArray getWavetable ()
 
 InterpolatingWavetableOscillator ()
 
 InterpolatingWavetableOscillator (float sr)
 
 InterpolatingWavetableOscillator (float sr, FloatArray data)
 
void reset ()
 Reset oscillator (typically resets phase) More...
 
void setFrequency (float freq)
 Set oscillator frequency in Hertz. More...
 
void setPhase (float ph)
 Set current oscillator phase in radians. More...
 
void setSampleRate (float sr)
 Set oscillator sample rate. More...
 
void setWavetable (FloatArray wavetable)
 

Static Public Member Functions

static InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > * create (float sr)
 
static InterpolatingWavetableOscillator< im > * create (float sr, size_t length)
 
static void destroy (InterpolatingWavetableOscillator< im > *obj)
 
static void destroy (InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > *osc)
 

Static Public Attributes

static constexpr float begin_phase = 0
 
static constexpr float end_phase = 1
 

Static Protected Member Functions

static float polyblep (float t, float dt)
 Calculate poly blep antialiasing compensation on normalised (to range [0, 1]) phase and phase increment (angular rate) values. More...
 

Protected Attributes

float incr
 
float mul
 
float phase
 

Detailed Description

template<InterpolationMethod im = LINEAR_INTERPOLATION>
class InterpolatingWavetableOscillator< im >

Definition at line 53 of file WavetableOscillator.h.

Constructor & Destructor Documentation

◆ InterpolatingWavetableOscillator() [1/3]

template<InterpolationMethod im = LINEAR_INTERPOLATION>
InterpolatingWavetableOscillator< im >::InterpolatingWavetableOscillator ( )
inline

Definition at line 59 of file WavetableOscillator.h.

◆ InterpolatingWavetableOscillator() [2/3]

template<InterpolationMethod im = LINEAR_INTERPOLATION>
InterpolatingWavetableOscillator< im >::InterpolatingWavetableOscillator ( float  sr)
inline

◆ InterpolatingWavetableOscillator() [3/3]

template<InterpolationMethod im = LINEAR_INTERPOLATION>
InterpolatingWavetableOscillator< im >::InterpolatingWavetableOscillator ( float  sr,
FloatArray  data 
)
inline

Member Function Documentation

◆ create() [1/2]

Definition at line 115 of file Oscillator.h.

◆ create() [2/2]

template<InterpolationMethod im = LINEAR_INTERPOLATION>
static InterpolatingWavetableOscillator<im>* InterpolatingWavetableOscillator< im >::create ( float  sr,
size_t  length 
)
inlinestatic

Definition at line 77 of file WavetableOscillator.h.

References FloatArray::create().

◆ destroy() [1/2]

template<InterpolationMethod im = LINEAR_INTERPOLATION>
static void InterpolatingWavetableOscillator< im >::destroy ( InterpolatingWavetableOscillator< im > *  obj)
inlinestatic

◆ destroy() [2/2]

Definition at line 120 of file Oscillator.h.

◆ generate() [1/4]

float OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::generate ( )
inlinevirtualinherited

Produce the next consecutive sample.

Reimplemented from Oscillator.

Definition at line 99 of file Oscillator.h.

◆ generate() [2/4]

float OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::generate ( float  fm)
inlinevirtualinherited

Produce a sample with frequency modulation.

Implements Oscillator.

Definition at line 106 of file Oscillator.h.

◆ generate() [3/4]

◆ generate() [4/4]

virtual void Oscillator::generate ( FloatArray  output,
FloatArray  fm 
)
inlinevirtualinherited

Produce a block of samples with frequency modulation.

Reimplemented in VosimOscillator, SineOscillator, SampleOscillator< im >, PolyBlepOscillator, and MorphingOscillator.

Definition at line 50 of file Oscillator.h.

References Oscillator::generate(), and SimpleArray< T >::getSize().

◆ getFrequency()

float OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::getFrequency ( )
inlinevirtualinherited

Get oscillator frequency in Hertz.

Implements Oscillator.

Definition at line 86 of file Oscillator.h.

◆ 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 OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::getPhase ( )
inlinevirtualinherited

Get current oscillator phase in radians.

Returns
a value between 0 and 2*pi

Implements Oscillator.

Definition at line 92 of file Oscillator.h.

◆ getSample()

◆ getSampleRate()

float OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::getSampleRate ( )
inlineinherited

Definition at line 80 of file Oscillator.h.

◆ getSamples() [1/2]

void Oscillator::getSamples ( FloatArray  output)
inlineinherited

Definition at line 59 of file Oscillator.h.

References Oscillator::generate().

◆ getSamples() [2/2]

void Oscillator::getSamples ( FloatArray  output,
FloatArray  fm 
)
inlineinherited

Definition at line 63 of file Oscillator.h.

References Oscillator::generate().

◆ getWavetable()

template<InterpolationMethod im = LINEAR_INTERPOLATION>
FloatArray InterpolatingWavetableOscillator< im >::getWavetable ( )
inline

◆ polyblep()

static float OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::polyblep ( float  t,
float  dt 
)
inlinestaticprotectedinherited

Calculate poly blep antialiasing compensation on normalised (to range [0, 1]) phase and phase increment (angular rate) values.

Definition at line 128 of file Oscillator.h.

◆ reset()

void OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::reset ( )
inlinevirtualinherited

Reset oscillator (typically resets phase)

Implements Oscillator.

Definition at line 96 of file Oscillator.h.

◆ setFrequency()

void OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::setFrequency ( float  freq)
inlinevirtualinherited

Set oscillator frequency in Hertz.

Implements Oscillator.

Definition at line 83 of file Oscillator.h.

◆ setPhase()

void OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::setPhase ( float  ph)
inlinevirtualinherited

Set current oscillator phase in radians.

Parameters
phasea value between 0 and 2*pi

Implements Oscillator.

Definition at line 89 of file Oscillator.h.

◆ setSampleRate()

void OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > , Oscillator , float >::setSampleRate ( float  sr)
inlinevirtualinherited

Set oscillator sample rate.

Reimplemented from Oscillator.

Definition at line 75 of file Oscillator.h.

◆ setWavetable()

template<InterpolationMethod im = LINEAR_INTERPOLATION>
void InterpolatingWavetableOscillator< im >::setWavetable ( FloatArray  wavetable)
inline

Field Documentation

◆ begin_phase

template<InterpolationMethod im = LINEAR_INTERPOLATION>
constexpr float InterpolatingWavetableOscillator< im >::begin_phase = 0
staticconstexpr

Definition at line 57 of file WavetableOscillator.h.

◆ end_phase

template<InterpolationMethod im = LINEAR_INTERPOLATION>
constexpr float InterpolatingWavetableOscillator< im >::end_phase = 1
staticconstexpr

Definition at line 58 of file WavetableOscillator.h.

◆ incr

Definition at line 73 of file Oscillator.h.

◆ mul

Definition at line 71 of file Oscillator.h.

◆ phase

Definition at line 72 of file Oscillator.h.


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