tomwalters@10: // Copyright 2007-2010, Thomas Walters tomwalters@0: // tomwalters@0: // AIM-C: A C++ implementation of the Auditory Image Model tomwalters@0: // http://www.acousticscale.org/AIMC tomwalters@0: // tomwalters@45: // Licensed under the Apache License, Version 2.0 (the "License"); tomwalters@45: // you may not use this file except in compliance with the License. tomwalters@45: // You may obtain a copy of the License at tomwalters@0: // tomwalters@45: // http://www.apache.org/licenses/LICENSE-2.0 tomwalters@0: // tomwalters@45: // Unless required by applicable law or agreed to in writing, software tomwalters@45: // distributed under the License is distributed on an "AS IS" BASIS, tomwalters@45: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. tomwalters@45: // See the License for the specific language governing permissions and tomwalters@45: // limitations under the License. tomwalters@0: tomwalters@0: /*! tomwalters@0: * \file tomwalters@0: * \brief Halfwave rectification, compression and lowpass filtering tomwalters@0: */ tomwalters@0: tomwalters@10: /* \author Thomas Walters tomwalters@0: * \date created 2007/03/07 tomwalters@23: * \version \$Id$ tomwalters@0: */ tomwalters@0: tomwalters@11: #ifndef AIMC_MODULES_NAP_HCL_H_ tomwalters@11: #define AIMC_MODULES_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@8: explicit 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@8: /*! \brief Do lowpass filtering? tomwalters@8: */ tomwalters@0: bool do_lowpass_; tomwalters@0: tomwalters@8: /*! \brief Do log compression? tomwalters@8: */ tomwalters@0: bool do_log_; tomwalters@0: tomwalters@8: /*! \brief Cutoff frequency for lowpass filter tomwalters@8: */ tomwalters@0: float lowpass_cutoff_; tomwalters@0: tomwalters@8: /*! \brief Order of Lowpass Filter tomwalters@8: */ tomwalters@0: int lowpass_order_; tomwalters@0: tomwalters@8: /*! \brief Internal record of the number of channels in the input tomwalters@8: */ tomwalters@0: int channel_count_; tomwalters@0: tomwalters@8: /*! \brief Time constant corresponsing to the lowpass filter tomwalters@8: * cutoff freqency tomwalters@8: */ tomwalters@0: float time_constant_; tomwalters@0: tomwalters@8: /*! \brief Lowpass filter state variables tomwalters@8: */ tomwalters@0: float xn_; tomwalters@0: float yn_; tomwalters@0: vector > yns_; tomwalters@0: }; tomwalters@0: } // namespace aimc tomwalters@0: tomwalters@11: #endif // AIMC_MODULES_NAP_HCL_H_