tomwalters@282
|
1 // Copyright 2007-2010, Thomas Walters
|
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@318
|
6 // Licensed under the Apache License, Version 2.0 (the "License");
|
tomwalters@318
|
7 // you may not use this file except in compliance with the License.
|
tomwalters@318
|
8 // You may obtain a copy of the License at
|
tomwalters@268
|
9 //
|
tomwalters@318
|
10 // http://www.apache.org/licenses/LICENSE-2.0
|
tomwalters@268
|
11 //
|
tomwalters@318
|
12 // Unless required by applicable law or agreed to in writing, software
|
tomwalters@318
|
13 // distributed under the License is distributed on an "AS IS" BASIS,
|
tomwalters@318
|
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
tomwalters@318
|
15 // See the License for the specific language governing permissions and
|
tomwalters@318
|
16 // limitations under the License.
|
tomwalters@268
|
17
|
tomwalters@268
|
18 /*!
|
tomwalters@268
|
19 * \file
|
tomwalters@268
|
20 * \brief Halfwave rectification, compression and lowpass filtering
|
tomwalters@268
|
21 */
|
tomwalters@268
|
22
|
tomwalters@282
|
23 /* \author Thomas Walters <tom@acousticscale.org>
|
tomwalters@268
|
24 * \date created 2007/03/07
|
tomwalters@296
|
25 * \version \$Id$
|
tomwalters@268
|
26 */
|
tomwalters@268
|
27
|
tomwalters@283
|
28 #ifndef AIMC_MODULES_NAP_HCL_H_
|
tomwalters@283
|
29 #define AIMC_MODULES_NAP_HCL_H_
|
tomwalters@268
|
30
|
tomwalters@268
|
31 #include <vector>
|
tomwalters@268
|
32
|
tomwalters@268
|
33 #include "Support/Module.h"
|
tomwalters@268
|
34 #include "Support/SignalBank.h"
|
tomwalters@268
|
35
|
tomwalters@268
|
36 namespace aimc {
|
tomwalters@268
|
37 using std::vector;
|
tomwalters@268
|
38 class ModuleHCL : public Module {
|
tomwalters@268
|
39 public:
|
tomwalters@280
|
40 explicit ModuleHCL(Parameters *parameters);
|
tomwalters@268
|
41 virtual ~ModuleHCL();
|
tomwalters@268
|
42
|
tomwalters@268
|
43 virtual void Process(const SignalBank &input);
|
tomwalters@268
|
44
|
tomwalters@268
|
45 private:
|
tomwalters@268
|
46 /*! \brief Prepare the module
|
tomwalters@268
|
47 * \param input Input signal bank
|
tomwalters@268
|
48 * \param output true on success false on failure
|
tomwalters@268
|
49 */
|
tomwalters@268
|
50 virtual bool InitializeInternal(const SignalBank &input);
|
tomwalters@268
|
51
|
tomwalters@275
|
52 virtual void ResetInternal();
|
tomwalters@275
|
53
|
tomwalters@280
|
54 /*! \brief Do lowpass filtering?
|
tomwalters@280
|
55 */
|
tomwalters@268
|
56 bool do_lowpass_;
|
tomwalters@268
|
57
|
tomwalters@280
|
58 /*! \brief Do log compression?
|
tomwalters@280
|
59 */
|
tomwalters@268
|
60 bool do_log_;
|
tomwalters@268
|
61
|
tomwalters@280
|
62 /*! \brief Cutoff frequency for lowpass filter
|
tomwalters@280
|
63 */
|
tomwalters@268
|
64 float lowpass_cutoff_;
|
tomwalters@268
|
65
|
tomwalters@280
|
66 /*! \brief Order of Lowpass Filter
|
tomwalters@280
|
67 */
|
tomwalters@268
|
68 int lowpass_order_;
|
tomwalters@268
|
69
|
tomwalters@280
|
70 /*! \brief Internal record of the number of channels in the input
|
tomwalters@280
|
71 */
|
tomwalters@268
|
72 int channel_count_;
|
tomwalters@268
|
73
|
tomwalters@280
|
74 /*! \brief Time constant corresponsing to the lowpass filter
|
tomwalters@280
|
75 * cutoff freqency
|
tomwalters@280
|
76 */
|
tomwalters@268
|
77 float time_constant_;
|
tomwalters@268
|
78
|
tomwalters@280
|
79 /*! \brief Lowpass filter state variables
|
tomwalters@280
|
80 */
|
tomwalters@268
|
81 float xn_;
|
tomwalters@268
|
82 float yn_;
|
tomwalters@268
|
83 vector<vector<float> > yns_;
|
tomwalters@268
|
84 };
|
tomwalters@268
|
85 } // namespace aimc
|
tomwalters@268
|
86
|
tomwalters@283
|
87 #endif // AIMC_MODULES_NAP_HCL_H_
|