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@268: // This program is free software: you can redistribute it and/or modify
tomwalters@268: // it under the terms of the GNU General Public License as published by
tomwalters@268: // the Free Software Foundation, either version 3 of the License, or
tomwalters@268: // (at your option) any later version.
tomwalters@268: //
tomwalters@268: // This program is distributed in the hope that it will be useful,
tomwalters@268: // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@268: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@268: // GNU General Public License for more details.
tomwalters@268: //
tomwalters@268: // You should have received a copy of the GNU General Public License
tomwalters@268: // along with this program. If not, see .
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_