annotate trunk/src/Modules/Strobes/ModuleParabola.h @ 283:ef14c9f2c1d2

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