tomwalters@282: // Copyright 2007-2010, Thomas Walters tomwalters@268: // tomwalters@268: // AIM-C: A C++ implementation of the Auditory Image Model tomwalters@268: // http://www.acousticscale.org/AIMC tomwalters@268: // tomwalters@318: // Licensed under the Apache License, Version 2.0 (the "License"); tomwalters@318: // you may not use this file except in compliance with the License. tomwalters@318: // You may obtain a copy of the License at tomwalters@268: // tomwalters@318: // http://www.apache.org/licenses/LICENSE-2.0 tomwalters@268: // tomwalters@318: // Unless required by applicable law or agreed to in writing, software tomwalters@318: // distributed under the License is distributed on an "AS IS" BASIS, tomwalters@318: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. tomwalters@318: // See the License for the specific language governing permissions and tomwalters@318: // limitations under the License. tomwalters@268: tomwalters@268: /*! tomwalters@268: * \file tomwalters@268: * \brief Halfwave rectification, compression and lowpass filtering tomwalters@268: */ tomwalters@268: tomwalters@282: /* \author Thomas Walters tomwalters@268: * \date created 2007/03/07 tomwalters@296: * \version \$Id$ tomwalters@268: */ tomwalters@268: tomwalters@283: #ifndef AIMC_MODULES_NAP_HCL_H_ tomwalters@283: #define AIMC_MODULES_NAP_HCL_H_ tomwalters@268: tomwalters@268: #include tomwalters@268: tomwalters@268: #include "Support/Module.h" tomwalters@268: #include "Support/SignalBank.h" tomwalters@268: tomwalters@268: namespace aimc { tomwalters@268: using std::vector; tomwalters@268: class ModuleHCL : public Module { tomwalters@268: public: tomwalters@280: explicit ModuleHCL(Parameters *parameters); tomwalters@268: virtual ~ModuleHCL(); tomwalters@268: tomwalters@268: virtual void Process(const SignalBank &input); tomwalters@268: tomwalters@268: private: tomwalters@268: /*! \brief Prepare the module tomwalters@268: * \param input Input signal bank tomwalters@268: * \param output true on success false on failure tomwalters@268: */ tomwalters@268: virtual bool InitializeInternal(const SignalBank &input); tomwalters@268: tomwalters@275: virtual void ResetInternal(); tomwalters@275: tomwalters@280: /*! \brief Do lowpass filtering? tomwalters@280: */ tomwalters@268: bool do_lowpass_; tomwalters@268: tomwalters@280: /*! \brief Do log compression? tomwalters@280: */ tomwalters@268: bool do_log_; tomwalters@268: tomwalters@280: /*! \brief Cutoff frequency for lowpass filter tomwalters@280: */ tomwalters@268: float lowpass_cutoff_; tomwalters@268: tomwalters@280: /*! \brief Order of Lowpass Filter tomwalters@280: */ tomwalters@268: int lowpass_order_; tomwalters@268: tomwalters@280: /*! \brief Internal record of the number of channels in the input tomwalters@280: */ tomwalters@268: int channel_count_; tomwalters@268: tomwalters@280: /*! \brief Time constant corresponsing to the lowpass filter tomwalters@280: * cutoff freqency tomwalters@280: */ tomwalters@268: float time_constant_; tomwalters@268: tomwalters@280: /*! \brief Lowpass filter state variables tomwalters@280: */ tomwalters@268: float xn_; tomwalters@268: float yn_; tomwalters@268: vector > yns_; tomwalters@268: }; tomwalters@268: } // namespace aimc tomwalters@268: tomwalters@283: #endif // AIMC_MODULES_NAP_HCL_H_