tomwalters@0: // Copyright 2007-2010, University of Cambridge tomwalters@0: // tomwalters@0: // AIM-C: A C++ implementation of the Auditory Image Model tomwalters@0: // http://www.acousticscale.org/AIMC tomwalters@0: // tomwalters@0: // This program is free software: you can redistribute it and/or modify tomwalters@0: // it under the terms of the GNU General Public License as published by tomwalters@0: // the Free Software Foundation, either version 3 of the License, or tomwalters@0: // (at your option) any later version. tomwalters@0: // tomwalters@0: // This program is distributed in the hope that it will be useful, tomwalters@0: // but WITHOUT ANY WARRANTY; without even the implied warranty of tomwalters@0: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the tomwalters@0: // GNU General Public License for more details. tomwalters@0: // tomwalters@0: // You should have received a copy of the GNU General Public License tomwalters@0: // along with this program. If not, see . tomwalters@0: tomwalters@0: /*! tomwalters@0: * \file tomwalters@0: * \brief Halfwave rectification, compression and lowpass filtering tomwalters@0: */ tomwalters@0: tomwalters@0: /* \author Tom Walters tomwalters@0: * \date created 2007/03/07 tomwalters@0: * \version \$Id: ModuleHCL.h 4 2010-02-03 18:44:58Z tcw $ tomwalters@0: */ tomwalters@0: tomwalters@0: #ifndef _AIMC_MODULE_NAP_HCL_H_ tomwalters@0: #define _AIMC_MODULE_NAP_HCL_H_ tomwalters@0: tomwalters@0: #include tomwalters@0: tomwalters@0: #include "Support/Module.h" tomwalters@0: #include "Support/SignalBank.h" tomwalters@0: tomwalters@0: namespace aimc { tomwalters@0: using std::vector; tomwalters@0: class ModuleHCL : public Module { tomwalters@0: public: tomwalters@0: ModuleHCL(Parameters *parameters); tomwalters@0: virtual ~ModuleHCL(); tomwalters@0: tomwalters@0: virtual void Process(const SignalBank &input); tomwalters@0: tomwalters@0: private: tomwalters@0: /*! \brief Prepare the module tomwalters@0: * \param input Input signal bank tomwalters@0: * \param output true on success false on failure tomwalters@0: */ tomwalters@0: virtual bool InitializeInternal(const SignalBank &input); tomwalters@0: tomwalters@3: virtual void ResetInternal(); tomwalters@3: tomwalters@0: //! \brief Do lowpass filtering? tomwalters@0: bool do_lowpass_; tomwalters@0: tomwalters@0: //! \brief Do log compression? tomwalters@0: bool do_log_; tomwalters@0: tomwalters@0: //! \brief Cutoff frequency for lowpass filter tomwalters@0: float lowpass_cutoff_; tomwalters@0: tomwalters@0: //! \brief Order of Lowpass Filter tomwalters@0: int lowpass_order_; tomwalters@0: tomwalters@0: //! \brief Internal record of the number of channels in the input tomwalters@0: int channel_count_; tomwalters@0: tomwalters@0: //! \brief Time constant corresponsing to the lowpass filter cutoff freqency tomwalters@0: float time_constant_; tomwalters@0: tomwalters@0: //! \brief Lowpass filter state variables tomwalters@0: float xn_; tomwalters@0: float yn_; tomwalters@0: vector > yns_; tomwalters@0: }; tomwalters@0: } // namespace aimc tomwalters@0: tomwalters@0: #endif // _AIMC_MODULE_NAP_HCL_H_