- cinder::audio::Context
- cinder::audio::linux::ContextJack
Public Member Functions
-
ContextJack ()
-
~ContextJack ()
-
createOutputDeviceNode (const DeviceRef &device, const Node::Format &format=Node::Format()) override
Creates and returns a platform-specific OutputDeviceNode , which delivers audio to the hardware output device specified by device .
-
createInputDeviceNode (const DeviceRef &device, const Node::Format &format=Node::Format()) override
Creates and returns a platform-specific InputDeviceNode , which captures audio from the hardware input device specified by device .
-
std::shared_ptr< NodeT >
-
std::shared_ptr< NodeT >
-
voidsetOutput (const OutputNodeRef &output)
Sets the new output of this Context to output . You should do this before making any connections because when Node 's are initialized they use the format of the OutputNode to configure their buffers.
-
const OutputNodeRef &getOutput ()
Returns the OutputNode for the Context (currently always an OutputDeviceNode that sends audio to your speakers). This can be thought of as the 'heartbeat', it is the one who initiates the pulling and processing of all other Node 's in the audio graph. note If the output has not already been set, it is the default OutputDeviceNode .
-
voidenable ()
Enables audio processing. Effectively the same as calling getOutput() -> enable()
-
voiddisable ()
Enables audio processing. Effectively the same as calling getOutput() -> disable()
-
voidsetEnabled (bool enable)
start / stop audio processing via boolean
-
boolisEnabled () const
Returns whether or not this Context is current enabled and processing audio.
-
voidconnectionsDidChange (const NodeRef &node)
Called by node when it's connections have changed. Default implementation is empty.
-
size_tgetSampleRate ()
Returns the samplerate of this Context , which is governed by the current OutputNode .
-
size_tgetFramesPerBlock ()
Returns the number of frames processed in one block by this Node , which is governed by the current OutputNode .
-
uint64_tgetNumProcessedFrames () const
Returns the total number of frames that have been processed in the dsp loop.
-
doublegetNumProcessedSeconds ()
Returns the total number of seconds that have been processed in the dsp loop.
-
voidinitializeNode (const NodeRef &node)
Initializes node , ensuring that Node::initialze() gets called and that its internal buffers are ready for processing. Useful for initializing a heavy Node at an opportune time so as to not cause audio drop-outs or UI snags.
-
voiduninitializeNode (const NodeRef &node)
Un-initializes node , ensuring that Node::uninitialze() gets called.
-
void
-
void
-
void
-
voidaddAutoPulledNode (const NodeRef &node)
Add node to the list of auto-pulled nodes, who will have their Node::pullInputs() method called after a OutputDeviceNode implementation finishes pulling its inputs.
Callers on the non-audio thread must synchronize with getMutex() .
-
voidremoveAutoPulledNode (const NodeRef &node)
Remove node from the list of auto-pulled nodes.
Callers on the non-audio thread must synchronize with getMutex() .
-
voidscheduleEvent (double when, const NodeRef &node, bool callFuncBeforeProcess, const std::function< void()> &func)
Schedule node to be enabled or disabled with with func on the audio thread, to be called at when seconds measured against getNumProcessedSeconds() . If callFuncBeforeProcess is true, then
func
will be called at the beginning of the processing block, if false will be called at the end.Should be called from the user thread. Currently only one event can be scheduled on a node at a time. node is owned until the scheduled event completes.
-
voidcancelScheduledEvents (const NodeRef &node)
Immediately cancels any events scheduled with scheduleEvent() .
-
voidschedule (double when, const NodeRef &node, bool callFuncBeforeProcess, const std::function< void()> &func)
Deprecated
use scheduleEvent() instead.
-
std::mutex &getMutex () const
Returns the mutex used to synchronize the audio thread. This is also used internally by the Node class when making connections.
-
boolisAudioThread () const
Returns true if the current thread is the thread used for audio processing, false otherwise.
-
voidpreProcess ()
OutputNode implementations should call this before each rendering block.
-
voidpostProcess ()
OutputNode implementations should call this after each rendering block.
-
doublegetTimeDuringLastProcessLoop () const
Returns the time in seconds spent during the last process loop.
-
std::stringprintGraphToString ()
Returns a string representation of the Node graph for debugging purposes.
Static Public Member Functions
-
Context *master ()
Returns the master Context that manages hardware I/O and real-time processing, which is platform specific. If none is available, returns null .
-
deviceManager ()
Returns the platform-specific DeviceManager singleton instance, which is platform specific. If none is available, returns null .
-
voidsetMaster (Context *masterContext, DeviceManager *deviceManager)
Allows the user to set the master Context and DeviceManager , overriding the defaults.