Jamoma API  0.6.0.a19
TTDataObjectBase Class Reference

TTDataObjectBase is the base class for all data generating and processing objects. More...

#include <TTDataObjectBase.h>

Inherits TTObjectBase.

Inherited by AngleDataspace, AxisUnit, BarkUnit, BpmUnit, Cartesian2DUnit, Cartesian3DUnit, CelsiusUnit, CentimeterUnit, CentUnit, CMYUnit, ColorDataspace, CylindricalUnit, DecibelUnit, DegreeUnit, DistanceDataspace, EulerUnit, FahrenheitUnit, FootPerSecondUnit, FootUnit, FrequencyUnit, GainDataspace, HSLUnit, HSVUnit, InchUnit, KelvinUnit, KilometerPerHourUnit, KnotUnit, LinearAmplitudeUnit, MelUnit, MeterPerSecondUnit, MeterUnit, MidiGainUnit, MidiPitchUnit, MilesPerHourUnit, MillisecondUnit, NoneDataspace, NoneUnit, OpenGlUnit, OrientationDataspace, PolarUnit, PositionDataspace, QuaternionUnit, RadianUnit, RGB8Unit, RGBUnit, SampleUnit, SecondUnit, SpeedDataspace, SpeedUnit, SphericalUnit, TemperatureDataspace, TimeDataspace, TTAudioSignal, TTAudioSignalArray, TTDataspaceConverter, TTDictionaryAppend, TTDictionaryTest, TTGraphInput, TTGraphObjectBase, TTGraphOutput, TTInterpolateTest, TTListTest, TTMatrixBase, TTMatrixGain, TTMatrixStencil, TTMidiFilter [private], TTMidiFormat [private], TTMidiInput [private], TTMidiOutput [private], TTNetReceive, TTNetSend, TTNodeLibTest, TTObjectTest, TTOscReceive, TTOscSend, TTParameter, TTRegexTest, TTStringTest, TTSymbolTest, TTValueTest, TTWebReceive, and TTWebSend.

+ Collaboration diagram for TTDataObjectBase:

Public Member Functions

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

 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

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.
 

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...
 

Detailed Description

TTDataObjectBase is the base class for all data generating and processing objects.

It still has knowledge and support for sample-rates, but not channel counts or vector processing.

Definition at line 41 of file TTDataObjectBase.h.

Constructor & Destructor Documentation

TTDataObjectBase::TTDataObjectBase ( const TTValue arguments)
protected

Object constructor.

Parameters
argumentsArguments to the constructor method.

Definition at line 23 of file TTDataObjectBase.cpp.

References TTEnvironment::createInstance(), defaultMatrixCalculateMethod(), getProcessingBenchmark(), kTTMessagePassNone, kTypeBoolean, mBypass, mInputArray, mOutputArray, TTObjectBase::registerAttribute(), TTObjectBase::registerMessage(), resetBenchmarking(), TTObjectBase::setAttributeValue(), setBypass(), setMatrixCalculate(), test(), and ttEnvironment.

+ Here is the call graph for this function:

TTDataObjectBase::~TTDataObjectBase ( )
protectedvirtual

Object destructor.

Definition at line 51 of file TTDataObjectBase.cpp.

References mInputArray, mOutputArray, TTEnvironment::releaseInstance(), and ttEnvironment.

+ Here is the call graph for this function:

Member Function Documentation

TTErr TTDataObjectBase::bypassMatrixCalculate ( const TTMatrixArray inputs,
TTMatrixArray outputs 
)
protected

Built-in method to be used when calculation is to bypassed.

It simply copied input to output.

Parameters
inputInput the calculation routine.
outputOutput from the calculation routine.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 86 of file TTDataObjectBase.cpp.

References TTMatrixBase::clear(), TTMatrixBase::copy(), and kTTErrNone.

Referenced by defaultMatrixCalculateMethod(), and setBypass().

+ Here is the call graph for this function:

TTErr TTDataObjectBase::calculate ( const TTMatrixArray inputs,
TTMatrixArray outputs 
)
Parameters
inputInput the calculation routine.
outputOutput from the calculation routine.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 108 of file TTDataObjectBase.cpp.

References kTTErrGeneric, TTObjectBase::lock(), mAccumulatedProcessingCalls, mAccumulatedProcessingTime, TTEnvironment::mBenchmarking, mCurrentMatrixCalculateMethod, mStartProcessingTime, ttEnvironment, TTGetTimeInMicroseconds(), TTObjectBase::unlock(), and TTObjectBase::valid.

+ Here is the call graph for this function:

TTErr TTDataObjectBase::defaultMatrixCalculateMethod ( const TTMatrixArray inputs,
TTMatrixArray outputs 
)
protected

The default calculation method to use.

Parameters
inputInput the calculation routine.
outputOutput from the calculation routine.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 102 of file TTDataObjectBase.cpp.

References bypassMatrixCalculate().

Referenced by setBypass(), and TTDataObjectBase().

+ Here is the call graph for this function:

TTErr TTDataObjectBase::getProcessingBenchmark ( TTValueRef  v)
protected

Do performance benchmarking.

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

Definition at line 164 of file TTDataObjectBase.cpp.

References kTTErrNone, mAccumulatedProcessingCalls, and mAccumulatedProcessingTime.

Referenced by TTDataObjectBase().

TTErr TTDataObjectBase::resetBenchmarking ( )
protected

Reset internal values used when benchmarking performance.

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

Definition at line 155 of file TTDataObjectBase.cpp.

References kTTErrNone, mAccumulatedProcessingCalls, mAccumulatedProcessingTime, and mStartProcessingTime.

Referenced by TTDataObjectBase().

TTErr TTDataObjectBase::setBypass ( const TTValue value)
protected

Bypass the audio processing routine and copy all input samples to the output unchanged.

Parameters
valueSet bypass property for the object, controling whether matrix calculation will be bypassed.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 67 of file TTDataObjectBase.cpp.

References bypassMatrixCalculate(), defaultMatrixCalculateMethod(), kTTErrNone, mBypass, mCurrentMatrixCalculateMethod, and mMatrixCalculateMethod.

Referenced by TTDataObjectBase().

+ Here is the call graph for this function:

TTErr TTDataObjectBase::setMatrixCalculate ( TTMatrixCalculateMethod  newMatrixCalculateMethod)
protected

Set the sample calculate routine to point to a method that is defined as an arg to this function.

Parameters
newMatrixCalculateMethodThe new matrix calculation method to use.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 58 of file TTDataObjectBase.cpp.

References kTTErrNone, mBypass, mCurrentMatrixCalculateMethod, and mMatrixCalculateMethod.

Referenced by TTDataObjectBase().

virtual TTErr TTDataObjectBase::test ( TTValue )
inlinevirtual

[doxygenChapter60_virtualMethod]

Default (empty) template for unit tests.

Parameters
returnedTestInfoReturned information on the outcome of the unit test(s)
Returns
kTTErrNone if tests exists and they all pass, else TTErr error codes depending on the outcome of the test.

Reimplemented in TTSampleMatrix, and TTMatrixBase.

Definition at line 125 of file TTDataObjectBase.h.

References kTTErrGeneric, and TTObjectBase::logMessage().

Referenced by TTDataObjectBase().

+ Here is the call graph for this function:


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