Jamoma API  0.6.0.a19
TukeyWindow Class Reference

This implements the Tukey window function described here: http://en.wikipedia.org/wiki/File:Window_function_(Tukey;alpha%3D_0.5).png This is alternate implementation of what Roads (1996 p 170, 2001 p 88) typically refers to as a quasi-Gaussian window. More...

#include <TTTukeyWindow.h>

+ Inheritance diagram for TukeyWindow:
+ Collaboration diagram for TukeyWindow:

Protected Member Functions

TTErr calculateValue (const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt data)
 Calculate y = f(x) for a single value. More...
 
TTErr processAudio (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
 A standard audio processing method as used by TTBlue objects. More...
 
TTErr test (TTValue &returnedTestInfo)
 Unit test for the window function unit. More...
 

Protected Attributes

TTFloat64 mAlpha
 ratio of window fades to total window duration. 0 <= alpha <= 1., 0 = no fades, 1 = no sustain
 

Detailed Description

This implements the Tukey window function described here: http://en.wikipedia.org/wiki/File:Window_function_(Tukey;alpha%3D_0.5).png This is alternate implementation of what Roads (1996 p 170, 2001 p 88) typically refers to as a quasi-Gaussian window.

It is easier to ensure that x and y values will scale properly with this formula as opposed to the one given by Roads.

Where 0. <= x <= 1. and 0. <= mAlpha <= 1.: y = 0.5 * (1 + cos ( pi * ((twoOverAlpha * x) - 1))) : for the attack = 1 : for the sustain = 0.5 * (1 + cos ( pi * ((twoOverAlpha * x) - twoOverAlpha + 1))) : for the release

Definition at line 42 of file TTTukeyWindow.h.

Member Function Documentation

TTErr TukeyWindow::calculateValue ( const TTFloat64 x,
TTFloat64 y,
TTPtrSizedInt  data 
)
inlineprotected

Calculate y = f(x) for a single value.

Parameters
xThe input value to the window function.
yThe resulting value for the window function.
dataNot used.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 53 of file TTTukeyWindow.cpp.

References kTTErrNone, kTTPi, and mAlpha.

Referenced by processAudio().

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

A standard audio processing method as used by TTBlue objects.

Parameters
inputsThe input vector that is to be processed.
outputsThe resulting windowed vector.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 78 of file TTTukeyWindow.cpp.

References calculateValue().

+ Here is the call graph for this function:

TTErr TukeyWindow::test ( TTValue returnedTestInfo)
protectedvirtual

Unit test for the window function unit.

Parameters
returnedTestInfoThe outcome from the performed unit test.
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Reimplemented from TTAudioObjectBase.

Definition at line 58 of file TTTukeyWindow.test.cpp.

References TTAudioSignal::allocWithVectorSize(), TTAudioSignal::mSampleVectors, TTAudioObjectBase::process(), TTObjectBase::setAttributeValue(), TT, TTObjectBaseInstantiate(), and TTObjectBaseRelease().

+ Here is the call graph for this function:


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