Async 1.8.0
AsyncAudioAmp.h
Go to the documentation of this file.
1
27#ifndef ASYNC_AUDIO_AMP_INCLUDED
28#define ASYNC_AUDIO_AMP_INCLUDED
29
30
31/****************************************************************************
32 *
33 * System Includes
34 *
35 ****************************************************************************/
36
37#include <cmath>
38
39
40/****************************************************************************
41 *
42 * Project Includes
43 *
44 ****************************************************************************/
45
46#include <AsyncAudioProcessor.h>
47
48
49/****************************************************************************
50 *
51 * Local Includes
52 *
53 ****************************************************************************/
54
55
56
57/****************************************************************************
58 *
59 * Forward declarations
60 *
61 ****************************************************************************/
62
63
64
65/****************************************************************************
66 *
67 * Namespace
68 *
69 ****************************************************************************/
70
71namespace Async
72{
73
74
75/****************************************************************************
76 *
77 * Forward declarations of classes inside of the declared namespace
78 *
79 ****************************************************************************/
80
81
82
83/****************************************************************************
84 *
85 * Defines & typedefs
86 *
87 ****************************************************************************/
88
89
90
91/****************************************************************************
92 *
93 * Exported Global Variables
94 *
95 ****************************************************************************/
96
97
98
99/****************************************************************************
100 *
101 * Class definitions
102 *
103 ****************************************************************************/
104
113{
114 public:
118 AudioAmp(void) : m_gain(1.0) {}
119
123 ~AudioAmp(void) {}
124
129 void setGain(float gain_db) { m_gain = powf(10, gain_db / 20); }
130
135 float gain(void) const { return 20 * log10(m_gain); }
136
137
138 protected:
139 void processSamples(float *dest, const float *src, int count)
140 {
141 for (int i=0; i<count; ++i)
142 {
143 dest[i] = src[i] * m_gain;
144 }
145 }
146
147
148 private:
149 AudioAmp(const AudioAmp&);
150 AudioAmp& operator=(const AudioAmp&);
151
152 float m_gain;
153
154}; /* class AudioAmp */
155
156
157} /* namespace */
158
159#endif /* ASYNC_AUDIO_AMP_INCLUDED */
160
161
162
163/*
164 * This file has not been truncated
165 */
166
The base class for an audio processor class.
An audio pipe class for amplification/attenuation of an audio stream.
AudioAmp(void)
Default constuctor.
float gain(void) const
Read the gain.
~AudioAmp(void)
Destructor.
void processSamples(float *dest, const float *src, int count)
Process incoming samples and put them into the output buffer.
void setGain(float gain_db)
Set the gain to use.
The base class for an audio processor.
Namespace for the asynchronous programming classes.