ofxPDSP
pdsp::OscillatorVariShape Class Referenceabstract

Abstract class to implement oscillators with single shape control. More...

#include <OscillatorVariShape.h>

Inheritance diagram for pdsp::OscillatorVariShape:
pdsp::Unit pdsp::Preparable pdsp::Patchable pdsp::CheapPulse pdsp::SineFB pdsp::WaveTableOsc

Public Member Functions

Patchablein_phase ()
 Sets "phase" as selected input and returns this Unit ready to be patched. This is the default input. You have to patch a "phase" output to this input, usuall taken from some kind of phazor like PMPhazor, LFOPhazor or ClockedPhazor.
 
Patchablein_shape ()
 Sets "shape" as selected input and returns this Unit ready to be patched. This is the shape input, it supports audio-rate modulation.
 
Patchableout_signal ()
 Sets "signal" as selected output and returns this Unit ready to be patched. This is the default output. This is the oscillator waveform output.
 
float meter_output () const
 Returns the first value of the last processed output. Usually is more useful to track when the oscillator is running as LFO. This method is thread-safe.
 
- Public Member Functions inherited from pdsp::Unit
 Unit (const Unit &other)
 
Unitoperator= (const Unit &other)
 
 Unit (Unit &&other)
 
Unitoperator= (Unit &&other)
 
virtual void setOversampleLevel (int newOversampleLevel)
 sets the unit oversample level More...
 
int getOversampleLevel () const
 returns the Unit oversample level
 
- Public Member Functions inherited from pdsp::Patchable
void resetInputToDefault ()
 resets the selected input to the default.
 
void resetOutputToDefault ()
 resets the selected output to the default.
 
Patchablein (const char *tag)
 sets the selected input to the one tagged with "tag", if tag is a valid string, and returns this Patchable ready to be patched. More...
 
Patchableout (const char *tag)
 sets the selected output to the one tagged with "tag", if tag is a valid string, and returns this Patchable ready to be patched. More...
 
void disconnectIn ()
 disconnects all the outputs connected to the selected input, then resets the selected input to the default.
 
void disconnectOut ()
 disconnects all the inputs connected to the selected output, then resets the selected output to the default.
 
void disconnectAll ()
 disconnects all the inputs and outputs to their connected outputs and inputs. Also resets the selected input and output to the default.
 
InputNodegetSelectedInput ()
 returns the selected input, you can patch a Patchable or OutputNode to it with the >> operator.
 
OutputNodegetSelectedOutput ()
 returns the selected output, you can patch it to another Patchable or InputNode with the >> operator.
 
std::vector< std::string > getInputsList ()
 returns a vector of the valid input tags
 
std::vector< std::string > getOutputsList ()
 returns a vector of the valid input tags
 

Protected Member Functions

virtual void prepareOscillator (double sampleRate)
 method to implement for preparing oscillator to play, overriding it is not mandatory More...
 
virtual void releaseOscillator ()
 method to implement for cleaning up on resource release, overriding it is not mandatory
 
virtual void oscillateShapeCR (float *outputBuffer, const float *phaseBuffer, const float shape, int bufferSize) noexcept=0
 method to implement for preparing oscillator to play, with control-rate shape given More...
 
virtual void oscillateShapeAR (float *outputBuffer, const float *phaseBuffer, const float *shapeBuffer, int bufferSize) noexcept=0
 method to implement for preparing oscillator to play, with audio-rate shape given More...
 
- Protected Member Functions inherited from pdsp::Unit
void prepareToPlay (int expectedBufferSize, double sampleRate) override
 you have to use this method only in the constructor, inside if(dynamicConstruction){ } More...
 
const float * processInput (InputNode &node, int &stateNow)
 process the given input, gives you a pointer to the processed buffer as result and its state More...
 
float processAndGetSingleValue (InputNode &input, int pos)
 process the given input, gives you a pointer to the processed buffer as result and its state More...
 
float * getOutputBufferToFill (OutputNode &node)
 gets a pointer to the output buffer for rendering audio to it, and sets the OutputNode state to AudioRate More...
 
void setControlRateOutput (OutputNode &node, float scalarValue)
 sets the OutputNode buffer to "Changed" and its first value to scalarValue More...
 
void setOutputToZero (OutputNode &node)
 sets the OutputNode buffer to "Changed" and its first value to 0.0f More...
 
void updateOutputNodes ()
 call this method in the Unit constructor after adding all the Outputs, this is mandatory for the inner working of the patching framework.
 
- Protected Member Functions inherited from pdsp::Patchable
void addOutput (const char *tag, OutputNode &output)
 method to add outputs when constructing a Unit More...
 
void addInput (const char *tag, InputNode &input)
 method to add inputs when constructing a Unit More...
 
void addModuleOutput (const char *tag, Patchable &unit)
 method to add outputs when constructing a module More...
 
void addModuleInput (const char *tag, Patchable &unit)
 method to add outputs when constructing a module More...
 

Protected Attributes

InputNode input_shape
 

Additional Inherited Members

- Static Public Member Functions inherited from pdsp::Preparable
static double getGlobalSampleRate ()
 

Detailed Description

Abstract class to implement oscillators with single shape control.

This is a abstract class to rapresent oscillators, with a phase input an a shape control input. You usually have just to implement the oscillateShapeCR() and oscillateShapeAR() methods

Member Function Documentation

◆ oscillateShapeAR()

virtual void pdsp::OscillatorVariShape::oscillateShapeAR ( float *  outputBuffer,
const float *  phaseBuffer,
const float *  shapeBuffer,
int  bufferSize 
)
protectedpure virtualnoexcept

method to implement for preparing oscillator to play, with audio-rate shape given

Parameters
[out]outputBufferbuffer to fill with waveform output
[in]phaseBufferbuffer for the phase values
[in]shapeBufferbuffer of shape control values
[in]bufferSizebuffersize, already multipled if oversampling

◆ oscillateShapeCR()

virtual void pdsp::OscillatorVariShape::oscillateShapeCR ( float *  outputBuffer,
const float *  phaseBuffer,
const float  shape,
int  bufferSize 
)
protectedpure virtualnoexcept

method to implement for preparing oscillator to play, with control-rate shape given

Parameters
[out]outputBufferbuffer to fill with waveform output
[in]phaseBufferbuffer for the phase values
[in]shapeshape control values
[in]bufferSizebuffersize, already multipled if oversampling

◆ prepareOscillator()

void pdsp::OscillatorVariShape::prepareOscillator ( double  sampleRate)
protectedvirtual

method to implement for preparing oscillator to play, overriding it is not mandatory

Parameters
[in]sampleRatesample rate, already multiplied if the oscillator is oversampling

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