Jamoma API  0.6.0.a19
TTAudioGraphObjectBase Class Reference

The TTAudioGraphObjectBase wraps a TTDSP object such that it is possible to build a dynamic graph of audio processing units. More...

#include <TTAudioGraphObject.h>

+ Inheritance diagram for TTAudioGraphObjectBase:
+ Collaboration diagram for TTAudioGraphObjectBase:

Public Member Functions

TTAudioObjectgetUnitGenerator ()
 ...
 
void addAudioFlag (TTAudioGraphFlags flag)
 Set an audio flag. More...
 
void removeAudioFlag (TTAudioGraphFlags flag)
 remove an audio flag. More...
 
TTChannelCount getOutputNumChannels (TTUInt16 forOutletNumber)
 Get the number of channels for an outlet. More...
 
void setOutputNumChannels (TTUInt16 forOutletNumber, TTChannelCount numChannels)
 Set the number of channels for an outlet. More...
 
TTUInt16 getOutputVectorSize (TTUInt16 forOutletNumber)
 Get the vector size for an outlet. More...
 
TTUInt32 getOutputSampleRate (TTUInt16 forOutletNumber)
 Get the sample rate of the audio passed from one of the outlets. More...
 
TTUInt32 getSampleRate ()
 Get the sample rate that this object use when processing audio. More...
 
void prepareAudioDescription ()
 Prepare for a request to descibe all of the graph.
 
void getAudioDescription (TTAudioGraphDescription &desc)
 Describe this object as part of the action of describing a complete audio graph. More...
 
TTErr resetAudio ()
 Clear the list of source objects from which this object will try to pull audio. More...
 
TTErr connectAudio (TTAudioGraphObjectBasePtr anObject, TTUInt16 fromOutletNumber=0, TTUInt16 toInletNumber=0)
 Add a source to the list of objects from which to request audio. More...
 
TTErr dropAudio (TTAudioGraphObjectBasePtr anObject, TTUInt16 fromOutletNumber=0, TTUInt16 toInletNumber=0)
 Drop a source from the list of objects from which to request audio. More...
 
void lockProcessing ()
 The thread protection for processing is important: we cannot have the graph nodes being deleted or re-arranged while we are pulling. More...
 
void unlockProcessing ()
 The thread protection for processing is important: we cannot have the graph nodes being deleted or re-arranged while we are pulling. More...
 
virtual TTErr preprocess (const TTAudioGraphPreprocessData &initData)
 This method is called by an object about to process audio, prior to calling getAudioOutput(). More...
 
virtual TTErr process (TTAudioSignalPtr &returnedSignal, TTUInt64 sampleStamp, TTUInt16 forOutletNumber=0)
 This method is required to be implemented by all objects except for those existing solely as a destination. More...
 
- Public Member Functions inherited from TTGraphObjectBase
TTErr reset ()
 Clear the lists of connected objects. More...
 
TTErr connect (TTGraphObjectBasePtr anObject, TTUInt16 fromOutletNumber=0, TTUInt16 toInletNumber=0)
 Add a source to the list of objects from which to request audio. More...
 
TTErr drop (TTGraphObjectBasePtr anObject, TTUInt16 fromOutletNumber=0, TTUInt16 toInletNumber=0)
 Drop a source from the list of objects from which to request audio. More...
 
- Public Member Functions inherited from TTDataObjectBase
TTErr calculate (const TTMatrixArray *inputs, TTMatrixArray *outputs)
 
virtual TTErr test (TTValue &)
 [doxygenChapter60_virtualMethod] 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...
 

Protected Member Functions

TTErr setNumAudioInlets (const TTValue &newNumInlets)
 Set the number of audio inlets. More...
 
TTErr setNumAudioOutlets (const TTValue &newNumOutlets)
 Set the number of audio outlets. More...
 
- Protected Member Functions inherited from TTDataObjectBase
 TTDataObjectBase (const TTValue &arguments)
 Object constructor. More...
 
virtual ~TTDataObjectBase ()
 Object destructor. More...
 
TTErr setMatrixCalculate (TTMatrixCalculateMethod newMatrixCalculateMethod)
 Set the sample calculate routine to point to a method that is defined as an arg to this function. More...
 
TTErr setBypass (const TTValue &value)
 Bypass the audio processing routine and copy all input samples to the output unchanged. More...
 
