annotate src/Modules/Strobes/ModuleParabola.h @ 15:b4cafba48e9d

-<math.h> replaced wit <cmath> where possible -SSI support added but not yet tested
author tomwalters
date Fri, 19 Feb 2010 15:19:27 +0000
parents bd370910aa05
children e361baf69120
rev   line source
tomwalters@5 1 // Copyright 2007-2010, Thomas Walters
tomwalters@5 2 //
tomwalters@5 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@5 4 // http://www.acousticscale.org/AIMC
tomwalters@5 5 //
tomwalters@5 6 // This program is free software: you can redistribute it and/or modify
tomwalters@5 7 // it under the terms of the GNU General Public License as published by
tomwalters@5 8 // the Free Software Foundation, either version 3 of the License, or
tomwalters@5 9 // (at your option) any later version.
tomwalters@5 10 //
tomwalters@5 11 // This program is distributed in the hope that it will be useful,
tomwalters@5 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@5 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@5 14 // GNU General Public License for more details.
tomwalters@5 15 //
tomwalters@5 16 // You should have received a copy of the GNU General Public License
tomwalters@5 17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
tomwalters@5 18
tomwalters@5 19 /*!
tomwalters@5 20 * \file
tomwalters@5 21 * \brief SAI 2003 module - for any output frame rate
tomwalters@5 22 *
tomwalters@11 23 * \author Thomas Walters <tom@acousticscale.org>
tomwalters@5 24 * \date created 2007/03/28
tomwalters@5 25 * \version \$Id$
tomwalters@5 26 */
tomwalters@5 27
tomwalters@11 28 #ifndef AIMC_MODULES_STROBES_PARABOLA_H_
tomwalters@11 29 #define AIMC_MODULES_STROBES_PARABOLA_H_
tomwalters@5 30
tomwalters@5 31 #include <vector>
tomwalters@5 32
tomwalters@5 33 #include "Support/Module.h"
tomwalters@5 34 #include "Support/Parameters.h"
tomwalters@5 35 #include "Support/SignalBank.h"
tomwalters@5 36
tomwalters@5 37 namespace aimc {
tomwalters@5 38 using std::vector;
tomwalters@5 39 class ModuleParabola : public Module {
tomwalters@5 40 public:
tomwalters@8 41 explicit ModuleParabola(Parameters *params);
tomwalters@7 42 virtual ~ModuleParabola();
tomwalters@7 43 void Process(const SignalBank& input);
tomwalters@8 44 private:
tomwalters@5 45 /*! \brief Prepare the module
tomwalters@7 46 * \param input Input signal bank
tomwalters@7 47 * \param output true on success false on failure
tomwalters@7 48 */
tomwalters@7 49 virtual bool InitializeInternal(const SignalBank& input);
tomwalters@5 50
tomwalters@7 51 virtual void ResetInternal();
tomwalters@5 52
tomwalters@5 53
tomwalters@8 54 /*! \brief Number of samples over which the strobe should be decayed to
tomwalters@8 55 * zero
tomwalters@8 56 */
tomwalters@7 57 int strobe_decay_samples_;
tomwalters@5 58
tomwalters@7 59 /*! \brief Current strobe thresholds, one for each bank channel.
tomwalters@7 60 *
tomwalters@7 61 * This value is decayed over time.
tomwalters@7 62 */
tomwalters@7 63 vector<float> threshold_;
tomwalters@5 64
tomwalters@7 65 /*! \brief Signal value at the last strobe, one for each bank channel.
tomwalters@7 66 *
tomwalters@7 67 * This value is not decayed over time.
tomwalters@7 68 */
tomwalters@7 69 vector<float> last_threshold_;
tomwalters@5 70
tomwalters@8 71 /*! \brief Parabola height parameter
tomwalters@8 72 */
tomwalters@5 73 float height_;
tomwalters@5 74
tomwalters@8 75 /*! \brief Parabola width paramters
tomwalters@8 76 */
tomwalters@5 77 float parabw_;
tomwalters@5 78
tomwalters@8 79 /*! \brief Parabola a value
tomwalters@8 80 */
tomwalters@5 81 vector<float> parab_a_;
tomwalters@5 82
tomwalters@8 83 /*! \brief Parabola b value
tomwalters@8 84 */
tomwalters@5 85 vector<float> parab_b_;
tomwalters@5 86
tomwalters@8 87 /*! \brief Parabola calculation variable
tomwalters@8 88 */
tomwalters@5 89 vector<float> parab_wnull_;
tomwalters@5 90
tomwalters@8 91 /*! \brief Parabola calculation variable
tomwalters@8 92 */
tomwalters@5 93 vector<int> parab_var_samples_;
tomwalters@5 94
tomwalters@8 95 /*! \brief Storage for the number of samples since the last strobe
tomwalters@8 96 */
tomwalters@5 97 vector<int> samples_since_last_strobe_;
tomwalters@5 98
tomwalters@5 99 vector<float> prev_sample_;
tomwalters@5 100 vector<float> curr_sample_;
tomwalters@5 101 vector<float> next_sample_;
tomwalters@5 102
tomwalters@5 103 float alpha_;
tomwalters@5 104 int channel_count_;
tomwalters@5 105 float sample_rate_;
tomwalters@5 106 float strobe_decay_time_;
tomwalters@5 107 int max_strobes_;
tomwalters@5 108 };
tomwalters@5 109 } // namespace aimc
tomwalters@5 110
tomwalters@11 111 #endif // AIMC_MODULES_STROBES_PARABOLA_H_