Jamoma API  0.6.0.a19
GainDataspace.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup foundationDataspaceLib
4  *
5  * @brief The #GainDataspace converts between different measurement untis describing audio gain.
6  *
7  * @details The neutral unit of the gain dataspace is _linear gain_.
8  *
9  * @authors Trond Lossius, Tim Place, Nils Peters, ...
10  *
11  * @copyright Copyright © 2007 by Trond Lossius @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 __GAINDATASPACE_H__
18 #define __GAINDATASPACE_H__
19 
20 #include "TTDataspace.h"
21 
22 
23 /** Base class for the gain dataspace, provides dataspace support for converting gain between linear, decibel and MIDI gain.
24  *
25  * @details: Linear gain is the neutral data unit of this dataspace.
26  */
27 class GainDataspace : public TTDataObjectBase, public TTDataspace {
29 
30  /** Unit test for the gain dataspace.
31  @param returnedTestInfo The outcome from the performed unit test.
32  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
33  */
34  virtual TTErr test(TTValue& returnedTestInfo);
35 };
36 
37 
38 /** Converts gains to and from linear gain.
39  *
40  * @details This unit is denoted as "linear".
41  */
44 
45 public:
46 
47  /** Convert from linear to neutral unit.
48  @param input Input gain described using linear gain .
49  @param output Returned gain, converted to neutral unit.
50  */
51  void convertToNeutral(const TTValue& input, TTValue& output);
52 
53  /** Convert from neutral unit to linear.
54  @param input Input gain described using the neutral unit.
55  @param output Returned gain, described using linear gain.
56  */
57  void convertFromNeutral(const TTValue& input, TTValue& output);
58 };
59 
60 
61 /** Converts gains to and from MIDI units.
62  *
63  * @details This unit is denoted as "midi". @n
64  * @n
65  * Jamoma use a non-linear MIDI scale for gain, where MIDI 100 equals 0 dB, MIDI 110 equals +6 dB and MIDI 127 equals +10 dB. Refer to #GainDataspace.cpp for details concerning the equations used for convertions to and from MIDI units.
66  */
69 
70 public:
71 
72  /** Convert from MIDI units to neutral unit.
73  @param input Input gain described using MIDI units .
74  @param output Returned gain, converted to neutral unit.
75  */
76  void convertToNeutral(const TTValue& input, TTValue& output);
77 
78  /** Convert from neutral unit to midi value.
79  @param input Input gain described using the neutral unit.
80  @param output Returned gain, described using MIDI units.
81  */
82  void convertFromNeutral(const TTValue& input, TTValue& output);
83 };
84 
85 
86 
87 /** Converts gains to and from decibels.
88  *
89  * @details This unit is denoted as "dB" or "db".
90  */
93 
94 public:
95 
96  /** Convert from decibel to neutral unit.
97  @param input Input gain described using decibels.
98  @param output Returned gain, converted to neutral unit.
99  */
100  void convertToNeutral(const TTValue& input, TTValue& output);
101 
102  /** Convert from neutral unit to decibels.
103  @param input Input gain described using the neutral unit.
104  @param output Returned gain, described using decibels.
105  */
106  void convertFromNeutral(const TTValue& input, TTValue& output);
107 };
108 
109 
110 #endif // __GAINDATASPACE_H__
Converts gains to and from linear gain.
Definition: GainDataspace.h:42
Converts gains to and from MIDI units.
Definition: GainDataspace.h:67
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to linear.
TTDataObjectBase is the base class for all data generating and processing objects.
Base class for the gain dataspace, provides dataspace support for converting gain between linear...
Definition: GainDataspace.h:27
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
Specification for the base class of each DataspaceUnit.
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to midi value.
Converts gains to and from decibels.
Definition: GainDataspace.h:91
Specification for TTDataspace, the base class of each dataspace.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
Base class for each dataspace.
Definition: TTDataspace.h:30
void convertFromNeutral(const TTValue &input, TTValue &output)
Convert from neutral unit to decibels.
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from MIDI units to neutral unit.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from decibel to neutral unit.
void convertToNeutral(const TTValue &input, TTValue &output)
Convert from linear to neutral unit.