TTErr bypassMatrixCalculate (const TTMatrixArray *inputs, TTMatrixArray *outputs)
 Built-in method to be used when calculation is to bypassed. More...
 
TTErr defaultMatrixCalculateMethod (const TTMatrixArray *inputs, TTMatrixArray *outputs)
 The default calculation method to use. More...
 
TTErr resetBenchmarking ()
 Reset internal values used when benchmarking performance. More...
 
TTErr getProcessingBenchmark (TTValueRef v)
 Do performance benchmarking. More...
 
- Protected Member Functions inherited from TTObjectBase
 TTObjectBase (const TTValue arguments)
 Constructor. More...
 

Protected Attributes

TTAudioGraphProcessStatus mStatus
 Used to enable correct processing of feedback loops, multiple destinations, etc.
 
TTAudioGraphDescription mAudioDescription
 Used to prevent feedback loops etc. when describing a graph.
 
TTUInt32 mAudioFlags
 A bitmask of values defined in TTAudioGraphFlags.
 
TTAudioGraphInletVector mAudioInlets
 The inlets through which we pull audio from sources.
 
TTAudioGraphOutletVector mAudioOutlets
 The outlets that processed audio sampled will be passed to.
 
TTUInt32 mNumAudioInlets
 Attribute: The number of inputs for this object.
 
TTUInt32 mNumAudioOutlets
 Attribute: The number of outlets for this object.
 
TTAudioArray mInputSignals
 The buffered input for processing audio with our object.
 
TTAudioArray mOutputSignals
 The results of processing audio with our object, buffered for objects requesting it.
 
TTUInt16 mVectorSize
 The most recent vector size info passed from the terminal object during a preprocess.
 
TTUInt64 mSampleStamp
 The current time in samples, as determined from the pulling of this object.
 
- Protected Attributes inherited from TTGraphObjectBase
TTGraphInletVector mInlets
 The inlets through which we pull audio from sources.
 
TTGraphOutletVector mOutlets
 The inlets through which we pull audio from sources.
 
TTGraphDescription mDescription
 our copy of the data, from which we pass out references to the outlets More...
 
- Protected Attributes inherited from TTDataObjectBase
TTMatrixCalculateMethod mMatrixCalculateMethod
 This function pointer points to the active (non-bypass) calculate routine.
 
TTMatrixCalculateMethod mCurrentMatrixCalculateMethod
 This function pointer always points to the current calculate routine.
 
TTBoolean mBypass
 Are we bypassing the matrix calculation?
 
TTMatrixArraymInputArray
 If the calculate method is passed a matrix, rather than an array of matrices, we wrap it in this array.
 
TTMatrixArraymOutputArray
 If the calculate method is passed a matrix, rather than an array of matrices, we wrap it in this array.
 
TTFloat64 mStartProcessingTime
 The time at which this object's process method was last invoked (for benchmarking)
 
TTFloat64 mAccumulatedProcessingTime
 The amount of time spent in this object's process method (for benchmarking)
 
TTFloat64 mAccumulatedProcessingCalls
 The number of times the process method has been called (for benchmarking)
 
TTPtrSizedInt mReserved1
 Reserved – May be used for something in the future without changing the size of the struct.
 
TTPtrSizedInt mReserved2
 Reserved – May be used for something in the future without changing the size of the struct.
 
- Protected Attributes inherited from TTObjectBase
TTList observers
 List of all objects watching this object for life-cycle and other changes.
 

Static Protected Attributes

static TTMutexPtr sSharedMutex = NULL
 A critical region shared by all TTAudioGraphObjectBases to prevent changes to the graph while processing.
 

Additional Inherited Members

- Public Attributes inherited from TTGraphObjectBase
TTObject mKernel
 The actual TT object doing the processing.
 
- 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...
 

Detailed Description

The TTAudioGraphObjectBase wraps a TTDSP object such that it is possible to build a dynamic graph of audio processing units.

It is implemented as a TTObjectBase so that it can receive dynamically bound messages, including notifications from other objects.

Definition at line 36 of file TTAudioGraphObject.h.

Member Function Documentation

void TTAudioGraphObjectBase::addAudioFlag ( TTAudioGraphFlags  flag)
inline

