view trunk/src/Modules/Strobes/ModuleParabola.h @ 298:35a8fbf4ff82

-Added a bit of junk to try and build a bianry for OS X 10.4 in SConstruct -Fixes to the FileList to build on linux - hopefully
author tomwalters
date Tue, 23 Feb 2010 21:51:11 +0000
parents ef14c9f2c1d2
children 30dde71d0230
line wrap: on
line source
// Copyright 2007-2010, Thomas Walters
//
// AIM-C: A C++ implementation of the Auditory Image Model
// http://www.acousticscale.org/AIMC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

/*!
 * \file
 * \brief SAI 2003 module - for any output frame rate
 *
 * \author Thomas Walters <tom@acousticscale.org>
 * \date created 2007/03/28
 * \version \$Id$
 */

#ifndef AIMC_MODULES_STROBES_PARABOLA_H_
#define AIMC_MODULES_STROBES_PARABOLA_H_

#include <vector>

#include "Support/Module.h"
#include "Support/Parameters.h"
#include "Support/SignalBank.h"

namespace aimc {
using std::vector;
class ModuleParabola : public Module {
 public:
  explicit ModuleParabola(Parameters *params);
  virtual ~ModuleParabola();
  void Process(const SignalBank& input);
 private:
  /*! \brief Prepare the module
   *  \param input Input signal bank
   *  \param output true on success false on failure
   */
  virtual bool InitializeInternal(const SignalBank& input);

  virtual void ResetInternal();


  /*! \brief Number of samples over which the strobe should be decayed to
   *  zero
   */
  int strobe_decay_samples_;

  /*! \brief Current strobe thresholds, one for each bank channel.
   *
   *  This value is decayed over time.
   */
  vector<float> threshold_;

  /*! \brief Signal value at the last strobe, one for each bank channel.
   *
   *  This value is not decayed over time.
   */
  vector<float> last_threshold_;

  /*! \brief Parabola height parameter
   */
  float height_;

  /*! \brief Parabola width paramters
   */
  float parabw_;

  /*! \brief Parabola a value
   */
  vector<float> parab_a_;

  /*! \brief Parabola b value
   */
  vector<float> parab_b_;

  /*! \brief Parabola calculation variable
   */
  vector<float> parab_wnull_;

  /*! \brief Parabola calculation variable
   */
  vector<int> parab_var_samples_;

  /*! \brief Storage for the number of samples since the last strobe
   */
  vector<int> samples_since_last_strobe_;

  vector<float> prev_sample_;
  vector<float> curr_sample_;
  vector<float> next_sample_;

  float alpha_;
  int channel_count_;
  float sample_rate_;
  float strobe_decay_time_;
};
}  // namespace aimc

#endif  // AIMC_MODULES_STROBES_PARABOLA_H_