OpenWareLaboratory
|
The MorphingOscillator wraps a fixed number of Oscillators and crossfades between their outputs. More...
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) |
size_t | getNumberOfOscillators () |
Oscillator * | getOscillator (size_t index) |
float | getPhase () |
Get current oscillator phase in radians. More... | |
void | getSamples (FloatArray output) |
void | getSamples (FloatArray output, FloatArray fm) |
void | morph (float value) |
Morph between all configured oscillators. More... | |
MorphingOscillator (Oscillator **osc, size_t count, FloatArray buffer) | |
void | reset () |
Reset oscillator (typically resets phase) More... | |
void | setFrequency (float value) |
Set oscillator frequency in Hertz. More... | |
void | setOscillator (size_t index, Oscillator *oscillator) |
void | setPhase (float value) |
Set current oscillator phase in radians. More... | |
virtual void | setSampleRate (float value) |
Set oscillator sample rate. More... | |
Static Public Member Functions | |
static MorphingOscillator * | create (size_t oscillator_count, size_t blocksize) |
static void | destroy (MorphingOscillator *obj) |
Protected Attributes | |
FloatArray | buffer |
Oscillator * | hi = NULL |
Oscillator * | lo = NULL |
Oscillator ** | osc |
size_t | osc_count |
float | xf = 0 |
The MorphingOscillator wraps a fixed number of Oscillators and crossfades between their outputs.
Only two oscillator outputs are computed at a time. When changing between crossfading oscillators, their phases are synchronised.
Definition at line 12 of file MorphingOscillator.h.
|
inline |
Definition at line 21 of file MorphingOscillator.h.
Referenced by create().
|
inlinestatic |
Definition at line 97 of file MorphingOscillator.h.
References FloatArray::create(), and MorphingOscillator().
|
inlinestatic |
Definition at line 101 of file MorphingOscillator.h.
References buffer, FloatArray::destroy(), and osc.
|
inlinevirtual |
Produce the next consecutive sample.
Reimplemented from SignalGenerator.
Definition at line 41 of file MorphingOscillator.h.
References Oscillator::generate(), hi, lo, and xf.
|
inlinevirtual |
Produce a sample with frequency modulation.
Implements Oscillator.
Definition at line 46 of file MorphingOscillator.h.
References Oscillator::generate(), hi, lo, and xf.
|
inlinevirtual |
Produce a block of samples.
Reimplemented from SignalGenerator.
Definition at line 51 of file MorphingOscillator.h.
References FloatArray::add(), buffer, Oscillator::generate(), hi, lo, FloatArray::multiply(), and xf.
|
inlinevirtual |
Produce a block of samples with frequency modulation.
Reimplemented from Oscillator.
Definition at line 58 of file MorphingOscillator.h.
References FloatArray::add(), buffer, Oscillator::generate(), hi, lo, FloatArray::multiply(), and xf.
|
inlinevirtual |
Get oscillator frequency in Hertz.
Implements Oscillator.
Definition at line 27 of file MorphingOscillator.h.
References Oscillator::getFrequency(), and lo.
Referenced by morph().
|
inlineinherited |
Definition at line 55 of file Oscillator.h.
References Oscillator::generate().
|
inlineinherited |
Definition at line 57 of file Oscillator.h.
References Oscillator::generate().
|
inline |
Definition at line 86 of file MorphingOscillator.h.
References osc_count.
|
inline |
Definition at line 89 of file MorphingOscillator.h.
References osc.
|
inlinevirtual |
Get current oscillator phase in radians.
Implements Oscillator.
Definition at line 34 of file MorphingOscillator.h.
References Oscillator::getPhase(), and lo.
Referenced by morph().
|
inlineinherited |
Definition at line 59 of file Oscillator.h.
References Oscillator::generate().
|
inlineinherited |
Definition at line 63 of file Oscillator.h.
References Oscillator::generate().
|
inline |
Morph between all configured oscillators.
value | a cross fade index between 0 and 1. |
Definition at line 69 of file MorphingOscillator.h.
References clamp, getFrequency(), getPhase(), hi, lo, osc, osc_count, Oscillator::setFrequency(), Oscillator::setPhase(), and xf.
|
inlinevirtual |
Reset oscillator (typically resets phase)
Implements Oscillator.
Definition at line 37 of file MorphingOscillator.h.
References hi, lo, and Oscillator::reset().
|
inlinevirtual |
Set oscillator frequency in Hertz.
Implements Oscillator.
Definition at line 23 of file MorphingOscillator.h.
References hi, lo, and Oscillator::setFrequency().
|
inline |
Definition at line 92 of file MorphingOscillator.h.
|
inlinevirtual |
Set current oscillator phase in radians.
phase | a value between 0 and 2*pi |
Implements Oscillator.
Definition at line 30 of file MorphingOscillator.h.
References hi, lo, and Oscillator::setPhase().
|
inlinevirtualinherited |
Set oscillator sample rate.
Reimplemented in PolyBlepOscillator, OscillatorTemplate< T, BaseOscillator, Sample >, OscillatorTemplate< VosimOscillator >, OscillatorTemplate< AntialiasedWavetableOscillator >, OscillatorTemplate< TriangleOscillator >, OscillatorTemplate< InvertedSquareWaveOscillator >, OscillatorTemplate< VariableShapeOscillator >, OscillatorTemplate< InterpolatingWavetableOscillator< LINEAR_INTERPOLATION > >, OscillatorTemplate< NoiseOscillator >, OscillatorTemplate< SquareWaveOscillator >, OscillatorTemplate< SineOscillator >, OscillatorTemplate< AntialiasedTriangleOscillator >, OscillatorTemplate< AntialiasedRampOscillator >, OscillatorTemplate< InvertedRampOscillator >, OscillatorTemplate< AntialiasedSquareWaveOscillator >, OscillatorTemplate< RampOscillator >, OscillatorTemplate< WavetableOscillator >, and ChirpOscillator.
Definition at line 20 of file Oscillator.h.
|
protected |
Definition at line 16 of file MorphingOscillator.h.
Referenced by destroy(), and generate().
|
protected |
Definition at line 18 of file MorphingOscillator.h.
Referenced by generate(), morph(), reset(), setFrequency(), setOscillator(), and setPhase().
|
protected |
Definition at line 17 of file MorphingOscillator.h.
Referenced by generate(), getFrequency(), getPhase(), morph(), reset(), setFrequency(), setOscillator(), and setPhase().
|
protected |
Definition at line 14 of file MorphingOscillator.h.
Referenced by destroy(), getOscillator(), morph(), and setOscillator().
|
protected |
Definition at line 15 of file MorphingOscillator.h.
Referenced by getNumberOfOscillators(), and morph().
|
protected |
Definition at line 19 of file MorphingOscillator.h.
Referenced by generate(), and morph().