Jamoma API  0.6.0.a19
TTAudioEngine Class Reference

The TTAudioEngine class is the Audio Engine of Jamoma DSP. More...

#include <TTAudioEngine.h>

+ Inheritance diagram for TTAudioEngine:
+ Collaboration diagram for TTAudioEngine:

Public Member Functions

TTErr initStream ()
 
TTErr start ()
 Start audio processing. More...
 
TTErr stop ()
 Stop audio processing. More...
 
TTErr getCpuLoad (const TTValue &unusedInput, TTValue &returnedValue)
 Monitor how taxing current audio processing is on the CPU. More...
 
TTErr getAvailableInputDeviceNames (const TTValue &unusedInput, TTValue &returnedDeviceNames)
 Get the names of all available input devices. More...
 
TTErr getAvailableOutputDeviceNames (const TTValue &unusedInput, TTValue &returnedDeviceNames)
 Get the names of all available output devices. More...
 
TTErr getInputSignalReference (TTValue &anUnusedInput, TTValue &aReturnedAudioSignalPtr)
 Get the reference pointer for the input signal. More...
 
TTErr getOutputSignalReference (TTValue &anUnusedInput, TTValue &aReturnedAudioSignalPtr)
 Get the reference pointer for the output signal. More...
 
TTErr setInputDevice (TTValue &newDeviceName)
 Set what audio input device to use. More...
 
TTErr setOutputDevice (TTValue &newDeviceName)
 Set what audio output device to use. More...
 
TTErr setVectorSize (TTValue &newVectorSize)
 Set vector size. More...
 
TTErr setSampleRate (TTValue &newSampleRate)
 Set the sample rate. More...
 
TTErr addCallbackObserver (const TTValue &objectToReceiveNotifications, TTValue &unusedOutput)
 
TTErr removeCallbackObserver (const TTValue &objectCurrentlyReceivingNotifications, TTValue &unusedOutput)
 
TTInt32 callback (const TTFloat32 *input, TTFloat32 *output, TTUInt32 frameCount, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags)
 This is called repeatedly by PortAudio every time a new vector of audio is needed. More...
 
- Public Member Functions inherited from TTObjectBase
virtual ~TTObjectBase ()
 Destructor.
 
TTUInt16 getReferenceCount ()
 Query an object to get its current reference count. More...
 
TTUInt32 getObserverCount () const
 Query an object to get the number of observers. More...
 
TTErr registerAttribute (const TTSymbol name, const TTDataType type, void *address)
 Register an attribute. More...
 
TTErr extendAttribute (const TTSymbol name, const TTObjectBasePtr extendedObject, const TTSymbol extendedName)
 Extend the attribute of an existing TTObjectBase to this TTObjectBase (using another attribute name) More...
 
TTErr removeAttribute (const TTSymbol name)
 Remove an attribute. More...
 
TTErr findAttribute (const TTSymbol name, TTAttribute **attr)
 Find an attribute. More...
 
TTErr setAttributeValue (const TTSymbol name, TTValue &value)
 Set an attribute value for an object. More...
 
template<class T >
TTErr set (const TTSymbol aName, T aValue)
 Set an attribute value for an object This is the same as calling setAttributeValue(). More...
 
TTErr getAttributeValue (const TTSymbol name, TTValue &value)
 Get an attribute value for an object. More...
 
template<class T >
TTErr get (const TTSymbol aName, T &aReturnedValue)
 Get an attribute value for an object This is the same as calling getAttributeValue(). More...
 
TTSymbol getAttributeType (const TTSymbol name)
 Return the type of an attribute as a symbol. More...
 
TTErr getAttributeGetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Get the getterFlags of an attribute. More...
 
TTErr setAttributeGetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Set the getterFlags of an attribute. More...
 
TTErr getAttributeSetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Get the setterFlags of an attribute. More...
 
TTErr setAttributeSetterFlags (const TTSymbol name, TTAttributeFlags &value)
 Set the setterFlags of an attribute. More...
 
TTErr registerAttributeProperty (const TTSymbol attributeName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter)
 Register an attribute property. More...
 
TTErr registerMessageProperty (const TTSymbol messageName, const TTSymbol propertyName, const TTValue &initialValue, TTGetterMethod getter, TTSetterMethod setter)
 Register an message property. More...
 
TTErr getAttribute (const TTSymbol name, TTAttributePtr *attributeObject)
 Search for and locate an attribute. More...
 
TTErr getMessage (const TTSymbol name, TTMessagePtr *messageObject)
 Search for and locate a message. More...
 
void getAttributeNames (TTValue &attributeNameList)
 Return a list of names of the available attributes. More...
 
void getMessageNames (TTValue &messageNameList)
 Return a list of names of the available messages. More...
 
TTSymbol getName () const
 Return the name of this class. More...
 
TTErr registerMessage (const TTSymbol name, TTMethod method)
 Register a message with this object. More...
 
