Jamoma API  0.6.0.a19
TTDegrade.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspEffectsLib
4  *
5  * @brief #TTDegrade distorts signal by reducing bit resolution and/or sample rate.
6  *
7  * @authors Tim Place, Trond Lossius
8  *
9  * @copyright Copyright © 2008, Tim Place @n
10  * This code is licensed under the terms of the "New BSD License" @n
11  * http://creativecommons.org/licenses/BSD/
12  */
13 
14 
15 #ifndef __TT_DEGRADE_H__
16 #define __TT_DEGRADE_H__
17 
18 #include "TTDSP.h"
19 
20 
21 /** TTDegrade in an audio processor that distorts a signal in ugly digital ways.
22  This class is a good example of a very simple audio filter that can process any
23  number of parallel audio channels, with just a couple of attributes.
24  */
25 class TTDegrade : public TTAudioObjectBase {
27 
28 protected:
29 
30 //! [doxygenAppendixC_variableExample]
31  TTUInt16 mBitShift; ///< Amount of bits to shift away based on attrBitdepth.
32  TTSampleVector mAccumulator; ///< Holds values over from one vector to the next for each channel.
33  TTSampleVector mOutput; ///< Holds values over from one vector to the next for each channel..
34  TTUInt8 mBitdepth; ///< Use a range of 1 to 24 to emulate the specified bitdepth.
35  TTFloat64 mSrRatio; ///< Use a range of 0.0 to 1.0 to specify a ratio of the current sample-rate to emulate in order to intentional aliasing artifacts.
36 //! [doxygenAppendixC_variableExample]
37 
38  /** Setter for the inherited maxNumChannels attribute. */
39  TTErr updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&);
40 
41  /** Setter for the bitdepth attribute. */
42  TTErr setBitdepth(const TTValue& value);
43 
44  /** Standard audio processing method as used by TTBlue objects.
45  * This object can process N parallel channels of audio. It is assumed that the number
46  * of inputs and outputs are the same, as are the vector sizes of those inputs and outputs.
47  * @param in A pointer to a TTAudioSignal object that may contain any number of channels.
48  * This signal is considered the master, and thus it provides the vectorsize
49  * and number of channels should the two signals not be matched.
50  * @param out A pointer to a TTAudioSignal object that has the output sample vectors.
51  * @return Returns a TTBlue Error Code. TODO: Perhaps we should check if the signals are matched and then
52  * return an error if they aren't? Currently we are just returning TT_ERR_NONE all the time.
53  */
55 };
56 
57 
58 #endif // __TT_DEGRADE_H__
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTFloat64 mSrRatio
Use a range of 0.0 to 1.0 to specify a ratio of the current sample-rate to emulate in order to intent...
Definition: TTDegrade.h:35
TTSampleVector mOutput
Holds values over from one vector to the next for each channel..
Definition: TTDegrade.h:33
Jamoma DSP Library.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
#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
TTErr updateMaxNumChannels(const TTValue &oldMaxNumChannels, TTValue &)
[doxygenAppendixC_variableExample]
Definition: TTDegrade.cpp:48
A simple container for an array of TTAudioSignal pointers.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTErr setBitdepth(const TTValue &value)
Setter for the bitdepth attribute.
Definition: TTDegrade.cpp:60
TTDegrade in an audio processor that distorts a signal in ugly digital ways.
Definition: TTDegrade.h:25
TTUInt16 mBitShift
[doxygenAppendixC_variableExample]
Definition: TTDegrade.h:31
TTUInt8 mBitdepth
Use a range of 1 to 24 to emulate the specified bitdepth.
Definition: TTDegrade.h:34
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Standard audio processing method as used by TTBlue objects.
Definition: TTDegrade.cpp:68
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTSampleVector mAccumulator
Holds values over from one vector to the next for each channel.
Definition: TTDegrade.h:32
unsigned char TTUInt8
8 bit unsigned integer (char)
Definition: TTBase.h:174