ofxPDSP
pdsp::Engine Class Reference
Inheritance diagram for pdsp::Engine:

Public Member Functions

void setup (int sampleRate, int bufferSize, int nBuffers)
 prepares all the module and units, initializing their internal buffers, then setup up the audioStreams and start the audio engine. Check oF audio tutorials for more info on the parameters. More...
 
void start ()
 starts the audio streams again if they were stopped.
 
void stop ()
 stop the audio streams.
 
void close ()
 close everything. This is called automatically on exit and probably you should never use it.
 
void setChannels (int inputChannels, int outputChannels)
 sets the number of inputs and output channels. If not called, the standard is 0 input channels and 2 output channels (L/R). More...
 
std::vector< ofSoundDevice > listDevices ()
 calls ofSoundStreamListDevices() for listing the available audio devices.
 
void setApi (ofSoundDevice::Api api)
 sets the API to use for the engine soundstream, for the APIs see oF ofSoundBaseTypes.h file. More...
 
void setDeviceID (int deviceID)
 sets the ID of the audio device to open. You can get the available ID with listDevices(). Sometimes you have to use different ID for input and output devices, for that use setInputDeviceID() and setOutputDeviceID(). More...
 
void setInputDeviceID (int deviceID)
 sets the ID of the audio device to open for audio input. More...
 
void setOutputDeviceID (int deviceID)
 sets the ID of the audio device to open for audio output. More...
 
void addOscInput (pdsp::osc::Input &oscInput)
 
void addMidiController (pdsp::Controller &controller, pdsp::midi::Input &midiIn)
 adds a midi controller and a relative midi input to the engine, making them active. More...
 
void addMidiOut (pdsp::midi::Output &midiOut)
 
void addSerialOut (pdsp::serial::Output &serialOut)
 
void addExternalOut (pdsp::ExtSequencer &externalOut)
 
pdsp::Patchableaudio_out (int channel)
 returns a Patchable object that represent the audio out of the system. Patch your module to this for connecting them to the selected device audio output. More...
 
pdsp::Patchableaudio_in (int channel)
 returns a Patchable object that represent the audio input of the system. Patch this to your modules for processing the selected device audio input. More...
 
pdsp::Patchableblackhole ()
 returns a Patchable object that continously process all output patched to it without outputting nothing. Patch your Units and modules to this channels if you need them to be always active for some reason;
 
pdsp::Patchableout_bar_ms ()
 returns a module that outputs the time of a musical bar in milliseconds
 
void test (bool testingActive, float testingDB=-12.0f)
 activate/deactivate a sine tone patched to the left output to testing that the engine is running. More...
 
void setBackgroundAudio (bool active)
 activate/deactivate background audio on ios, this function has to be called before the setup. More...
 

Public Attributes

pdsp::SequencerProcessor sequencer
 a SequencerProcessor class to manage the playhead and for sequencing. Look SequencerProcessor page for knowing more.
 

Member Function Documentation

◆ addMidiController()

void pdsp::Engine::addMidiController ( pdsp::Controller controller,
pdsp::midi::Input midiIn 
)

adds a midi controller and a relative midi input to the engine, making them active.

Parameters
[in]controllercontroller to add
[in]midiInmidiIn for the controller. Adds a midi controller and a relative midi input to the engine, making them active. You can use the same pdsp::midi::Input for multiple controllers, that are parsing the midi data in different way, for example if you have a keyboard with some knob and faders you can use the same midiIn with a ofxPDSPMidiKeys for the key, pitch bend and pressure output and a ofxPDSPMidiControls for the knobs and faders.

◆ audio_in()

pdsp::Patchable & pdsp::Engine::audio_in ( int  channel)

returns a Patchable object that represent the audio input of the system. Patch this to your modules for processing the selected device audio input.

Parameters
[in]channelchannel to connect

◆ audio_out()

pdsp::Patchable & pdsp::Engine::audio_out ( int  channel)

returns a Patchable object that represent the audio out of the system. Patch your module to this for connecting them to the selected device audio output.

Parameters
[in]channelchannel to connect

◆ setApi()

void pdsp::Engine::setApi ( ofSoundDevice::Api  api)

sets the API to use for the engine soundstream, for the APIs see oF ofSoundBaseTypes.h file.

Parameters
[in]apiname of the API to use

◆ setBackgroundAudio()

void pdsp::Engine::setBackgroundAudio ( bool  active)

activate/deactivate background audio on ios, this function has to be called before the setup.

Parameters
mixtrue to activate background audio, false to deactivate, false is default

◆ setChannels()

void pdsp::Engine::setChannels ( int  inputChannels,
int  outputChannels 
)

sets the number of inputs and output channels. If not called, the standard is 0 input channels and 2 output channels (L/R).

Parameters
[in]inputChannelsinput channels number
[in]outputChannelsoutput channels number

◆ setDeviceID()

void pdsp::Engine::setDeviceID ( int  deviceID)

sets the ID of the audio device to open. You can get the available ID with listDevices(). Sometimes you have to use different ID for input and output devices, for that use setInputDeviceID() and setOutputDeviceID().

Parameters
[in]deviceIDID to set

◆ setInputDeviceID()

void pdsp::Engine::setInputDeviceID ( int  deviceID)

sets the ID of the audio device to open for audio input.

Parameters
[in]deviceIDID to set

◆ setOutputDeviceID()

void pdsp::Engine::setOutputDeviceID ( int  deviceID)

sets the ID of the audio device to open for audio output.

Parameters
[in]deviceIDID to set

◆ setup()

void pdsp::Engine::setup ( int  sampleRate,
int  bufferSize,
int  nBuffers 
)

prepares all the module and units, initializing their internal buffers, then setup up the audioStreams and start the audio engine. Check oF audio tutorials for more info on the parameters.

Parameters
[in]sampleRateaudio callbacks sample rate
[in]bufferSizeaudio callbacks expected buffer size.
[in]nBuffersnumber of buffers in the audioQueue

◆ test()

void pdsp::Engine::test ( bool  testingActive,
float  testingDB = -12.0f 
)

activate/deactivate a sine tone patched to the left output to testing that the engine is running.

Parameters
testingActivepass true to activate testing, false to deactivate
testingDBoptional volume of testing tone, -12dB if not given

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