Set an audio flag.

Flags are defined as bitmasks.

Parameters
flagThe flag to set.

Definition at line 90 of file TTAudioGraphObject.h.

TTErr TTAudioGraphObjectBase::connectAudio ( TTAudioGraphObjectBasePtr  anObject,
TTUInt16  fromOutletNumber = 0,
TTUInt16  toInletNumber = 0 
)

Add a source to the list of objects from which to request audio.

Parameters
anObjectThe Jamoma AudioGraph object which is supplying us with input.
anInletNumberIf this object has a second input mechanism (e.g. a sidechain input), then that is indicated here. Typically the value passed here will be 0, indicating the normal audio input.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 161 of file TTAudioGraphObject.cpp.

References mAudioInlets, setNumAudioInlets(), and sSharedMutex.

+ Here is the call graph for this function:

TTErr TTAudioGraphObjectBase::dropAudio ( TTAudioGraphObjectBasePtr  anObject,
TTUInt16  fromOutletNumber = 0,
TTUInt16  toInletNumber = 0 
)

Drop a source from the list of objects from which to request audio.

In other words, disconnect.

Parameters
anObjectThe Jamoma AudioGraph object which is supplying us with input.
anInletNumberIf this object has a second input mechanism (e.g. a sidechain input), then that is indicated here. Typically the value passed here will be 0, indicating the normal audio input.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 182 of file TTAudioGraphObject.cpp.

References TTGraphObjectBase::drop(), kTTErrInvalidValue, mAudioInlets, and sSharedMutex.

+ Here is the call graph for this function:

void TTAudioGraphObjectBase::getAudioDescription ( TTAudioGraphDescription desc)

Describe this object as part of the action of describing a complete audio graph.

The node is requested to declare itself as part of an action to describe all of the audio graph. As part of this action the request is also propagated to its upstream neighboors, and retrieved information on the graph is passed back down again to the sink(s) of the graph.

Parameters
descsPointer to the graph description vector used by the downstream neighboor(s) to retrieve information on this node and its upstesream connections.

Definition at line 125 of file TTAudioGraphObject.cpp.

References mAudioDescription, mAudioInlets, TTGraphDescription::mID, TTGraphObjectBase::mInlets, TTGraphObjectBase::mKernel, TTGraphObjectBase::mOutlets, TTObject::name(), and TTGraphDescription::sIndex.

Referenced by TTAudioGraphSource::getDescription().

+ Here is the call graph for this function:

TTChannelCount TTAudioGraphObjectBase::getOutputNumChannels ( TTUInt16  forOutletNumber)
inline

Get the number of channels for an outlet.

Parameters
forOutletNumberThe outlet that we want to retrieve informaiton about.

Definition at line 108 of file TTAudioGraphObject.h.

TTUInt32 TTAudioGraphObjectBase::getOutputSampleRate ( TTUInt16  forOutletNumber)
inline

Get the sample rate of the audio passed from one of the outlets.

Parameters
forOutletNumberThe outlet that we want to retrieve information about.
Thesample rate of the audio passed from the outlet.

Definition at line 153 of file TTAudioGraphObject.h.

TTUInt16 TTAudioGraphObjectBase::getOutputVectorSize ( TTUInt16  forOutletNumber)
inline

Get the vector size for an outlet.

Parameters
forOutletNumberThe outlet that we want to retrieve information about.
Returns
Vector size.

Definition at line 140 of file TTAudioGraphObject.h.

TTUInt32 TTAudioGraphObjectBase::getSampleRate ( )
inline

Get the sample rate that this object use when processing audio.

Returns
The current sample rate of the object.

Definition at line 165 of file TTAudioGraphObject.h.

void TTAudioGraphObjectBase::lockProcessing ( )
inline

The thread protection for processing is important: we cannot have the graph nodes being deleted or re-arranged while we are pulling.

Further more, this is true for the entire process cycle: preprocess, process, and postprocess. Thus, this lock must be thrown by the code the is calling the methods from outside of this class.

Definition at line 215 of file TTAudioGraphObject.h.

Referenced by TTAudioGraphOutput::audioEngineWillProcess().

TTErr TTAudioGraphObjectBase::preprocess ( const TTAudioGraphPreprocessData initData)
virtual

This method is called by an object about to process audio, prior to calling getAudioOutput().

