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