tomwalters@268
|
1 // Copyright 2007-2010, University of Cambridge
|
tomwalters@268
|
2 //
|
tomwalters@268
|
3 // AIM-C: A C++ implementation of the Auditory Image Model
|
tomwalters@268
|
4 // http://www.acousticscale.org/AIMC
|
tomwalters@268
|
5 //
|
tomwalters@268
|
6 // This program is free software: you can redistribute it and/or modify
|
tomwalters@268
|
7 // it under the terms of the GNU General Public License as published by
|
tomwalters@268
|
8 // the Free Software Foundation, either version 3 of the License, or
|
tomwalters@268
|
9 // (at your option) any later version.
|
tomwalters@268
|
10 //
|
tomwalters@268
|
11 // This program is distributed in the hope that it will be useful,
|
tomwalters@268
|
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
tomwalters@268
|
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
tomwalters@268
|
14 // GNU General Public License for more details.
|
tomwalters@268
|
15 //
|
tomwalters@268
|
16 // You should have received a copy of the GNU General Public License
|
tomwalters@268
|
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
|
tomwalters@268
|
18
|
tomwalters@268
|
19 /*!
|
tomwalters@268
|
20 * \file
|
tomwalters@268
|
21 * \brief Halfwave rectification, compression and lowpass filtering
|
tomwalters@268
|
22 */
|
tomwalters@268
|
23
|
tomwalters@268
|
24 /* \author Tom Walters <tcw24@cam.ac.uk>
|
tomwalters@268
|
25 * \date created 2007/03/07
|
tomwalters@268
|
26 * \version \$Id: ModuleHCL.h 4 2010-02-03 18:44:58Z tcw $
|
tomwalters@268
|
27 */
|
tomwalters@268
|
28
|
tomwalters@268
|
29 #ifndef _AIMC_MODULE_NAP_HCL_H_
|
tomwalters@268
|
30 #define _AIMC_MODULE_NAP_HCL_H_
|
tomwalters@268
|
31
|
tomwalters@268
|
32 #include <vector>
|
tomwalters@268
|
33
|
tomwalters@268
|
34 #include "Support/Module.h"
|
tomwalters@268
|
35 #include "Support/SignalBank.h"
|
tomwalters@268
|
36
|
tomwalters@268
|
37 namespace aimc {
|
tomwalters@268
|
38 using std::vector;
|
tomwalters@268
|
39 class ModuleHCL : public Module {
|
tomwalters@268
|
40 public:
|
tomwalters@268
|
41 ModuleHCL(Parameters *parameters);
|
tomwalters@268
|
42 virtual ~ModuleHCL();
|
tomwalters@268
|
43
|
tomwalters@268
|
44 virtual void Process(const SignalBank &input);
|
tomwalters@268
|
45
|
tomwalters@268
|
46 private:
|
tomwalters@268
|
47 /*! \brief Prepare the module
|
tomwalters@268
|
48 * \param input Input signal bank
|
tomwalters@268
|
49 * \param output true on success false on failure
|
tomwalters@268
|
50 */
|
tomwalters@268
|
51 virtual bool InitializeInternal(const SignalBank &input);
|
tomwalters@268
|
52
|
tomwalters@275
|
53 virtual void ResetInternal();
|
tomwalters@275
|
54
|
tomwalters@268
|
55 //! \brief Do lowpass filtering?
|
tomwalters@268
|
56 bool do_lowpass_;
|
tomwalters@268
|
57
|
tomwalters@268
|
58 //! \brief Do log compression?
|
tomwalters@268
|
59 bool do_log_;
|
tomwalters@268
|
60
|
tomwalters@268
|
61 //! \brief Cutoff frequency for lowpass filter
|
tomwalters@268
|
62 float lowpass_cutoff_;
|
tomwalters@268
|
63
|
tomwalters@268
|
64 //! \brief Order of Lowpass Filter
|
tomwalters@268
|
65 int lowpass_order_;
|
tomwalters@268
|
66
|
tomwalters@268
|
67 //! \brief Internal record of the number of channels in the input
|
tomwalters@268
|
68 int channel_count_;
|
tomwalters@268
|
69
|
tomwalters@268
|
70 //! \brief Time constant corresponsing to the lowpass filter cutoff freqency
|
tomwalters@268
|
71 float time_constant_;
|
tomwalters@268
|
72
|
tomwalters@268
|
73 //! \brief Lowpass filter state variables
|
tomwalters@268
|
74 float xn_;
|
tomwalters@268
|
75 float yn_;
|
tomwalters@268
|
76 vector<vector<float> > yns_;
|
tomwalters@268
|
77 };
|
tomwalters@268
|
78 } // namespace aimc
|
tomwalters@268
|
79
|
tomwalters@268
|
80 #endif // _AIMC_MODULE_NAP_HCL_H_
|