tomwalters@277: // Copyright 2007-2010, Thomas Walters
tomwalters@277: //
tomwalters@277: // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@277: // http://www.acousticscale.org/AIMC
tomwalters@277: //
tomwalters@277: // This program is free software: you can redistribute it and/or modify
tomwalters@277: // it under the terms of the GNU General Public License as published by
tomwalters@277: // the Free Software Foundation, either version 3 of the License, or
tomwalters@277: // (at your option) any later version.
tomwalters@277: //
tomwalters@277: // This program is distributed in the hope that it will be useful,
tomwalters@277: // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@277: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@277: // GNU General Public License for more details.
tomwalters@277: //
tomwalters@277: // You should have received a copy of the GNU General Public License
tomwalters@277: // along with this program. If not, see .
tomwalters@277:
tomwalters@277: /*!
tomwalters@277: * \file
tomwalters@277: * \brief SAI 2003 module - for any output frame rate
tomwalters@277: *
tomwalters@277: * \author Tom Walters
tomwalters@277: * \date created 2007/03/28
tomwalters@277: * \version \$Id$
tomwalters@277: */
tomwalters@277:
tomwalters@277: #ifndef _AIMC_MODULE_STROBES_PARABOLA_H_
tomwalters@277: #define _AIMC_MODULE_STROBES_PARABOLA_H_
tomwalters@277:
tomwalters@277: #include
tomwalters@277:
tomwalters@277: #include "Support/Module.h"
tomwalters@277: #include "Support/Parameters.h"
tomwalters@277: #include "Support/SignalBank.h"
tomwalters@277:
tomwalters@277: /*!
tomwalters@277: * \class ModuleParabola "Modules/SAI/ModuleParabola.h"
tomwalters@277: * \brief SF 2003
tomwalters@277: */
tomwalters@277: namespace aimc {
tomwalters@277: using std::vector;
tomwalters@277: class ModuleParabola : public Module {
tomwalters@277: public:
tomwalters@280: explicit ModuleParabola(Parameters *params);
tomwalters@279: virtual ~ModuleParabola();
tomwalters@279: void Process(const SignalBank& input);
tomwalters@280: private:
tomwalters@277: /*! \brief Prepare the module
tomwalters@279: * \param input Input signal bank
tomwalters@279: * \param output true on success false on failure
tomwalters@279: */
tomwalters@279: virtual bool InitializeInternal(const SignalBank& input);
tomwalters@277:
tomwalters@279: virtual void ResetInternal();
tomwalters@277:
tomwalters@277:
tomwalters@280: /*! \brief Number of samples over which the strobe should be decayed to
tomwalters@280: * zero
tomwalters@280: */
tomwalters@279: int strobe_decay_samples_;
tomwalters@277:
tomwalters@279: /*! \brief Current strobe thresholds, one for each bank channel.
tomwalters@279: *
tomwalters@279: * This value is decayed over time.
tomwalters@279: */
tomwalters@279: vector threshold_;
tomwalters@277:
tomwalters@279: /*! \brief Signal value at the last strobe, one for each bank channel.
tomwalters@279: *
tomwalters@279: * This value is not decayed over time.
tomwalters@279: */
tomwalters@279: vector last_threshold_;
tomwalters@277:
tomwalters@280: /*! \brief Parabola height parameter
tomwalters@280: */
tomwalters@277: float height_;
tomwalters@277:
tomwalters@280: /*! \brief Parabola width paramters
tomwalters@280: */
tomwalters@277: float parabw_;
tomwalters@277:
tomwalters@280: /*! \brief Parabola a value
tomwalters@280: */
tomwalters@277: vector parab_a_;
tomwalters@277:
tomwalters@280: /*! \brief Parabola b value
tomwalters@280: */
tomwalters@277: vector parab_b_;
tomwalters@277:
tomwalters@280: /*! \brief Parabola calculation variable
tomwalters@280: */
tomwalters@277: vector parab_wnull_;
tomwalters@277:
tomwalters@280: /*! \brief Parabola calculation variable
tomwalters@280: */
tomwalters@277: vector parab_var_samples_;
tomwalters@277:
tomwalters@280: /*! \brief Storage for the number of samples since the last strobe
tomwalters@280: */
tomwalters@277: vector samples_since_last_strobe_;
tomwalters@277:
tomwalters@277: vector prev_sample_;
tomwalters@277: vector curr_sample_;
tomwalters@277: vector next_sample_;
tomwalters@277:
tomwalters@277: float alpha_;
tomwalters@277: int channel_count_;
tomwalters@277: float sample_rate_;
tomwalters@277: float strobe_decay_time_;
tomwalters@277: int max_strobes_;
tomwalters@277: };
tomwalters@277: } // namespace aimc
tomwalters@277:
tomwalters@277: #endif // _AIM_MODULE_STROBES_PARABOLA_H_