TTErr findMessage (const TTSymbol name, TTMessage **message)
 Find a message registered with this object. More...
 
TTErr removeMessage (const TTSymbol name)
 Remove a message. More...
 
TTErr sendMessage (const TTSymbol name)
 TODO: Document this function. More...
 
TTErr registerObserverForMessage (const TTObject &observingObject, const TTSymbol messageName)
 Register an observer for a message. More...
 
TTErr registerObserverForAttribute (const TTObject &observingObject, const TTSymbol attributeName)
 Register an observer for an attribute. More...
 
TTErr registerObserverForNotifications (const TTObject &observingObject)
 Register an observer. More...
 
TTErr unregisterObserverForMessage (const TTObject &observingObject, const TTSymbol messageName)
 Unregister an observer for a message. More...
 
TTErr unregisterObserverForAttribute (const TTObject &observingObject, const TTSymbol attributeName)
 Unregister an observer for an attribute. More...
 
TTErr unregisterObserverForNotifications (const TTObject &observingObject)
 Unregister an observer for notifications. More...
 
TTErr sendNotification (const TTSymbol name, const TTValue &arguments)
 Send a notification. More...
 
TTErr logMessage (TTImmutableCString fmtstring,...)
 Log messages scoped to this object instance. More...
 
TTErr logWarning (TTImmutableCString fmtstring,...)
 Log warnings scoped to this object instance. More...
 
TTErr logError (TTImmutableCString fmtstring,...)
 Log errors scoped to this object instance. More...
 
TTErr logDebug (TTImmutableCString fmtstring,...)
 Log messages (scoped to this object instance) to output only if the basic debugging flag is enabled in the environment. More...
 
TTErr lock ()
 Lock the object in order to ensure thread-safe processing. More...
 
TTErr unlock ()
 Unlock the object when thread-safe processing is no longer required. More...
 
TTBoolean isLocked ()
 Query if the object currently is locked for thread-safe processing. More...
 
