comparison src/Modules/NAP/ModuleHCL.h @ 0:582cbe817f2c

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