annotate trunk/src/Modules/Strobes/ModuleParabola.h @ 402:69466da9745e

- Massive refactoring to make module tree stuff work. In theory we now support configuration files again. The graphics stuff is untested as yet.
author tomwalters
date Mon, 18 Oct 2010 04:42:28 +0000
parents 30dde71d0230
children
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@318 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@318 7 // you may not use this file except in compliance with the License.
tomwalters@318 8 // You may obtain a copy of the License at
tomwalters@277 9 //
tomwalters@318 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@277 11 //
tomwalters@318 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@318 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@318 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@318 15 // See the License for the specific language governing permissions and
tomwalters@318 16 // limitations under the License.
tomwalters@277 17
tomwalters@277 18 /*!
tomwalters@277 19 * \file
tomwalters@277 20 * \brief SAI 2003 module - for any output frame rate
tomwalters@277 21 *
tomwalters@283 22 * \author Thomas Walters <tom@acousticscale.org>
tomwalters@277 23 * \date created 2007/03/28
tomwalters@277 24 * \version \$Id$
tomwalters@277 25 */
tomwalters@277 26
tomwalters@283 27 #ifndef AIMC_MODULES_STROBES_PARABOLA_H_
tomwalters@283 28 #define AIMC_MODULES_STROBES_PARABOLA_H_
tomwalters@277 29
tomwalters@277 30 #include <vector>
tomwalters@277 31
tomwalters@277 32 #include "Support/Module.h"
tomwalters@277 33 #include "Support/Parameters.h"
tomwalters@277 34 #include "Support/SignalBank.h"
tomwalters@277 35
tomwalters@277 36 namespace aimc {
tomwalters@277 37 using std::vector;
tomwalters@277 38 class ModuleParabola : public Module {
tomwalters@277 39 public:
tomwalters@280 40 explicit ModuleParabola(Parameters *params);
tomwalters@279 41 virtual ~ModuleParabola();
tomwalters@279 42 void Process(const SignalBank& input);
tomwalters@280 43 private:
tomwalters@277 44 /*! \brief Prepare the module
tomwalters@279 45 * \param input Input signal bank
tomwalters@279 46 * \param output true on success false on failure
tomwalters@279 47 */
tomwalters@279 48 virtual bool InitializeInternal(const SignalBank& input);
tomwalters@277 49
tomwalters@279 50 virtual void ResetInternal();
tomwalters@277 51
tomwalters@277 52
tomwalters@280 53 /*! \brief Number of samples over which the strobe should be decayed to
tomwalters@280 54 * zero
tomwalters@280 55 */
tomwalters@279 56 int strobe_decay_samples_;
tomwalters@277 57
tomwalters@279 58 /*! \brief Current strobe thresholds, one for each bank channel.
tomwalters@279 59 *
tomwalters@279 60 * This value is decayed over time.
tomwalters@279 61 */
tomwalters@279 62 vector<float> threshold_;
tomwalters@277 63
tomwalters@279 64 /*! \brief Signal value at the last strobe, one for each bank channel.
tomwalters@279 65 *
tomwalters@279 66 * This value is not decayed over time.
tomwalters@279 67 */
tomwalters@279 68 vector<float> last_threshold_;
tomwalters@277 69
tomwalters@280 70 /*! \brief Parabola height parameter
tomwalters@280 71 */
tomwalters@277 72 float height_;
tomwalters@277 73
tomwalters@280 74 /*! \brief Parabola width paramters
tomwalters@280 75 */
tomwalters@277 76 float parabw_;
tomwalters@277 77
tomwalters@280 78 /*! \brief Parabola a value
tomwalters@280 79 */
tomwalters@277 80 vector<float> parab_a_;
tomwalters@277 81
tomwalters@280 82 /*! \brief Parabola b value
tomwalters@280 83 */
tomwalters@277 84 vector<float> parab_b_;
tomwalters@277 85
tomwalters@280 86 /*! \brief Parabola calculation variable
tomwalters@280 87 */
tomwalters@277 88 vector<float> parab_wnull_;
tomwalters@277 89
tomwalters@280 90 /*! \brief Parabola calculation variable
tomwalters@280 91 */
tomwalters@277 92 vector<int> parab_var_samples_;
tomwalters@277 93
tomwalters@280 94 /*! \brief Storage for the number of samples since the last strobe
tomwalters@280 95 */
tomwalters@277 96 vector<int> samples_since_last_strobe_;
tomwalters@277 97
tomwalters@277 98 vector<float> prev_sample_;
tomwalters@277 99 vector<float> curr_sample_;
tomwalters@277 100 vector<float> next_sample_;
tomwalters@277 101
tomwalters@277 102 float alpha_;
tomwalters@277 103 int channel_count_;
tomwalters@277 104 float sample_rate_;
tomwalters@277 105 float strobe_decay_time_;
tomwalters@277 106 };
tomwalters@277 107 } // namespace aimc
tomwalters@277 108
tomwalters@283 109 #endif // AIMC_MODULES_STROBES_PARABOLA_H_