Jamoma API
0.6.0.a19
|
TTAverage - measuring averaged and RMS signal energy. More...
#include <TTAverage.h>
Public Member Functions | |
TTErr | calculateBipolarValue (const TTFloat64 &anInput, TTFloat64 &anOutput, TTPtrSizedInt aChannel) |
A method for single sample calculation of bipolar average value. More... | |
TTErr | calculateAbsoluteValue (const TTFloat64 &anInput, TTFloat64 &anOutput, TTPtrSizedInt aChannel) |
A method for single sample calculation of absolute average value. More... | |
TTErr | calculateRmsValue (const TTFloat64 &anInput, TTFloat64 &anOutput, TTPtrSizedInt aChannel) |
A method for single sample calculation of rms (root mean square) average value. More... | |
TTErr | clear () |
Reset (clear) the history used in the analysis. More... | |
TTErr | setMode (const TTValue &newValue) |
Set the mode attribute that controlles what averaging mode to use. More... | |
TTErr | setInterval (const TTValue &aNewInterval) |
Set the interval to use when averaging. More... | |
TTErr | setMaxInterval (const TTValue &aNewMaxInterval) |
Set the maximum interval that can be used when averaging. More... | |
Protected Member Functions | |
TTErr | updateMaxNumChannels (const TTValue &anOldMaxNumChannels, TTValue &aNotUsed) |
This method gets called when the inherited maxNumChannels attribute is changed. More... | |
TTErr | updateSampleRate (const TTValue &aNotUsed1, TTValue &aNotUsed2) |
Receives notifications when there are changes to the inherited sr attribute. More... | |
TTErr | init (TTUInt64 newDelayMaxInSamples) |
Internal method - set up the buffer memory. More... | |
void | reset () |
Internal method - Position the buffer pointers. | |
TTErr | processBipolarAverage (TTAudioSignalArrayPtr anInputs, TTAudioSignalArrayPtr anOutputs) |
Audio process method to use when doing bipolar averaging. More... | |
TTErr | calculateBipolarValue (const TTFloat64 &anInput, TTFloat64 &anOutput, TTDelayBufferPtr aDelayBuffer, TTPtrSizedInt aChannel) |
An inline method for single sample calculation of bipolar average value. More... | |
TTErr | processAbsoluteAverage (TTAudioSignalArrayPtr anInputs, TTAudioSignalArrayPtr anOutputs) |
Audio process method to use when doing absolute value averaging. More... | |
TTErr | calculateAbsoluteValue (const TTFloat64 &anInput, TTFloat64 &anOutput, TTDelayBufferPtr aDelayBuffer, TTPtrSizedInt aChannel) |
An inline method for single sample calculation of absolute average value. More... | |
TTErr | processRmsAverage (TTAudioSignalArrayPtr anInputs, TTAudioSignalArrayPtr anOutputs) |
Audio process method to use when doing root-mean-square averaging. More... | |
TTErr | calculateRmsValue (const TTFloat64 &anInput, TTFloat64 &anOutput, TTDelayBufferPtr aDelayBuffer, TTPtrSizedInt aChannel) |
An inline method for single sample calculation of rms (root mean square) average value. More... | |
virtual TTErr | test (TTValue &returnedTestInfo) |
Unit test. More... | |
Protected Attributes | |
TTUInt64 | mMaxInterval |
The largest possible interval or window to do running averaging over. | |
TTUInt64 | mInterval |
The interval to do running averaging over. | |
TTFloat64 | mIntervalReciprocal |
The inverse of mInterval. Calculated and stored for conviniency and efficiency. | |
TTSampleVector | mAccumulator |
An accumulator used for calculation of running averages. | |
TTSymbol | mMode |
Averaging mode, options are absolute, bipolar and rms. | |
TTAverage - measuring averaged and RMS signal energy.
Definition at line 25 of file TTAverage.h.
|
inlineprotected |
An inline method for single sample calculation of absolute average value.
anInput | An input sample value |
anOutput | An output (processed) sample value |
aDelayBuffer | Delay buffer used for calculation of running averages |
aChannel | The audio channel to perform to processing for |
Definition at line 186 of file TTAverage.cpp.
References kTTErrNone, mAccumulator, mIntervalReciprocal, TTDelayBuffer::mReadPointer, and TTDelayBuffer::mWritePointer.
Referenced by calculateAbsoluteValue(), and processAbsoluteAverage().
TTErr TTAverage::calculateAbsoluteValue | ( | const TTFloat64 & | anInput, |
TTFloat64 & | anOutput, | ||
TTPtrSizedInt | aChannel | ||
) |
A method for single sample calculation of absolute average value.
anInput | An input sample value |
anOutput | An output (processed) sample value |
aChannel | The audio channel to perform to processing for |
Definition at line 173 of file TTAverage.cpp.
References calculateAbsoluteValue().
|
inlineprotected |
An inline method for single sample calculation of bipolar average value.
anInput | An input sample value |
anOutput | An output (processed) sample value |
aDelayBuffer | Delay buffer used for calculation of running averages |
aChannel | The audio channel to perform to processing for |
Definition at line 213 of file TTAverage.cpp.
References kTTErrNone, mAccumulator, mIntervalReciprocal, TTDelayBuffer::mReadPointer, and TTDelayBuffer::mWritePointer.
Referenced by calculateBipolarValue(), and processBipolarAverage().
TTErr TTAverage::calculateBipolarValue | ( | const TTFloat64 & | anInput, |
TTFloat64 & | anOutput, | ||
TTPtrSizedInt | aChannel | ||
) |
A method for single sample calculation of bipolar average value.
anInput | An input sample value |
anOutput | An output (processed) sample value |
aChannel | The audio channel to perform to processing for |
Definition at line 202 of file TTAverage.cpp.
References calculateBipolarValue().
|
inlineprotected |
An inline method for single sample calculation of rms (root mean square) average value.
anInput | An input sample value |
anOutput | An output (processed) sample value |
aDelayBuffer | Delay buffer used for calculation of running averages |
aChannel | The audio channel to perform to processing for |
Definition at line 241 of file TTAverage.cpp.
References kTTErrNone, mAccumulator, mIntervalReciprocal, TTDelayBuffer::mReadPointer, and TTDelayBuffer::mWritePointer.
Referenced by calculateRmsValue(), and processRmsAverage().
TTErr TTAverage::calculateRmsValue | ( | const TTFloat64 & | anInput, |
TTFloat64 & | anOutput, | ||
TTPtrSizedInt | aChannel | ||
) |
A method for single sample calculation of rms (root mean square) average value.
anInput | An input sample value |
anOutput | An output (processed) sample value |
aChannel | The audio channel to perform to processing for |
Definition at line 229 of file TTAverage.cpp.
References calculateRmsValue().
TTErr TTAverage::clear | ( | ) |
Reset (clear) the history used in the analysis.
Definition at line 88 of file TTAverage.cpp.
References kTTErrNone, mAccumulator, and TTAudioObjectBase::mMaxNumChannels.
Referenced by setInterval(), and setMode().
Internal method - set up the buffer memory.
newDelayMaxInSamples | New value for maximum samples to permit. |
Definition at line 60 of file TTAverage.cpp.
References TTValue::clear(), kTTErrNone, mMaxInterval, reset(), and TTValue::resize().
Referenced by setMaxInterval(), and updateMaxNumChannels().
|
protected |
Audio process method to use when doing absolute value averaging.
anInputs | A pointer to a TTAudioSignal object that may contain any number of channels. This signal is considered the master, and thus it provides the vectorsize and number of channels should the two signals not be matched. |
anOutputs | A pointer to a TTAudioSignal object that has the output sample vectors. |
Definition at line 180 of file TTAverage.cpp.
References calculateAbsoluteValue().
Referenced by setMode().
|
protected |
Audio process method to use when doing bipolar averaging.
anInputs | A pointer to a TTAudioSignal object that may contain any number of channels. This signal is considered the master, and thus it provides the vectorsize and number of channels should the two signals not be matched. |
anOutputs | A pointer to a TTAudioSignal object that has the output sample vectors. |
Definition at line 208 of file TTAverage.cpp.
References calculateBipolarValue().
Referenced by setMode().
|
protected |
Audio process method to use when doing root-mean-square averaging.
anInputs | A pointer to a TTAudioSignal object that may contain any number of channels. This signal is considered the master, and thus it provides the vectorsize and number of channels should the two signals not be matched. |
anOutputs | A pointer to a TTAudioSignal object that has the output sample vectors. |
Definition at line 235 of file TTAverage.cpp.
References calculateRmsValue().
Referenced by setMode().
Set the interval to use when averaging.
aNewInterval | The new interval to use when averaging. |
Definition at line 118 of file TTAverage.cpp.
References clear(), kTTErrNone, mInterval, mIntervalReciprocal, and reset().
Set the maximum interval that can be used when averaging.
aNewMaxInterval | The outcome from the performed unit test. |
Definition at line 127 of file TTAverage.cpp.
References init(), and mMaxInterval.
Set the mode attribute that controlles what averaging mode to use.
Options are bipolar, absolute and rms. This method also ensures that the correct process method will be used.
aNewMode | The new mode to use. |
Definition at line 96 of file TTAverage.cpp.
References clear(), kTTErrInvalidValue, mMode, processAbsoluteAverage(), processBipolarAverage(), processRmsAverage(), reset(), setProcessMethod, and TT.
Unit test.
returnedTestInfo | The outcome from the performed unit test. |
Reimplemented from TTAudioObjectBase.
Definition at line 20 of file TTAverage.test.cpp.
References TTAudioSignal::allocWithVectorSize(), TTAudioSignal::clear(), TTAudioSignal::mSampleVectors, TTAudioObjectBase::process(), TTObjectBase::setAttributeValue(), TT, TTObjectBaseInstantiate(), and TTObjectBaseRelease().
|
protected |
This method gets called when the inherited maxNumChannels attribute is changed.
aNotUsed1 | Not used |
aNotUsed2 | Not used |
Definition at line 73 of file TTAverage.cpp.
References init(), mAccumulator, mMaxInterval, and TTAudioObjectBase::mMaxNumChannels.
Receives notifications when there are changes to the inherited sr attribute.
Definition at line 135 of file TTAverage.cpp.
References kTTErrNone.