Jamoma API
0.6.0.a19
|
Wrap TTMatrixBase instances. More...
#include <TTMatrix.h>
Public Member Functions | |
TTMatrix () | |
Constructor. | |
TTMatrixBase * | instance () const |
Get a pointer to the wrapped TTMatrixBase instance. More... | |
void | clear () |
Set all components of a matrix to zero. More... | |
void | referenceExternalData (TTPtr aDataPointer) |
You must proceed to set the various attributes, dimensions, etc. More... | |
TTByte * | getLockedPointer () |
Return a pointer to the matrix data, and lock the matrix so that others cannot access the data. More... | |
void | releaseLockedPointer () |
Release a locked pointer obtained using getLockedPointer(). More... | |
TTRowID | getRowCount () const |
Number of rows in the matrix. More... | |
TTColumnID | getColumnCount () const |
Number of columns in the matrix. More... | |
TTUInt32 | getComponentStride () const |
Return number of bytes from one the beginning one matrix component to the next. More... | |
template<typename T > | |
TTErr | get2d (TTRowID i, TTColumnID j, T &data) const |
Get the value of a component located at (i,j) in a 2-dimensional matrix. More... | |
template<typename T > | |
TTErr | get2d (TTRowID i, TTColumnID j, TTElementID e, T &data) const |
Get the value of element e of the component located at (i,j) in a 2-dimensional matrix. More... | |
template<typename T > | |
TTErr | set2d (TTRowID i, TTColumnID j, T data) |
Set the value of a component located at (i,j) in a 2-dimensional matrix. More... | |
template<typename T > | |
TTErr | set2d (TTRowID i, TTColumnID j, TTElementID e, T data) |
Set the value of element e of the component located at (i,j) in a 2-dimensional matrix. More... | |
Public Member Functions inherited from TTObject | |
TTObject (const TTSymbol aClassName, const TTValue arguments) | |
Constructor. More... | |
TTObject (const TTSymbol aClassName) | |
Constructor to create an empyt container which will be assigned/copied-to at a later point. | |
TTObject () | |
Constructor to create an empyt container which will be assigned/copied-to at a later point. | |
TTObject (TTObjectBase *anObjectBase) | |
Special constructor to create new object that wraps an existing TTObjectBase pointer. More... | |
TTObject (const TTObject &anObjectToCopy) | |
Copy constructor. | |
virtual | ~TTObject () |
Destructor. | |
TTObject & | operator= (TTObject object) |
Assign a TTObject instance to another TTObject. | |
TTObjectBase * | instance () const |
Return a direct pointer to the internal instance. More... | |
template<class T > | |
TTErr | set (const TTSymbol aName, T aValue) |
Set an attribute value for an object. More... | |
template<class T > | |
TTErr | get (const TTSymbol aName, T &aReturnedValue) const |
Get an attribute value for an object. More... | |
void | attributes (TTValue &returnedAttributeNames) const |
Return a list of names of the available attributes. More... | |
TTSymbol | attributeType (const TTSymbol aName) |
Return the type of an attribute as a symbol. More... | |
void | messages (TTValue &returnedMessageNames) const |
Return a list of names of the available messages. More... | |
TTSymbol | name () const |
Return the name of this class. More... | |
TTErr | send (const TTSymbol aName) |
Send a message to this object with no arguments. More... | |
TTValue | send (const TTSymbol aName, const TTValue &anInputValue) |
Send a message to this object with arguments. More... | |
TTErr | registerObserverForNotifications (const TTObject &anObservingObject) |
Register an observer. More... | |
TTErr | unregisterObserverForNotifications (const TTObject &anObservingObject) |
Unregister an observer for notifications. More... | |
TTBoolean | valid () const |
Determine if the object contained by this TTObject is truly ready for use. More... | |
void | track (TTBoolean newTrackingValue) |
Enable/Disable reference count tracking of the instance. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from TTObject | |
static TTErr | GetRegisteredClassNames (TTValue &classNames) |
Query TTEnvironment for names of all registered TTObjectBase classes. More... | |
static TTErr | GetRegisteredClassNamesForTags (TTValue &classNames, const TTValue &searchTags) |
Query TTEnvironment for names of all registered TTObjectBase classes that share specific tags. More... | |
static TTErr | GetRegisteredTags (TTValue &tags) |
Query TTEnvironment for all registered tags used by TTObjectBase classes. More... | |
Wrap TTMatrixBase instances.
Definition at line 27 of file TTMatrix.h.
void TTMatrix::clear | ( | ) |
Set all components of a matrix to zero.
Definition at line 18 of file TTMatrix.cpp.
References TTMatrixBase::clear(), and instance().
Referenced by TTMixer::clear().
TTErr TTMatrix::get2d | ( | TTRowID | i, |
TTColumnID | j, | ||
T & | data | ||
) | const |
Get the value of a component located at (i,j) in a 2-dimensional matrix.
Remember that the first component in the matrix is (0,0).
In order to provide some degree of efficiency, the data passed-in is not bounds checked – you must ensure that you are passing memory that is at least mComponentStride bytes large.
In fact, you should pass a compound type if you want more than one of the primitive types. For example, pass a pointer to a TTComplex if you want two doubles.
[in] | i | row in matrix of desired component |
[in] | j | column in matrix of desired component |
[out] | data | reference to where method should return value |
Definition at line 37 of file TTObjectTemplates.h.
References TTMatrixBase::get2d(), and instance().
Referenced by TTMultiMixer::processAudio(), TTMixer::processAudio(), TTMixer::processAudioInterpolated(), and TTMixer::restoreMatrix().
TTErr TTMatrix::get2d | ( | TTRowID | i, |
TTColumnID | j, | ||
TTElementID | e, | ||
T & | data | ||
) | const |
Get the value of element e of the component located at (i,j) in a 2-dimensional matrix.
Remember that the first component in the matrix is (0,0) and its first element is 0.
In order to provide some degree of efficiency, the data passed-in is not bounds checked – you must ensure that you are passing memory that is at least mComponentStride bytes large.
In fact, you should pass a compound type if you want more than one of the primitive types. For example, pass a pointer to a TTComplex if you want two doubles.
[in] | i | row in matrix of desired component |
[in] | j | column in matrix of desired component |
[in] | e | element within matrix component |
[out] | data | reference to where method should return value |
Definition at line 44 of file TTObjectTemplates.h.
References TTMatrixBase::get2d(), and instance().
TTColumnID TTMatrix::getColumnCount | ( | ) | const |
Number of columns in the matrix.
Definition at line 48 of file TTMatrix.cpp.
References TTMatrixBase::getColumnCount(), and instance().
Referenced by TTSoundfileLoader::setTargetMatrix().
TTUInt32 TTMatrix::getComponentStride | ( | ) | const |
Return number of bytes from one the beginning one matrix component to the next.
Definition at line 54 of file TTMatrix.cpp.
References TTMatrixBase::getComponentStride(), and instance().
TTByte * TTMatrix::getLockedPointer | ( | ) |
Return a pointer to the matrix data, and lock the matrix so that others cannot access the data.
If matrix is already locked, this function waits until it becomes free.
Definition at line 30 of file TTMatrix.cpp.
References TTMatrixBase::getLockedPointer(), and instance().
TTRowID TTMatrix::getRowCount | ( | ) | const |
Number of rows in the matrix.
Definition at line 42 of file TTMatrix.cpp.
References TTMatrixBase::getRowCount(), and instance().
Referenced by TTSoundfileLoader::setTargetMatrix().
|
inline |
Get a pointer to the wrapped TTMatrixBase instance.
Definition at line 37 of file TTMatrix.h.
Referenced by clear(), get2d(), getColumnCount(), getComponentStride(), getLockedPointer(), getRowCount(), referenceExternalData(), releaseLockedPointer(), set2d(), TTMixer::setNumInputs(), TTMixer::setNumOutputs(), and TTSoundfileLoader::setTargetMatrix().
void TTMatrix::referenceExternalData | ( | TTPtr | aDataPointer | ) |
You must proceed to set the various attributes, dimensions, etc.
to match the data format of the matrix you are referencing.
One caveat regards data alignment. Jitter, for example, aligns rows on 16-byte boundaries. In this case, a 4x10 matrix (using the m-by-n convention rather than Jitter's width-by-height convention) of 32-bit ints, all with a value of "4" will look like this:
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0
Thus, the rows are really of a dimension length 12 instead of 10 and the total size of the matrix scales as well.
For the time being, we do not handle this case. Jitter users must dimension their matrices so that the row size in bytes is a multiple of 16. This is not actually hard to do for most purposes. For example:
float64, element count of 1, width is a multiple of 2 (an even number) float32 or int32, element count of 1, width is a multiple of 4 uint8, element count of 1, width is a multiple of 16 (which includes 80, 160, 320, 640, ...), but element count of 4 (i.e. color pixels) width should be a multiple of values.
Definition at line 24 of file TTMatrix.cpp.
References instance(), and TTMatrixBase::referenceExternalData().
void TTMatrix::releaseLockedPointer | ( | ) |
Release a locked pointer obtained using getLockedPointer().
Definition at line 36 of file TTMatrix.cpp.
References instance(), and TTMatrixBase::releaseLockedPointer().
TTErr TTMatrix::set2d | ( | TTRowID | i, |
TTColumnID | j, | ||
T | data | ||
) |
Set the value of a component located at (i,j) in a 2-dimensional matrix.
Remember that the first component in the matrix is (0,0).
In order to provide some degree of efficiency, the data passed-in is not bounds checked – you must ensure that you are passing memory that is at least mComponentStride bytes large.
In fact, you should pass a compound type if you want more than one of the primitive types. For example, pass a pointer to a TTComplex if you want two doubles.
[in] | i | row in matrix of component to be set |
[in] | j | column in matrix of component to be set |
[out] | data | reference to where method should return value |
Definition at line 51 of file TTObjectTemplates.h.
References instance(), and TTMatrixBase::set2d().
Referenced by TTMixer::processAudioInterpolated(), TTMixer::restoreMatrix(), TTMultiMixer::setGain(), TTMixer::setGain(), TTMixer::setLinearGain(), and TTMixer::setMidiGain().
TTErr TTMatrix::set2d | ( | TTRowID | i, |
TTColumnID | j, | ||
TTElementID | e, | ||
T | data | ||
) |
Set the value of element e of the component located at (i,j) in a 2-dimensional matrix.
Remember that the first component in the matrix is (0,0) and its first element is 0.
In order to provide some degree of efficiency, the data passed-in is not bounds checked – you must ensure that you are passing memory that is at least mComponentStride bytes large.
In fact, you should pass a compound type if you want more than one of the primitive types. For example, pass a pointer to a TTComplex if you want two doubles.
[in] | i | row in matrix of component to be set |
[in] | j | column in matrix of component to be set |
[in] | e | element within matrix component |
[out] | data | reference to where method should return value |
Definition at line 58 of file TTObjectTemplates.h.
References instance(), and TTMatrixBase::set2d().