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