Jamoma API
0.6.0.a19
|
The TTAudioSignal class represents N vectors of audio samples for M channels. More...
#include <TTAudioSignal.h>
Public Member Functions | |
TTAudioSignal (const TTAudioSignal &original) | |
Copy constructor. More... | |
TTErr | setMaxNumChannels (const TTValue &newMaxNumChannels) |
Attribute accessor. More... | |
TTErr | setVector (const TTChannelCount channel, const TTUInt16 vectorSize, const TTSampleValuePtr newVector) |
[doxygenAppendixC_methodExample] More... | |
TTErr | setVector64Copy (const TTChannelCount channel, const TTUInt16 vectorSize, const TTSampleValuePtr newVector) |
[doxygenAppendixC_methodExample] | |
TTErr | setVector (const TTChannelCount channel, const TTUInt16 vectorSize, const TTFloat32 *newVector) |
This version handles vector assignments from 32-bit vectors. | |
TTErr | alloc () |
Allocate memory for all channels at the current vectorsize. | |
TTErr | allocWithNewChannelCount (TTChannelCount newChannelCount) |
Allocate memory for a given number of channels, setting MaxChannelCount, at the current vector size. More... | |
TTErr | allocWithVectorSize (const TTUInt16 newVectorSize) |
Allocate memory for all channels at the specified vectorsize, if the vectorsize is different from the current state. | |
TTErr | clear () |
Zero out all of the sample values in the audio signal. More... | |
TTAudioSignal & | operator+= (const TTAudioSignal &rightHandValue) |
Sum another audio signal's samples with this audio signal's samples. | |
TTAudioSignal & | operator= (const TTAudioSignal &rightHandValue) |
Assign another audio signal's samples and channel/vector configuration with this audio signal's samples. 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... | |
Static Public Member Functions | |
static TTErr | reference (const TTAudioSignal &source, TTAudioSignal &dest) |
Reference the audio from one signal in another. More... | |
static TTErr | copy (const TTAudioSignal &source, TTAudioSignal &dest, TTChannelCount channelOffset=0) |
Copy the audio from one signal into another. More... | |
static TTErr | copyDirty (const TTAudioSignal &source, TTAudioSignal &dest, TTChannelCount channelOffset=0) |
Copy the audio from one signal into another, but not taking care to zero channels that aren't used. More... | |
static TTErr | copySubset (const TTAudioSignal &source, TTAudioSignal &dest, TTChannelCount startingChannel=0, TTChannelCount endingChannel=0) |
Copy the audio from one signal into another. More... | |
static TTChannelCount | getMinChannelCount (const TTAudioSignal &signal1, const TTAudioSignal &signal2) |
Use this class method to determine the least number of channels the two signals have in common. More... | |
static TTChannelCount | getMinChannelCount (const TTAudioSignal &signal1, const TTAudioSignal &signal2, const TTAudioSignal &signal3) |
Use this class method to determine the least number of channels the specified signals have in common. More... | |
static TTChannelCount | getNumChannels (const TTAudioSignal &signal) |
Use this class method to determine the number of channels of an input or output signal. More... | |
Public Attributes | |
TTSampleValue ** | mSampleVectors |
An array of pointers to the first sample in each vector. Declared Public for fast access. | |
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... | |
Additional Inherited Members | |
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 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. | |
The TTAudioSignal class represents N vectors of audio samples for M channels.
All of the members are made public so that direct access to members can be used for speed in cases where efficiency is of the utmost importance.
Where speed is less critical, the preferred method of work with audio signals is the same as for other objects: use the dynamic message passing interface.
Definition at line 57 of file TTAudioSignal.h.
TTAudioSignal::TTAudioSignal | ( | const TTAudioSignal & | original | ) |
Copy constructor.
Definition at line 63 of file TTAudioSignal.cpp.
References addAttribute, addAttributeProperty, addAttributeWithSetter, addMessage, addMessageProperty, addMessageWithArguments, alloc(), clear(), kTypeUInt16, and kTypeUInt8.
TTErr TTAudioSignal::allocWithNewChannelCount | ( | TTChannelCount | newChannelCount | ) |
Allocate memory for a given number of channels, setting MaxChannelCount, at the current vector size.
Unlike other alloc() routines, the existing contents of the audio channels is preserved.
DOES NOT TAKE INTO ACCOUNT THE 'LOCALLY OWNED' ATTRIBUTE BEING SET TO FALSE! COULD CAUSE MEM CORRUPTION IF USED ON EXTERNAL REFERENCES!
Definition at line 270 of file TTAudioSignal.cpp.
References kTTErrNone, mSampleVectors, TTFree16(), and TTMalloc16().
|
inline |
Zero out all of the sample values in the audio signal.
Definition at line 217 of file TTAudioSignal.h.
References kTTErrGeneric, and kTTErrNone.
Referenced by TTAudioObjectBase::bypassProcess(), TTAudioEngine::callback(), TTAudioGraphInlet::preprocess(), TTMultiMixer::processAudio(), TTSpatBaseRenderer::processAudio(), TTMixer::processAudio(), TTMixer::processAudioInterpolated(), TTLinearFunction::test(), TTBackEaseOutFunction::test(), TTCubicEaseInFunction::test(), TTQuinticEaseInFunction::test(), TTQuarticEaseOutFunction::test(), TTCubicEaseOutFunction::test(), TTElasticEaseInFunction::test(), TTBounceEaseInFunction::test(), TTElasticEaseOutFunction::test(), TTQuadraticEaseInFunction::test(), TTQuadraticEaseOutFunction::test(), TTBounceEaseInOutFunction::test(), TTQuarticEaseInFunction::test(), TTExponentialEaseInFunction::test(), TTExponentialEaseOutFunction::test(), TTQuinticEaseOutFunction::test(), TTSineEaseInFunction::test(), TTSineEaseInOutFunction::test(), TTBounceEaseOutFunction::test(), TTSineEaseOutFunction::test(), TTCircularEaseInFunction::test(), TTBackEaseInFunction::test(), TTCircularEaseOutFunction::test(), TTSmoothPolynomialFunction::test(), TTQuarticEaseInOutFunction::test(), TTExponentialEaseInOutFunction::test(), TTCubicEaseInOutFunction::test(), TTBackEaseInOutFunction::test(), TTQuadraticEaseInOutFunction::test(), TTElasticEaseInOutFunction::test(), TTQuinticEaseInOutFunction::test(), TTCircularEaseInOutFunction::test(), TTLogFunction::test(), TTExpFunction::test(), TTPowerFunction::test(), TTHalfband3::test(), TTTanhFunction::test(), TTFreeHandFunction::test(), TTMirror5::test(), TTMirrorBandpass10::test(), TTHalfband5::test(), TTHilbertLinear33::test(), TTHalfband9::test(), TTSvf::test(), TTAllpass1::test(), TTHilbert9::test(), TTAverage::test(), TTHalfbandLinear33::test(), and TTAudioSignal().
|
static |
Copy the audio from one signal into another.
Definition at line 341 of file TTAudioSignal.cpp.
References getMinChannelCount(), kTTErrNone, and mSampleVectors.
Referenced by TTAudioObjectBase::bypassProcess(), operator=(), TTInputAudio::process(), TTThru::processAudio(), and TTAudioGraphGenerator::processAudio().
|
static |
Copy the audio from one signal into another, but not taking care to zero channels that aren't used.
Definition at line 371 of file TTAudioSignal.cpp.
References getMinChannelCount(), kTTErrNone, and mSampleVectors.
|
static |
Copy the audio from one signal into another.
Definition at line 392 of file TTAudioSignal.cpp.
References kTTErrNone, and mSampleVectors.
|
inlinestatic |
Use this class method to determine the least number of channels the two signals have in common.
In cases where a processAudio method expects to have a matching number of audio inputs and outputs, this method can be used to compare the two signals and return the number of channels for which it is safe to assume that the number of inputs and outputs are the same.
signal1 | The first of the two signals to be compared. |
signal2 | The second of the two signals to be compared. |
Definition at line 277 of file TTAudioSignal.h.
Referenced by copy(), copyDirty(), WindowFunction::processApply(), PlugtasticOutput::processAudio(), PlugtasticInput::processAudio(), TTGain::processAudio(), TTPowerFunction::processAudio(), TTDegrade::processAudio(), TTLimiter::processAudio(), TTAudioObjectBaseArray::processAudio(), TTMutesolo::processAudio(), TTGain::processAudioInterpolated(), TTMutesolo::processAudioInterpolated(), TTOverdrive::processMode0(), and TTOverdrive::processMode1().
|
inlinestatic |
Use this class method to determine the least number of channels the specified signals have in common.
In cases where a processAudio method expects to have a matching number of audio inputs and outputs, this method can be used to compare the two signals and return the number of channels for which it is safe to assume that the number of inputs and outputs are the same.
signal1 | The first of three signals to be compared. |
signal2 | The second of three signals to be compared. |
signal3 | The third of three signals to be compared. |
Definition at line 295 of file TTAudioSignal.h.
|
static |
Use this class method to determine the number of channels of an input or output signal.
This can be useful in circumstances where input and output signals are not necsessarily expected or required to have the same number of channels.
signal | The signal that we want to investigate. |
Definition at line 432 of file TTAudioSignal.cpp.
Referenced by TTBalance::processAudio().
|
inline |
Assign another audio signal's samples and channel/vector configuration with this audio signal's samples.
Definition at line 355 of file TTAudioSignal.h.
References copy().
|
static |
Reference the audio from one signal in another.
Definition at line 326 of file TTAudioSignal.cpp.
References kTTErrNone, and mSampleVectors.
Attribute accessor.
Definition at line 116 of file TTAudioSignal.cpp.
References alloc(), kTTErrNone, mSampleVectors, and TTMalloc16().
Referenced by TTAudioEngine::initStream(), Linear3D::processAudio(), Linear2D::processAudio(), TTSpatBaseRenderer::processAudio(), TTMixer::processAudio(), and TTMixer::processAudioInterpolated().
TTErr TTAudioSignal::setVector | ( | const TTChannelCount | channel, |
const TTUInt16 | vectorSize, | ||
const TTSampleValuePtr | newVector | ||
) |
[doxygenAppendixC_methodExample]
Assigns a vector of sample values to a channel in this signal.
The vector member of this class simply holds a pointer, not a copy of the data. This makes the operation of this method (and others) fast, but also means that care should be taken to ensure that the data being pointed to by this signal is valid, and does not become invalid during the lifetime of the signal.
It is the responsibility of the user of this method to ensure that the sample-rate and vector-size are also set correctly.
channel | The channel number (zero-based) to assign the vector to. |
vectorSize | The number of samples in the vector. |
newVector | A pointer to the first sample in a vector of samples. |
Definition at line 144 of file TTAudioSignal.cpp.
References kTTErrNone, mSampleVectors, and TTFree16().
Referenced by filter_perform(), filter_perform_freq(), filter_perform_freq_q(), filter_perform_q(), TTAudioObjectBaseArray::processAudio(), and TTAudioUnit::processAudio().