6 #ifndef OFX_PDSP_ENGINE_H_INCLUDED 7 #define OFX_PDSP_ENGINE_H_INCLUDED 10 #include "../DSP/pdspCore.h" 11 #include "../sequencer/SequencerSection.h" 12 #include "../sequencer/SequencerProcessor.h" 13 #include "../DSP/utility/OneBarTimeMs.h" 14 #include "../modules/oscillators/FMOperator.h" 15 #include "../DSP/utility/DBtoLin.h" 17 #include "SerialOut.h" 21 #include "helper/Controller.h" 27 #include "ofxiOSSoundStream.h" 36 class Engine :
public ofBaseSoundInput,
public ofBaseSoundOutput{
48 void setup(
int sampleRate,
int bufferSize,
int nBuffers);
70 void setChannels(
int inputChannels,
int outputChannels );
81 void setApi( ofSoundDevice::Api api );
101 [[deprecated(
"deprecated, handled automatically between construction and destruction")]]
113 [[deprecated(
"deprecated, handled automatically between construction and destruction")]]
116 #ifndef TARGET_OF_IOS 117 [[deprecated(
"deprecated, handled automatically between construction and destruction")]]
119 #endif // TARGET_OF_IOS 120 #endif // __ANDROID__ 122 [[deprecated(
"deprecated, handled automatically between construction and destruction")]]
123 void addExternalOut( pdsp::ExtSequencer & externalOut );
158 void test(
bool testingActive,
float testingDB=-12.0f );
169 void audioOut(ofSoundBuffer &outBuffer);
170 void audioIn (ofSoundBuffer &outBuffer);
180 void handleDisconnectedDevices();
182 ofSoundStream inputStream;
183 ofSoundStream outputStream;
184 ofSoundDevice::Api api;
187 bool outStreamActive;
196 std::vector<pdsp::ExternalInput> inputs;
199 std::vector<pdsp::midi::Input*> midiIns;
200 std::vector<pdsp::Controller*> controllers;
201 std::vector<pdsp::midi::Input*> controllerLinkedMidis;
207 static const int closedState = 0;
208 static const int stoppedState = 1;
209 static const int startedState = 2;
212 void onExit( ofEventArgs &args);
218 bool bBackgroundAudio;
224 #endif // OFX_PDSP_ENGINE_H_INCLUDED void close()
close everything. This is called automatically on exit and probably you should never use it...
Definition: Engine.cpp:293
Constantly outputs a control rate value that rapresent the time in milliseconds for one bar...
Definition: OneBarTimeMs.h:17
void setBackgroundAudio(bool active)
activate/deactivate background audio on ios, this function has to be called before the setup...
Definition: Engine.cpp:432
pdsp::Patchable & out_bar_ms()
returns a module that outputs the time of a musical bar in milliseconds
Definition: Engine.cpp:428
void addMidiController(pdsp::Controller &controller, pdsp::midi::Input &midiIn)
adds a midi controller and a relative midi input to the engine, making them active.
Definition: Engine.cpp:378
FM operator based on a wavetable sine.
Definition: FMOperator.h:23
void stop()
stop the audio streams.
Definition: Engine.cpp:277
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 ...
Definition: Engine.cpp:111
pdsp::Patchable & audio_out(int channel)
returns a Patchable object that represent the audio out of the system. Patch your module to this for ...
Definition: Engine.cpp:71
pdsp::Patchable & blackhole()
returns a Patchable object that continously process all output patched to it without outputting nothi...
Definition: Engine.cpp:107
void start()
starts the audio streams again if they were stopped.
Definition: Engine.cpp:263
void setInputDeviceID(int deviceID)
sets the ID of the audio device to open for audio input.
Definition: Engine.cpp:67
void setOutputDeviceID(int deviceID)
sets the ID of the audio device to open for audio output.
Definition: Engine.cpp:63
Definition: SerialOut.h:29
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
Contains all the needed framework for generating and sequencing messages for the DSPs.
Definition: SequencerProcessor.h:22
Multiply in("signal") for in("mod").
Definition: Amp.h:23
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().
Definition: Engine.cpp:58
pdsp::Patchable & audio_in(int channel)
returns a Patchable object that represent the audio input of the system. Patch this to your modules f...
Definition: Engine.cpp:89
void setApi(ofSoundDevice::Api api)
sets the API to use for the engine soundstream, for the APIs see oF ofSoundBaseTypes.h file.
Definition: Engine.cpp:436
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...
Definition: Engine.cpp:420
Definition: Controller.h:11
std::vector< ofSoundDevice > listDevices()
calls ofSoundStreamListDevices() for listing the available audio devices.
Definition: Engine.cpp:54
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
void setup(int sampleRate, int bufferSize, int nBuffers)
prepares all the module and units, initializing their internal buffers, then setup up the audioStream...
Definition: Engine.cpp:123
pdsp::SequencerProcessor sequencer
a SequencerProcessor class to manage the playhead and for sequencing. Look SequencerProcessor page fo...
Definition: Engine.h:146
The bridge between pdsp and the audio callback.
Definition: Processor.h:21