annotate 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
rev   line source
tomwalters@0 1 // Copyright 2007-2010, University of Cambridge
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@0 24 /* \author Tom Walters <tcw24@cam.ac.uk>
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@0 41 ModuleHCL(Parameters *parameters);
tomwalters@0 42 virtual ~ModuleHCL();
tomwalters@0 43
tomwalters@0 44 virtual void Process(const SignalBank &input);
tomwalters@0 45 virtual void Reset();
tomwalters@0 46
tomwalters@0 47 private:
tomwalters@0 48 /*! \brief Prepare the module
tomwalters@0 49 * \param input Input signal bank
tomwalters@0 50 * \param output true on success false on failure
tomwalters@0 51 */
tomwalters@0 52 virtual bool InitializeInternal(const SignalBank &input);
tomwalters@0 53
tomwalters@0 54 //! \brief Do lowpass filtering?
tomwalters@0 55 bool do_lowpass_;
tomwalters@0 56
tomwalters@0 57 //! \brief Do log compression?
tomwalters@0 58 bool do_log_;
tomwalters@0 59
tomwalters@0 60 //! \brief Cutoff frequency for lowpass filter
tomwalters@0 61 float lowpass_cutoff_;
tomwalters@0 62
tomwalters@0 63 //! \brief Order of Lowpass Filter
tomwalters@0 64 int lowpass_order_;
tomwalters@0 65
tomwalters@0 66 //! \brief Internal record of the number of channels in the input
tomwalters@0 67 int channel_count_;
tomwalters@0 68
tomwalters@0 69 //! \brief Time constant corresponsing to the lowpass filter cutoff freqency
tomwalters@0 70 float time_constant_;
tomwalters@0 71
tomwalters@0 72 //! \brief Lowpass filter state variables
tomwalters@0 73 float xn_;
tomwalters@0 74 float yn_;
tomwalters@0 75 vector<vector<float> > yns_;
tomwalters@0 76 };
tomwalters@0 77 } // namespace aimc
tomwalters@0 78
tomwalters@0 79 #endif // _AIMC_MODULE_NAP_HCL_H_