tomwalters@305
|
1 // Copyright 2010, Thomas Walters
|
tomwalters@305
|
2 //
|
tomwalters@305
|
3 // AIM-C: A C++ implementation of the Auditory Image Model
|
tomwalters@305
|
4 // http://www.acousticscale.org/AIMC
|
tomwalters@305
|
5 //
|
tomwalters@305
|
6 // This program is free software: you can redistribute it and/or modify
|
tomwalters@305
|
7 // it under the terms of the GNU General Public License as published by
|
tomwalters@305
|
8 // the Free Software Foundation, either version 3 of the License, or
|
tomwalters@305
|
9 // (at your option) any later version.
|
tomwalters@305
|
10 //
|
tomwalters@305
|
11 // This program is distributed in the hope that it will be useful,
|
tomwalters@305
|
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
tomwalters@305
|
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
tomwalters@305
|
14 // GNU General Public License for more details.
|
tomwalters@305
|
15 //
|
tomwalters@305
|
16 // You should have received a copy of the GNU General Public License
|
tomwalters@305
|
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
|
tomwalters@305
|
18
|
tomwalters@305
|
19 /*!
|
tomwalters@305
|
20 * \author Thomas Walters <tom@acousticscale.org>
|
tomwalters@305
|
21 * \date created 2010/02/24
|
tomwalters@305
|
22 * \version \$Id$
|
tomwalters@305
|
23 */
|
tomwalters@305
|
24
|
tomwalters@305
|
25 #ifndef AIMC_MODULES_SNR_NOISE_H_
|
tomwalters@305
|
26 #define AIMC_MODULES_SNR_NOISE_H_
|
tomwalters@305
|
27
|
tomwalters@305
|
28 #include <boost/random.hpp>
|
tomwalters@305
|
29
|
tomwalters@305
|
30 #include "Support/Module.h"
|
tomwalters@305
|
31
|
tomwalters@305
|
32 namespace aimc {
|
tomwalters@305
|
33 class ModuleNoise : public Module {
|
tomwalters@305
|
34 public:
|
tomwalters@305
|
35 explicit ModuleNoise(Parameters *pParam);
|
tomwalters@305
|
36 virtual ~ModuleNoise();
|
tomwalters@305
|
37
|
tomwalters@305
|
38 /*! \brief Process a buffer
|
tomwalters@305
|
39 */
|
tomwalters@305
|
40 virtual void Process(const SignalBank &input);
|
tomwalters@305
|
41
|
tomwalters@305
|
42 private:
|
tomwalters@305
|
43 /*! \brief Reset the internal state of the module
|
tomwalters@305
|
44 */
|
tomwalters@305
|
45 virtual void ResetInternal();
|
tomwalters@305
|
46
|
tomwalters@305
|
47 /*! \brief Prepare the module
|
tomwalters@305
|
48 * \param input Input signal
|
tomwalters@305
|
49 * \param output true on success false on failure
|
tomwalters@305
|
50 */
|
tomwalters@305
|
51 virtual bool InitializeInternal(const SignalBank &input);
|
tomwalters@305
|
52
|
tomwalters@305
|
53 float sample_rate_;
|
tomwalters@305
|
54 int buffer_length_;
|
tomwalters@305
|
55 int channel_count_;
|
tomwalters@305
|
56
|
tomwalters@305
|
57 float multiplier_;
|
tomwalters@305
|
58
|
tomwalters@305
|
59 // Random number generator which yeilds Gaussian-distributed values by
|
tomwalters@305
|
60 // The generator is a Mersenne twister
|
tomwalters@305
|
61 boost::variate_generator<boost::mt19937,
|
tomwalters@305
|
62 boost::normal_distribution<float> >
|
tomwalters@305
|
63 gaussian_variate_;
|
tomwalters@305
|
64 };
|
tomwalters@305
|
65 } // namespace aimc
|
tomwalters@305
|
66
|
tomwalters@305
|
67 #endif // AIMC_MODULES_SNR_NOISE_H_
|