TTBoolean waitForLock ()
 If the object is locked (e.g. More...
 

Static Public Member Functions

static TTErr destroy ()
 

Static Public Attributes

static TTDictionaryPtr sDictionary = NULL
 We use a dictionary to map the singleton instance to a symbol. More...
 

Protected Attributes

TTChannelCount mNumInputChannels
 The number of input channels.
 
TTChannelCount mNumOutputChannels
 The number of output channels.
 
TTUInt16 mVectorSize
 Vector size (frames per buffer)
 
TTUInt32 mSampleRate
 Sample rate.
 
TTSymbol mInputDevice
 The audio device used for audio input.
 
TTSymbol mOutputDevice
 The audio device used for audio output.
 
const PaDeviceInfomInputDeviceInfo
 A structure providing information and capabilities of PortAudio devices, including information on latency and max number of channels. Refer to the documentation of PortAudio for further references.
 
const PaDeviceInfomOutputDeviceInfo
 A structure providing information and capabilities of PortAudio devices, including information on latency and max number of channels. Refer to the documentation of PortAudio for further references.
 
TTBoolean mIsRunning
 A flag indicating if audio is currently being processed.
 
- Protected Attributes inherited from TTObjectBase
TTList observers
 List of all objects watching this object for life-cycle and other changes.
 

Additional Inherited Members

- Public Attributes inherited from TTObjectBase
TTBoolean valid
 If the object isn't completely built, or is in the process of freeing, this will be false.
 
TTBoolean track
 enable the print of a log message to ease the track of reference counting mechanism on an instance More...
 
- Protected Member Functions inherited from TTObjectBase
 TTObjectBase (const TTValue arguments)
 Constructor. More...
 

Detailed Description

The TTAudioEngine class is the Audio Engine of Jamoma DSP.

Definition at line 42 of file TTAudioEngine.h.

Member Function Documentation

TTErr TTAudioEngine::addCallbackObserver ( const TTValue objectToReceiveNotifications,
TTValue unusedOutput 
)
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 371 of file TTAudioEngine.cpp.

References kTTErrNone.

TTInt32 TTAudioEngine::callback ( const TTFloat32 input,
TTFloat32 output,
TTUInt32  frameCount,
const PaStreamCallbackTimeInfo timeInfo,
PaStreamCallbackFlags  statusFlags 
)

This is called repeatedly by PortAudio every time a new vector of audio is needed.

Parameters
input
output
frameCount
timeInfo
statusFlags
Returns

Definition at line 385 of file TTAudioEngine.cpp.

References TTAudioSignal::clear(), mNumInputChannels, mNumOutputChannels, and TTAudioSignal::mSampleVectors.

Referenced by TTAudioEngineStreamCallback().

+ Here is the call graph for this function:

TTErr TTAudioEngine::destroy ( )
static
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 458 of file TTAudioEngine.cpp.

References TTObjectBase::getReferenceCount(), Pa_GetErrorText(), Pa_Terminate(), TTLogError(), and TTObjectBaseRelease().

+ Here is the call graph for this function:

TTErr TTAudioEngine::getAvailableInputDeviceNames ( const TTValue unusedInput,
TTValue returnedDeviceNames 
)

Get the names of all available input devices.

Parameters
unusedInputNot used
returnedDeviceNamesUsed to return the names of all available input devices.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 243 of file TTAudioEngine.cpp.

References TTValue::append(), TTValue::clear(), kTTErrGeneric, kTTErrNone, Pa_GetDeviceCount(), and Pa_GetDeviceInfo().

+ Here is the call graph for this function:

TTErr TTAudioEngine::getAvailableOutputDeviceNames ( const TTValue unusedInput,
TTValue returnedDeviceNames 
)

Get the names of all available output devices.

Parameters
unusedInputNot used
returnedDeviceNamesUsed to return the names of all available output devices.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 265 of file TTAudioEngine.cpp.

References TTValue::append(), TTValue::clear(), kTTErrGeneric, kTTErrNone, Pa_GetDeviceCount(), and Pa_GetDeviceInfo().

+ Here is the call graph for this function:

TTErr TTAudioEngine::getCpuLoad ( const TTValue unusedInput,
TTValue returnedValue 
)

Monitor how taxing current audio processing is on the CPU.

Parameters
unusedInputNot used
returnedValueUsed to return current CPU load.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 234 of file TTAudioEngine.cpp.

References kTTErrNone, and Pa_GetStreamCpuLoad().

+ Here is the call graph for this function:

TTErr TTAudioEngine::getInputSignalReference ( TTValue anUnusedInput,
TTValue aReturnedAudioSignalPtr 
)

Get the reference pointer for the input signal.

Returns
The reference pointer for the input signal.

Definition at line 416 of file TTAudioEngine.cpp.

References kTTErrNone, and TTObjectBaseReference().

+ Here is the call graph for this function:

TTErr TTAudioEngine::getOutputSignalReference ( TTValue anUnusedInput,
TTValue aReturnedAudioSignalPtr 
)

Get the reference pointer for the output signal.

Returns
The reference pointer for the output signal.

Definition at line 423 of file TTAudioEngine.cpp.

References kTTErrNone, and TTObjectBaseReference().

+ Here is the call graph for this function:

TTErr TTAudioEngine::removeCallbackObserver ( const TTValue objectCurrentlyReceivingNotifications,
TTValue unusedOutput 
)
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 378 of file TTAudioEngine.cpp.

References kTTErrNone.

TTErr TTAudioEngine::setInputDevice ( TTValue newDeviceName)

Set what audio input device to use.

Parameters
newDeviceNameThe new audio input device to use.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 287 of file TTAudioEngine.cpp.

References initStream(), kTTErrGeneric, kTTErrNone, mInputDevice, mInputDeviceInfo, mIsRunning, mNumInputChannels, Pa_CloseStream(), Pa_GetDeviceCount(), and Pa_GetDeviceInfo().

+ Here is the call graph for this function:

TTErr TTAudioEngine::setOutputDevice ( TTValue newDeviceName)

Set what audio output device to use.

Parameters
newDeviceNameThe new audio output device to use.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 318 of file TTAudioEngine.cpp.

References initStream(), kTTErrGeneric, kTTErrNone, mIsRunning, mNumOutputChannels, mOutputDevice, mOutputDeviceInfo, Pa_CloseStream(), Pa_GetDeviceCount(), and Pa_GetDeviceInfo().

+ Here is the call graph for this function:

TTErr TTAudioEngine::setSampleRate ( TTValue newSampleRate)

Set the sample rate.

Parameters
newSampleRateThe new sample rate to use.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 360 of file TTAudioEngine.cpp.

References initStream(), kTTErrNone, mIsRunning, and mSampleRate.

+ Here is the call graph for this function:

TTErr TTAudioEngine::setVectorSize ( TTValue newVectorSize)

Set vector size.

Parameters
newVectorSizeThe new vector size to use.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 349 of file TTAudioEngine.cpp.

References initStream(), kTTErrNone, mIsRunning, and mVectorSize.

+ Here is the call graph for this function:

TTErr TTAudioEngine::start ( )

Start audio processing.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 202 of file TTAudioEngine.cpp.

References initStream(), mIsRunning, Pa_GetErrorText(), Pa_StartStream(), and TTLogError().

Referenced by initStream().

+ Here is the call graph for this function:

TTErr TTAudioEngine::stop ( )

Stop audio processing.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 220 of file TTAudioEngine.cpp.

References mIsRunning, Pa_GetErrorText(), Pa_StopStream(), and TTLogError().

Referenced by initStream().

+ Here is the call graph for this function:

Member Data Documentation

TTDictionaryPtr TTAudioEngine::sDictionary = NULL
static

We use a dictionary to map the singleton instance to a symbol.

Definition at line 75 of file TTAudioEngine.h.


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