ofxPDSP
pdsp::Wrapper Class Referenceabstract
Inheritance diagram for pdsp::Wrapper:
pdsp::Unit pdsp::Preparable pdsp::Patchable

Public Member Functions

void setChannels (int inputs, int outputs)
 sets the number of inputs and output channels of the wrapper. Mandatory to call More...
 
pdsp::InputNodein (int num)
 returns the input at the given index, ready to be patched More...
 
pdsp::OutputNodeout (int num)
 returns the output at the given index, ready to be patched More...
 
pdsp::OutputNodeout_silent ()
 returns a dummy output to be patched to the engine.blackhole()
 
- 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 audioProcess (float *input, int bufferSize, int nChannels)=0
 this is the function you have to overload for processing your data. You can analyze he input values, or if you want to make your DSP you can change them or set them More...
 
void prepareUnit (int expectedBufferSize, double sampleRate) override
 this method will be called to prepare the unit to play. More...
 
void releaseResources () override
 this method will be called to release the unit resoruces. 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...
 

Additional Inherited Members

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

Member Function Documentation

◆ audioProcess()

virtual void pdsp::Wrapper::audioProcess ( float *  input,
int  bufferSize,
int  nChannels 
)
protectedpure virtual

this is the function you have to overload for processing your data. You can analyze he input values, or if you want to make your DSP you can change them or set them

Parameters
inputarray of interlaced values
sizeof the buffer, input array lenght is bufferSIze*nChannels
themax number between inputs and outputs

◆ in()

pdsp::InputNode & pdsp::Wrapper::in ( int  num)

returns the input at the given index, ready to be patched

Parameters
numindex of the input

◆ out()

pdsp::OutputNode & pdsp::Wrapper::out ( int  num)

returns the output at the given index, ready to be patched

Parameters
numindex of the output

◆ prepareUnit()

void pdsp::Wrapper::prepareUnit ( int  expectedBufferSize,
double  sampleRate 
)
overrideprotectedvirtual

this method will be called to prepare the unit to play.

Parameters
[in]expectedBufferSizethe size of the expected buffersize, already multiplied if the Unit is oversampling
[in]sampleRatethe sample rate, already multiplied if the Unit is oversampling

This method will be called before playing to prepare the Unit to play, remember that in some cases (when programming vst/au) it could be called more than once without even calling releaseResources()

Implements pdsp::Unit.

◆ releaseResources()

void pdsp::Wrapper::releaseResources ( )
overrideprotectedvirtual

this method will be called to release the unit resoruces.

This method will be called when pdsp::releaseAll() is called, so in some cases it could be called more than once in succession without a corresponding prepareToPlay() call, and it is also called on destruction, so make it robust enough.

Implements pdsp::Unit.

◆ setChannels()

void pdsp::Wrapper::setChannels ( int  inputs,
int  outputs 
)

sets the number of inputs and output channels of the wrapper. Mandatory to call

Parameters
inputsnumber of inputs
outputsnumber of outputs

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