OpenWareLaboratory
FeedbackQuadratureSineOscillator Class Reference

An oscillator similar to QuadratureSineOscillator class that also includes feedback control. More...

Inheritance diagram for FeedbackQuadratureSineOscillator:
Collaboration diagram for FeedbackQuadratureSineOscillator:

Public Member Functions

Sample generate ()
 Produce the next consecutive sample. More...
 
void generate (ComplexFloatArray output)
 
void generate (ComplexFloatArray output, FloatArray fm)
 
Sample 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 getFeedback () const
 
float getFrequency ()
 Get oscillator frequency in Hertz. More...
 
float getNextSample ()
 
float getNextSample (float fm)
 
float getPhase ()
 Get current oscillator phase in radians. More...
 
ComplexFloat getSample ()
 
float getSampleRate ()
 
void getSamples (FloatArray output)
 
void getSamples (FloatArray output, FloatArray fm)
 
void reset ()
 Reset oscillator (typically resets phase) More...
 
void setFeedback (float feedback)
 
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...
 

Static Public Member Functions

static T * create (float sr)
 
static void destroy (T *osc)
 

Static Public Attributes

static constexpr float begin_phase = 0
 
static constexpr float end_phase = 2 * M_PI
 

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 feedback = 0
 
float incr = 0
 
ComplexFloat last_sample = 0
 
float mul = 1
 
float phase = 0
 

Detailed Description

An oscillator similar to QuadratureSineOscillator class that also includes feedback control.

Feedback value is a scalar value, meaning that both real and imaginary axis get the same amount of feeback

Definition at line 45 of file QuadratureSineOscillator.h.

Member Function Documentation

◆ create()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
static T* OscillatorTemplate< T, BaseOscillator, Sample >::create ( float  sr)
inlinestaticinherited

Definition at line 115 of file Oscillator.h.

◆ destroy()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
static void OscillatorTemplate< T, BaseOscillator, Sample >::destroy ( T *  osc)
inlinestaticinherited

Definition at line 120 of file Oscillator.h.

◆ generate() [1/6]

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
Sample OscillatorTemplate< T, BaseOscillator, Sample >::generate ( )
inlinevirtualinherited

Produce the next consecutive sample.

Reimplemented from SignalGenerator.

Definition at line 99 of file Oscillator.h.

References OscillatorTemplate< T, BaseOscillator, Sample >::incr, and OscillatorTemplate< T, BaseOscillator, Sample >::phase.

◆ generate() [2/6]

◆ generate() [3/6]

◆ generate() [4/6]

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
Sample OscillatorTemplate< T, BaseOscillator, Sample >::generate ( float  fm)
inlinevirtualinherited

Produce a sample with frequency modulation.

Implements Oscillator.

Definition at line 106 of file Oscillator.h.

References OscillatorTemplate< T, BaseOscillator, Sample >::incr, and OscillatorTemplate< T, BaseOscillator, Sample >::phase.

◆ generate() [5/6]

◆ generate() [6/6]

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().

◆ getFeedback()

float FeedbackQuadratureSineOscillator::getFeedback ( ) const
inline

Definition at line 52 of file QuadratureSineOscillator.h.

References feedback.

◆ getFrequency()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
float OscillatorTemplate< T, BaseOscillator, Sample >::getFrequency ( )
inlinevirtualinherited

◆ 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()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
float OscillatorTemplate< T, BaseOscillator, Sample >::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.

References M_PI, and OscillatorTemplate< T, BaseOscillator, Sample >::phase.

◆ getSample()

ComplexFloat FeedbackQuadratureSineOscillator::getSample ( )
inline

◆ getSampleRate()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
float OscillatorTemplate< T, BaseOscillator, Sample >::getSampleRate ( )
inlineinherited

Definition at line 80 of file Oscillator.h.

References OscillatorTemplate< T, BaseOscillator, Sample >::mul.

◆ 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().

◆ polyblep()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
static float OscillatorTemplate< T, BaseOscillator, Sample >::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()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
void OscillatorTemplate< T, BaseOscillator, Sample >::reset ( )
inlinevirtualinherited

Reset oscillator (typically resets phase)

Implements Oscillator.

Definition at line 96 of file Oscillator.h.

References OscillatorTemplate< T, BaseOscillator, Sample >::phase.

Referenced by VosimOscillator::generate(), and AntialiasedRampOscillator::reset().

◆ setFeedback()

void FeedbackQuadratureSineOscillator::setFeedback ( float  feedback)
inline

Definition at line 49 of file QuadratureSineOscillator.h.

References feedback.

◆ setFrequency()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
void OscillatorTemplate< T, BaseOscillator, Sample >::setFrequency ( float  value)
inlinevirtualinherited

◆ setPhase()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
void OscillatorTemplate< T, BaseOscillator, Sample >::setPhase ( float  phase)
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.

References M_PI, and OscillatorTemplate< T, BaseOscillator, Sample >::phase.

Referenced by VosimOscillator::generate(), and AntialiasedRampOscillator::setPhase().

◆ setSampleRate()

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
void OscillatorTemplate< T, BaseOscillator, Sample >::setSampleRate ( float  value)
inlinevirtualinherited

Field Documentation

◆ begin_phase

constexpr float FeedbackQuadratureSineOscillator::begin_phase = 0
staticconstexpr

Definition at line 47 of file QuadratureSineOscillator.h.

◆ end_phase

constexpr float FeedbackQuadratureSineOscillator::end_phase = 2 * M_PI
staticconstexpr

Definition at line 48 of file QuadratureSineOscillator.h.

Referenced by generate().

◆ feedback

float FeedbackQuadratureSineOscillator::feedback = 0
protected

Definition at line 83 of file QuadratureSineOscillator.h.

Referenced by generate(), getFeedback(), getSample(), and setFeedback().

◆ incr

◆ last_sample

ComplexFloat FeedbackQuadratureSineOscillator::last_sample = 0
protected

Definition at line 84 of file QuadratureSineOscillator.h.

Referenced by generate(), and getSample().

◆ mul

template<class T , class BaseOscillator = Oscillator, typename Sample = float>
float OscillatorTemplate< T, BaseOscillator, Sample >::mul = 1
protectedinherited

◆ phase


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