Cinder  0.9.1
Public Member Functions | Static Public Member Functions | List of all members
cinder::audio::cocoa::ContextAudioUnit Class Reference

#include <ContextAudioUnit.h>

Inherits cinder::audio::Context.

Public Member Functions

virtual ~ContextAudioUnit ()
 
OutputDeviceNodeRef createOutputDeviceNode (const DeviceRef &device, const Node::Format &format=Node::Format()) override
 
InputDeviceNodeRef createInputDeviceNode (const DeviceRef &device, const Node::Format &format=Node::Format()) override
 
void setCurrentTimeStamp (const ::AudioTimeStamp *timeStamp)
 
const ::AudioTimeStamp * getCurrentTimeStamp ()
 
template<typename NodeT >
std::shared_ptr< NodeT > makeNode (NodeT *node)
 
template<typename NodeT , typename... Args>
std::shared_ptr< NodeT > makeNode (Args &&...args)
 
virtual void setOutput (const OutputNodeRef &output)
 
virtual const OutputNodeRefgetOutput ()
 
virtual void enable ()
 
virtual void disable ()
 
void setEnabled (bool enable)
 
bool isEnabled () const
 
virtual void connectionsDidChange (const NodeRef &node)
 
size_t getSampleRate ()
 
size_t getFramesPerBlock ()
 
uint64_t getNumProcessedFrames () const
 
double getNumProcessedSeconds ()
 
void initializeNode (const NodeRef &node)
 
void uninitializeNode (const NodeRef &node)
 
void initializeAllNodes ()
 
void uninitializeAllNodes ()
 
virtual void disconnectAllNodes ()
 
void addAutoPulledNode (const NodeRef &node)
 
void removeAutoPulledNode (const NodeRef &node)
 
void schedule (double when, const NodeRef &node, bool enable, const std::function< void()> &func)
 
std::mutex & getMutex () const
 
bool isAudioThread () const
 
void preProcess ()
 
void postProcess ()
 
std::string printGraphToString ()
 

Static Public Member Functions

static Contextmaster ()
 
static DeviceManagerdeviceManager ()
 
static void setMaster (Context *masterContext, DeviceManager *deviceManager)
 

Constructor & Destructor Documentation

cinder::audio::cocoa::ContextAudioUnit::~ContextAudioUnit ( )
virtual

Member Function Documentation

OutputDeviceNodeRef cinder::audio::cocoa::ContextAudioUnit::createOutputDeviceNode ( const DeviceRef device,
const Node::Format format = Node::Format() 
)
overridevirtual

Creates and returns a platform-specific OutputDeviceNode, which delivers audio to the hardware output device specified by device.

Implements cinder::audio::Context.

InputDeviceNodeRef cinder::audio::cocoa::ContextAudioUnit::createInputDeviceNode ( const DeviceRef device,
const Node::Format format = Node::Format() 
)
overridevirtual

Creates and returns a platform-specific InputDeviceNode, which captures audio from the hardware input device specified by device.

Implements cinder::audio::Context.

void cinder::audio::cocoa::ContextAudioUnit::setCurrentTimeStamp ( const ::AudioTimeStamp *  timeStamp)

set by the OutputNode

const ::AudioTimeStamp* cinder::audio::cocoa::ContextAudioUnit::getCurrentTimeStamp ( )

all other NodeAudioUnit's need to pass this correctly formatted timestamp to AudioUnitRender

Context * cinder::audio::Context::master ( )
staticinherited

Returns the master Context that manages hardware I/O and real-time processing, which is platform specific. If none is available, returns null.

DeviceManager * cinder::audio::Context::deviceManager ( )
staticinherited

Returns the platform-specific DeviceManager singleton instance, which is platform specific. If none is available, returns null.

void cinder::audio::Context::setMaster ( Context masterContext,
DeviceManager deviceManager 
)
staticinherited

Allows the user to set the master Context and DeviceManager, overriding the defaults.

template<typename NodeT >
std::shared_ptr< NodeT > cinder::audio::Context::makeNode ( NodeT *  node)
inherited

Interface for creating new Node's of type NodeT, which is owned by this Context. All Node's must be created using the Context.

template<typename NodeT , typename... Args>
std::shared_ptr< NodeT > cinder::audio::Context::makeNode ( Args &&...  args)
inherited

Interface for creating a new Node of type NodeT, which is owned by this Context. All Node's must be created using the Context.

void cinder::audio::Context::setOutput ( const OutputNodeRef output)
virtualinherited

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 & cinder::audio::Context::getOutput ( )
virtualinherited

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.

void cinder::audio::Context::enable ( )
virtualinherited

Enables audio processing. Effectively the same as calling getOutput()->enable()

void cinder::audio::Context::disable ( )
virtualinherited

Enables audio processing. Effectively the same as calling getOutput()->disable()

void cinder::audio::Context::setEnabled ( bool  enable)
inherited

start / stop audio processing via boolean

bool cinder::audio::Context::isEnabled ( ) const
inherited

Returns whether or not this Context is current enabled and processing audio.

virtual void cinder::audio::Context::connectionsDidChange ( const NodeRef node)
virtualinherited

Called by node when it's connections have changed, default implementation is empty.

size_t cinder::audio::Context::getSampleRate ( )
inherited

Returns the samplerate of this Context, which is governed by the current OutputNode.

size_t cinder::audio::Context::getFramesPerBlock ( )
inherited

Returns the number of frames processed in one block by this Node, which is governed by the current OutputNode.

uint64_t cinder::audio::Context::getNumProcessedFrames ( ) const
inherited

Returns the total number of frames that have been processed in the dsp loop.

double cinder::audio::Context::getNumProcessedSeconds ( )
inherited

Returns the total number of seconds that have been processed in the dsp loop.

void cinder::audio::Context::initializeNode ( const NodeRef node)
inherited

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.

void cinder::audio::Context::uninitializeNode ( const NodeRef node)
inherited

Un-initializes node, ensuring that Node::uninitialze() gets called.

void cinder::audio::Context::initializeAllNodes ( )
inherited

Initialize all Node's related by this Context.

void cinder::audio::Context::uninitializeAllNodes ( )
inherited

Uninitialize all Node's related by this Context.

void cinder::audio::Context::disconnectAllNodes ( )
virtualinherited

Disconnect all Node's related by this Context.

void cinder::audio::Context::addAutoPulledNode ( const NodeRef node)
inherited

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.

Note
Callers on the non-audio thread must synchronize with getMutex().
void cinder::audio::Context::removeAutoPulledNode ( const NodeRef node)
inherited

Remove node from the list of auto-pulled nodes.

Note
Callers on the non-audio thread must synchronize with getMutex().
void cinder::audio::Context::schedule ( double  when,
const NodeRef node,
bool  enable,
const std::function< void()> &  func 
)
inherited

Schedule node to be enabled or disabled with with func on the audio thread, to be called at when seconds measured against getNumProcessedSeconds(). node is owned until the scheduled event completes.

std::mutex& cinder::audio::Context::getMutex ( ) const
inherited

Returns the mutex used to synchronize the audio thread. This is also used internally by the Node class when making connections.

bool cinder::audio::Context::isAudioThread ( ) const
inherited

Returns true if the current thread is the thread used for audio processing, false otherwise.

void cinder::audio::Context::preProcess ( )
inherited

OutputNode implementations should call this before each rendering block.

void cinder::audio::Context::postProcess ( )
inherited

OutputNode implementations should call this after each rendering block.

string cinder::audio::Context::printGraphToString ( )
inherited

Returns a string representation of the Node graph for debugging purposes.


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