As with the getAudioOutput() method, this is driven by the destination object and working up through the chains.

Parameters
initDataData provided by the terminal object so that the graph will be able to adapt to it.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 194 of file TTAudioGraphObject.cpp.

References kTTAudioGraphGenerator, kTTAudioGraphProcessNotStarted, kTTErrNone, TTObjectBase::lock(), mAudioFlags, mAudioInlets, mAudioOutlets, mInputSignals, mOutputSignals, mStatus, mVectorSize, TTObjectBase::unlock(), TTObjectBase::valid, and TTAudioGraphPreprocessData::vectorSize.

Referenced by TTAudioGraphOutput::audioEngineWillProcess(), and TTAudioGraphSource::preprocess().

+ Here is the call graph for this function:

TTErr TTAudioGraphObjectBase::process ( TTAudioSignalPtr returnedSignal,
TTUInt64  sampleStamp,
TTUInt16  forOutletNumber = 0 
)
virtual

This method is required to be implemented by all objects except for those existing solely as a destination.

Parameters
audioOutputThis method is passed a reference to an audio signal pointer. We then set this audio signal pointer to point to the TTAudioSignal containing our calculated samples.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 230 of file TTAudioGraphObject.cpp.

References TTAudioObject::adaptMaxChannelCount(), getUnitGenerator(), kTTAudioGraphGenerator, kTTAudioGraphNonAdapting, kTTAudioGraphProcessComplete, kTTAudioGraphProcessingCurrently, kTTAudioGraphProcessNotStarted, kTTErrGeneric, kTTErrNone, TTObjectBase::lock(), mAudioFlags, mAudioInlets, mInputSignals, mOutputSignals, mSampleStamp, mStatus, TTAudioObject::setSampleRate(), and TTObjectBase::unlock().

Referenced by TTAudioGraphOutput::audioEngineWillProcess(), and TTAudioGraphSource::process().

+ Here is the call graph for this function:

void TTAudioGraphObjectBase::removeAudioFlag ( TTAudioGraphFlags  flag)
inline

remove an audio flag.

Flags are defined as bitmasks.

Parameters
flagThe flag to remove.

Definition at line 99 of file TTAudioGraphObject.h.

TTErr TTAudioGraphObjectBase::resetAudio ( )

Clear the list of source objects from which this object will try to pull audio.

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

Definition at line 152 of file TTAudioGraphObject.cpp.

References kTTErrNone, mAudioInlets, TTAudioGraphInlet::reset(), and sSharedMutex.

+ Here is the call graph for this function:

TTErr TTAudioGraphObjectBase::setNumAudioInlets ( const TTValue newNumInlets)
protected

Set the number of audio inlets.

Parameters
newNumInletsThe number of inlets. Each inlet can receieve multichannel signals from several sources.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 87 of file TTAudioGraphObject.cpp.

References kTTErrNone, mAudioInlets, mInputSignals, and mNumAudioInlets.

Referenced by connectAudio().

TTErr TTAudioGraphObjectBase::setNumAudioOutlets ( const TTValue newNumOutlets)
protected

Set the number of audio outlets.

Parameters
newNumOutletsThe number of outlets. Each outlet can pass on multichannel signals to inlets of one or more downstream TTAudioGraphObjectBases.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 99 of file TTAudioGraphObject.cpp.

References kTTErrNone, mAudioOutlets, mNumAudioOutlets, and mOutputSignals.

void TTAudioGraphObjectBase::setOutputNumChannels ( TTUInt16  forOutletNumber,
TTChannelCount  numChannels 
)
inline

Set the number of channels for an outlet.

Parameters
forOutletNumberThe outlet that we want to set information for.
numChannelsThe number of channels that the audio signal from this outlet is to have.

Definition at line 121 of file TTAudioGraphObject.h.

void TTAudioGraphObjectBase::unlockProcessing ( )
inline

The thread protection for processing is important: we cannot have the graph nodes being deleted or re-arranged while we are pulling.

Further more, this is true for the entire process cycle: preprocess, process, and postprocess. Thus, this lock must be thrown by the code the is calling the methods from outside of this class.

Definition at line 223 of file TTAudioGraphObject.h.

Referenced by TTAudioGraphOutput::audioEngineWillProcess().


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