Jamoma API  0.6.0.a19
TTZerocross Class Reference

TTZerocross analyzes the incoming audio by looking for zero-crossings. More...

#include <TTZerocross.h>

+ Inheritance diagram for TTZerocross:
+ Collaboration diagram for TTZerocross:

Protected Member Functions

TTErr updateMaxNumChannels (const TTValue &oldMaxNumChannels, TTValue &)
 This method gets called when the inherited maxNumChannels attribute is changed. More...
 
TTErr updateSr ()
 This method gets called when the inherited sr attribute (sample rate) is changed. More...
 
TTErr processAudio (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
 Audio processing method. More...
 
TTErr setSize (const TTValue &value)
 Set the size attribute. More...
 
TTErr Clear ()
 Reset the history used in the analysis. More...
 

Protected Attributes

TTUInt32 mSize
 Attribute: size of the analysis buffer.
 
TTFloat64 rSize
 reciprocal of the size attribute
 
TTBoolean lastSampleWasOverZero
 was the last sample over zero?
 
TTUInt32 counter
 counts zero-crossings
 
TTUInt32 analysisLocation
 keep track of how many samples so far
 

Detailed Description

TTZerocross analyzes the incoming audio by looking for zero-crossings.

When a zero crossing occurs it both reports the crossing and also keeps a count of the number of zero crossings per analysis period.

Definition at line 27 of file TTZerocross.h.

Member Function Documentation

TTErr TTZerocross::Clear ( )
protected

Reset the history used in the analysis.

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

Definition at line 55 of file TTZerocross.cpp.

References analysisLocation, counter, kTTErrNone, and lastSampleWasOverZero.

Referenced by updateMaxNumChannels().

TTErr TTZerocross::processAudio ( TTAudioSignalArrayPtr  inputs,
TTAudioSignalArrayPtr  outputs 
)
protected

Audio processing method.

WARNING: This unit requires 1 input and 2 outputs - it does not yet configure itself for other arrangements!

Parameters
inA 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.
outA pointer to a TTAudioSignal object that has the output sample vectors.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 74 of file TTZerocross.cpp.

References analysisLocation, counter, kTTErrNone, lastSampleWasOverZero, TTAudioSignal::mSampleVectors, mSize, and rSize.

TTErr TTZerocross::setSize ( const TTValue value)
protected

Set the size attribute.

Parameters
valueNew value for the attribute
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 65 of file TTZerocross.cpp.

References kTTErrNone, mSize, and rSize.

TTErr TTZerocross::updateMaxNumChannels ( const TTValue oldMaxNumChannels,
TTValue  
)
protected

This method gets called when the inherited maxNumChannels attribute is changed.

Parameters
oldMaxNumChannelsThe previous nuber of channels to process
Unused
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 49 of file TTZerocross.cpp.

References Clear().

+ Here is the call graph for this function:

TTErr TTZerocross::updateSr ( )
protected

This method gets called when the inherited sr attribute (sample rate) is changed.

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

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