Jamoma API  0.6.0.a19
TTFunction.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFunctionLib
4  *
5  * @brief #TTFunction is a generalized function wrapper for Jamoma DSP
6  *
7  * @details All functions will map incoming values in the normalised range [0,1] to output values in the normalised range [0,1].
8  *
9  * @authors Tim Place, Trond Lossius
10  *
11  * @copyright Copyright © 2010 by Tim Place @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 
17 #ifndef __FUNCTION_H__
18 #define __FUNCTION_H__
19 
20 #include "TTDSP.h"
21 
22 
23 /** Generalized Function Wrapper
24  */
27 
28 protected:
29 
30  TTSymbol mFunction; ///< Name of the window function to use
31  TTAudioObjectBasePtr mFunctionObject; ///< The actual window function object for mFunction
32  TTUInt32 mNumPoints; ///< Number of Points in the lookup table
33  TTSampleVector mLookupTable; ///< Cached table of size mNumPoints
34  TTSymbol mMode; ///< Options: 'generate', 'lookup', 'apply'
35  TTUInt32 mPadding; ///< for generating the lookup table - (e.g. padded welch window padded by 16 zeros on both sides)
36  // further padding references: http://www.dsprelated.com/dspbooks/sasp/Sliding_FFT_Maximum_Overlap.html
37 
38  /** choose the window function */
39  TTErr setFunction(const TTValue& function);
40 
41  /** set lookup table size */
42  TTErr setNumPoints(const TTValue& numPoints);
43  TTErr doSetNumPoints(const TTUInt32 numPoints);
44 
45  /** set process method */
46  TTErr setMode(const TTValue& mode);
47 
48  /** zero-padding applied to lookup table */
49  TTErr setPadding(const TTValue& padding);
50 
51  // internal method for filling the lookup table
52  TTErr fill();
53 
54  /** return a list of all the available window shapes */
55  TTErr getFunctions(const TTValue&, TTValue& listOfWindowTypesToReturn);
56 
57  /** y = f(x) for a single value */
58  inline TTErr calculateValue(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt data);
59  inline TTErr lookupValue(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt data);
60 
61  /** A standard audio processing method as used by Jamoma DSP objects.*/
63  TTErr processLookup(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
64  TTErr processApply(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
65 
66 };
67 
68 
69 #endif // __FUNCTION_H__
TTErr setPadding(const TTValue &padding)
zero-padding applied to lookup table
Definition: TTFunction.cpp:90
Generalized Function Wrapper.
Definition: TTFunction.h:25
TTErr setNumPoints(const TTValue &numPoints)
set lookup table size
Definition: TTFunction.cpp:76
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt data)
y = f(x) for a single value
Definition: TTFunction.cpp:128
TTSymbol mMode
Options: 'generate', 'lookup', 'apply'.
Definition: TTFunction.h:34
Jamoma DSP Library.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
TTAudioObjectBasePtr mFunctionObject
The actual window function object for mFunction.
Definition: TTFunction.h:31
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
std::vector< TTSampleValue > TTSampleVector
A TTSampleVector is simply a pointer to the first of an array of TTSampleValues.
Definition: TTBase.h:233
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTUInt32 mPadding
for generating the lookup table - (e.g. padded welch window padded by 16 zeros on both sides) ...
Definition: TTFunction.h:35
TTSampleVector mLookupTable
Cached table of size mNumPoints.
Definition: TTFunction.h:33
TTUInt32 mNumPoints
Number of Points in the lookup table.
Definition: TTFunction.h:32
A simple container for an array of TTAudioSignal pointers.
TTErr setMode(const TTValue &mode)
set process method
Definition: TTFunction.cpp:97
long TTPtrSizedInt
An integer that is the same size as a pointer.
Definition: TTBase.h:240
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTErr processGenerate(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
A standard audio processing method as used by Jamoma DSP objects.
Definition: TTFunction.cpp:141
TTSymbol mFunction
Name of the window function to use.
Definition: TTFunction.h:30
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
TTErr setFunction(const TTValue &function)
choose the window function
Definition: TTFunction.cpp:47
TTErr getFunctions(const TTValue &, TTValue &listOfWindowTypesToReturn)
return a list of all the available window shapes
Definition: TTFunction.cpp:116
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34