Jamoma API
0.6.0.a19
|
Container object that holds some audio in a chunk of memory. More...
#include <TTSampleMatrix.h>
Public Member Functions | |
TTErr | setNumChannels (const TTValue &newNumChannels) |
Attribute accessor: set the number of channels for this buffer. More... | |
TTErr | setLengthInSeconds (const TTValue &newLength) |
Attribute accessor: set the buffer length specified in seconds. More... | |
TTErr | setLengthInSamples (const TTValue &newLengthInSamples) |
Attribute accessor: set the buffer length specified as a number of samples. More... | |
TTErr | adaptTo (const TTSampleMatrix &anotherMatrix) |
Set dimensions, element count, datatype, etc. More... | |
TTErr | incrementUserCount () |
Increase the user count by one. More... | |
TTErr | decrementUserCount () |
Decrease the user count by one. More... | |
TTUInt16 | getUserCount () |
Report the current user count. More... | |
TTBoolean | isBufferPoolStage (TTBufferPoolStageEnum testValue) |
Test to see if current bufferPoolStage matches a test value. More... | |
TTErr | setBufferPoolStage (TTBufferPoolStageEnum newValue) |
Set the current bufferPoolStage to a new value. More... | |
TTErr | setValueAtIndex (const TTValue &index, TTValue &unusedOutput) |
Set the sample value for a given index. More... | |
TTErr | fill (const TTValue &value, TTValue &unusedOutput) |
Set the contents of the buffer using a specified algorithm and, if appropriate, coefficients for that algorithm. More... | |
TTErr | load (const TTValue &input, TTValue &unusedOutput) |
Load sample values from a soundfile into the TTSampleMatrix. More... | |
TTErr | resizeThenLoad (const TTValue &input, TTValue &unusedOutput) |
First, resize the TTSampleMatrix to match the number of channels and length in seconds found in a soundfile. More... | |
TTErr | normalize (const TTValue &aValue) |
Normalize the contents of a buffer. More... | |
virtual TTErr | test (TTValue &returnedTestInfo) |
Unit testing. | |
Public Member Functions inherited from TTMatrixBase | |
TTErr | setRowCount (const TTValue &aNewRowCount) |
Attribute accessor. More... | |
TTErr | setColumnCount (const TTValue &aNewColumnCount) |
Attribute accessor. More... | |
TTErr | setElementCount (const TTValue &newElementCount) |
Attribute accessor. More... | |
TTErr | setType (const TTValue &aType) |
Attribute accessor. More... | |
TTErr | setDimensions (const TTValue &someNewDimensions) |
Attribute accessor. More... | |
TTErr | setDimensionsWithVector (const std::vector< TTInt32 > &newDimensions) |
Alternative to attribute accessor. More... | |
TTRowID | getRowCount () |
Simple data accessor. More... | |
TTColumnID | getColumnCount () |
Simple data accessor. More... | |
TTElementID | getElementCount () |
Simple data accessor. More... | |
TTUInt32 | getComponentCount () |
Simple data accessor. More... | |
TTErr | getType (TTValue &returnedType) const |
Attribute accessor. More... | |
TTDataType | getTypeAsDataType () |
Simple data accessor. More... | |
TTSymbol | getTypeAsSymbol () |
Simple data accessor. More... | |
TTDataInfoPtr | getTypeAsDataInfo () |
Simple data accessor. More... | |
TTUInt32 | getDataCount () |
Simple data accessor. More... | |
TTUInt32 | getComponentStride () |
Simple data accessor. More... | |
TTErr | getDimensions (TTValue &returnedDimensions) const |
Legacy attribute accessor. More... | |
TTErr | clear () |
Set every element in the matrix to zero. More... | |
TTErr | fill (const TTValue &anInputValue, TTValue &anOutputValue) |
Fill every component in the matrix with the same value. More... | |
TTBoolean | makeRowIDInBounds (TTRowID &i, TTMatrixBaseOutOfBoundsHandler handler=outOfBoundsWrap) const |
Make sure a TTRowID is within the limits set by RowCount. More... | |
TTBoolean | makeColumnIDInBounds (TTColumnID &j, TTMatrixBaseOutOfBoundsHandler handler=outOfBoundsWrap) const |
Make sure a TTColumnID is within the limits set by ColumnCount. More... | |
TTBoolean | makeElementIDInBounds (TTElementID &e, TTMatrixBaseOutOfBoundsHandler handler=outOfBoundsWrap) const |
Make sure a TTElementID is within the limits set by ElementCount. More... | |
TTBoolean | makeInBounds (TTRowID &i, TTColumnID &j, TTMatrixBaseOutOfBoundsHandler handler=outOfBoundsWrap) const |
Make sure an (i,j) pair is within the limits set by RowCount & ColumnCount. More... | |
TTBoolean | makeInBounds (TTRowID &i, TTColumnID &j, TTElementID &e, TTMatrixBaseOutOfBoundsHandler handler=outOfBoundsWrap) const |
Make sure an (i,j,e) set is within the limits set by RowCount, ColumnCount & ElementCount. More... | |
TTErr | get (const TTValue &anInputValue, TTValue &anOutputValue) const |
Get the value of a component located at any location in 2-dimensional matrix. 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... | |
TTErr | set (const TTValue &anInputValue, TTValue &anOutputValue) |
Set the value of a component located at any location in an 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... | |
void | referenceExternalData (TTPtr aDataPointer) |
You must proceed to set the various attributes, dimensions, etc. More... | |
TTBytePtr | 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... | |
TTBoolean | allAttributesMatch (const TTMatrixBase &anotherMatrix) const |
Compare the attributes of this matrix to another to see if they all match. More... | |
TTErr | adaptTo (const TTMatrixBase &anotherMatrix) |
Set dimensions, element count, datatype, etc. More... | |
TTMatrixBase * | operator+ (const TTMatrixBase &B) const |
Add two matrices to produce a third matrix. More... | |
TTMatrixBase * | operator- (const TTMatrixBase &B) const |
Subtract matrix B from matrix A to produce matrix C. More... | |
Public Member Functions inherited from TTDataObjectBase | |
TTErr | calculate (const TTMatrixArray *inputs, TTMatrixArray *outputs) |
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 Attributes | |
TTUInt16 | mUserCount |
how many objects out there are currently using this TTSampleMatrix | |
Protected Attributes inherited from TTMatrixBase | |
TTBytePtr | mData |
memory used to store matrix values | |
TTRowID | mRowCount |
How many rows of values the matrix should have. Uses an signed 32-bit integer which provides a maximum value of 2,147,483,647. | |
TTColumnID | mColumnCount |
How many columns of values the matrix should have. Uses an signed 32-bit integer which provides a maximum value of 2,147,483,647. | |
TTElementID | mElementCount |
How many elements (parts) per value (e.g. 2 for complex numbers, 4 for colors, default = 1). Uses an signed 16-bit integer which provides a maximum value of 32,767. | |
TTUInt32 | mComponentCount |
mRowCount * mColumnCount | |
TTUInt32 | mComponentStride |
how many bytes from one the beginning one matrix component to the next | |
TTUInt32 | mDataCount |
mComponentCount * mElementCount (e.g. total number of floats or ints in the matrix) | |
TTDataType | mType |
member of global enumerated list #TTBase::TTDataType (i.e., kTypeUInt8, kTypeUInt16, kTypeInt32, kTypeUInt64, kTypeFloat32, kTypeFloat64) | |
TTDataInfoPtr | mTypeAsDataInfo |
pointer to info about the data type found in #TTBase::ttDataTypeInfo | |
TTSymbol | mTypeAsSymbol |
symbol with data type name for the public interface | |
TTUInt8 | mTypeSizeInBytes |
number of bytes present in mType | |
TTUInt32 | mDataSize |
mTypeSizeInBytes * mDataCount | |
TTBoolean | mDataIsLocallyOwned |
If false, then we are referencing outside memory which we don't own. | |
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? | |
TTMatrixArray * | mInputArray |
If the calculate method is passed a matrix, rather than an array of matrices, we wrap it in this array. | |
TTMatrixArray * | mOutputArray |
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 Types inherited from TTMatrixBase | |
typedef TTInt32(* | TTMatrixBaseOutOfBoundsHandler) (const TTInt32 index, const TTInt32 lowBound, const TTInt32 highBound) |
A function pointer for implementing handlers in the makeInBounds() method. More... | |
typedef void(* | TTMatrixBaseIterator) (TTPtr c, const TTPtr a, const TTPtr b) |
A function pointer for implementing iterators used in the iterate() method. More... | |
Static Public Member Functions inherited from TTMatrixBase | |
static TTInt32 | outOfBoundsClip (const TTInt32 index, const TTInt32 lowBound, const TTInt32 highBound) |
In implementation of the TTMatrixBaseOutOfBoundsHandler that wraps #TTClip. More... | |
static TTInt32 | outOfBoundsWrap (const TTInt32 index, const TTInt32 lowBound, const TTInt32 highBound) |
In implementation of the TTMatrixBaseOutOfBoundsHandler that wraps #TTInfWrap. More... | |
static TTInt32 | outOfBoundsFold (const TTInt32 index, const TTInt32 lowBound, const TTInt32 highBound) |
In implementation of the TTMatrixBaseOutOfBoundsHandler that wraps #TTFold. More... | |
static TTErr | copy (const TTMatrixBase &source, TTMatrixBase &dest) |
Copy the data from one matrix into another. More... | |
static TTErr | iterate (TTMatrixBase *C, const TTMatrixBase *A, const TTMatrixBase *B, TTMatrixBaseIterator iterator) |
Step through every component in the matrix A and B to produce matrix C using the specified iterator method. More... | |
static TTErr | iterateWhenAllAttributesMatch (TTMatrixBase *C, const TTMatrixBase *A, const TTMatrixBase *B, TTMatrixBaseIterator iterator) |
Only if all the attributes of matrix A and B match, then step through every component to produce matrix C using the specified iterator method. More... | |
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 TTMatrixBase | |
TTErr | resize () |
Internal method that resizes memory allocated when various attributes change. More... | |
TTBoolean | setRowCountWithoutResize (TTRowID aNewRowCount) |
Internal method that sets the value for RowCount without resizing the matrix of values. More... | |
TTBoolean | setColumnCountWithoutResize (TTColumnID aNewColumnCount) |
Internal method that sets the value for ColumnCount without resizing the matrix of values. More... | |
TTBoolean | setElementCountWithoutResize (TTElementID aNewElementCount) |
Internal method that sets the value for ElementCount without resizing the matrix of values. More... | |
TTBoolean | setTypeWithoutResize (TTDataType aNewType) |
Internal method that sets the values for type-related variables without resizing the matrix of values. 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... | |
Container object that holds some audio in a chunk of memory.
SampleMatrix extends the Matrix class found in Foundation to provide support for loading audio into a chunk of memory. Each sample value is stored as a one-element component with a datatype of 64-bit Float. Locations for individual components in the matrix can be identified by (sample, channel) pairs where samples correspond to rows in the matrix and channels translate to columns.
@see TTAudioSignal, TTMatrix
Definition at line 50 of file TTSampleMatrix.h.
TTErr TTSampleMatrix::adaptTo | ( | const TTSampleMatrix & | anotherMatrix | ) |
Set dimensions, element count, datatype, etc.
(i.e. the metadata describing a matrix) to match the another matrix which is passed-in as an argument. Overrides the TTMatrix method so that sample rate is set as well.
anotherMatrix | sample matrix to which you would like to conform the attributes of this one |
Definition at line 118 of file TTSampleMatrix.cpp.
References TTMatrixBase::adaptTo().
TTErr TTSampleMatrix::decrementUserCount | ( | ) |
Decrease the user count by one.
The userCount member is used to track usage of an individual TTSampleMatrix. When another object makes use of a specific matrix, the code should use this method to decrease the reference counter at the conclusion of use.
Definition at line 133 of file TTSampleMatrix.cpp.
References kTTErrGeneric, kTTErrNone, and mUserCount.
Referenced by test().
Set the contents of the buffer using a specified algorithm and, if appropriate, coefficients for that algorithm.
Definition at line 254 of file TTSampleMatrix.cpp.
References kTTErrNone, kTTTwoPi, and TTMatrixBase::set2d().
|
inline |
Report the current user count.
The userCount member is used to track usage of an individual TTSampleMatrix.
Definition at line 110 of file TTSampleMatrix.h.
TTErr TTSampleMatrix::incrementUserCount | ( | ) |
Increase the user count by one.
The userCount member is used to track usage of an individual TTSampleMatrix. When another object makes use of a specific matrix, the code should use this method to increase the user counter prior to the start of use.
Definition at line 125 of file TTSampleMatrix.cpp.
References kTTErrNone, and mUserCount.
Referenced by test().
|
inline |
Test to see if current bufferPoolStage matches a test value.
The bufferPoolStage member is used when TTSampleMartix is part of a pool available in TTBuffer. This methods allows you to check the current stage against a test value. It is useful in setting up conditional statements.
test_value | any option defined in the bufferPoolStageEnum |
Definition at line 121 of file TTSampleMatrix.h.
Referenced by test().
Load sample values from a soundfile into the TTSampleMatrix.
This method is dependant on the SoundfileLib extension which handles operations on sound files using third-party libraries.
[in] | input | Multi-item TTValue used to set the copy parameters:
|
[out] | unusedOutput | not used |
Definition at line 337 of file TTSampleMatrix.cpp.
References kTTErrInstantiateFailed, TTValue::prepend(), and TTObject::send().
Normalize the contents of a buffer.
If no arg is passed, then the buffer is normalized to 1.0. Otherwise it is normalized to the passed value.
Definition at line 386 of file TTSampleMatrix.cpp.
References TTMatrixBase::getLockedPointer(), kTTErrNone, TTMatrixBase::releaseLockedPointer(), and TTValue::size().
First, resize the TTSampleMatrix to match the number of channels and length in seconds found in a soundfile.
Then, load the soundfile into the TTSampleMatrix. Sample rate of the TTSampleMatrix is not changed by this operation and interpolation will be applied to the loaded soundfile to acheive the necessary sample rate.
Definition at line 364 of file TTSampleMatrix.cpp.
References kTTErrInstantiateFailed, TTValue::prepend(), and TTObject::send().
|
inline |
Set the current bufferPoolStage to a new value.
The bufferPoolStage member is used when TTSampleMartix is part of a pool available in TTBuffer. This methods allows you to set the current stage with a new value.
test_value | any option defined in the bufferPoolStageEnum |
Definition at line 132 of file TTSampleMatrix.h.
References kTTErrNone.
Referenced by test().
Attribute accessor: set the buffer length specified as a number of samples.
Definition at line 105 of file TTSampleMatrix.cpp.
References TTMatrixBase::setRowCount().
Referenced by test().
Attribute accessor: set the buffer length specified in seconds.
Definition at line 91 of file TTSampleMatrix.cpp.
References TTMatrixBase::setRowCount().
Attribute accessor: set the number of channels for this buffer.
Definition at line 78 of file TTSampleMatrix.cpp.
References TTMatrixBase::setColumnCount().
Set the sample value for a given index.
The first number passed in the index parameter will be interpreted as the sample index. If there are three numbers passed, then the second number, if passed, will designate the channel index (defaults to zero). The final value will be used as the sample value that will be copied to the designated index.
Definition at line 219 of file TTSampleMatrix.cpp.
References TTValue::size().