tomwalters@277: // Copyright 2007-2010, Thomas Walters tomwalters@277: // tomwalters@277: // AIM-C: A C++ implementation of the Auditory Image Model tomwalters@277: // http://www.acousticscale.org/AIMC tomwalters@277: // tomwalters@318: // Licensed under the Apache License, Version 2.0 (the "License"); tomwalters@318: // you may not use this file except in compliance with the License. tomwalters@318: // You may obtain a copy of the License at tomwalters@277: // tomwalters@318: // http://www.apache.org/licenses/LICENSE-2.0 tomwalters@277: // tomwalters@318: // Unless required by applicable law or agreed to in writing, software tomwalters@318: // distributed under the License is distributed on an "AS IS" BASIS, tomwalters@318: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. tomwalters@318: // See the License for the specific language governing permissions and tomwalters@318: // limitations under the License. tomwalters@277: tomwalters@277: /*! tomwalters@277: * \file tomwalters@277: * \brief SAI 2003 module - for any output frame rate tomwalters@277: * tomwalters@283: * \author Thomas Walters tomwalters@277: * \date created 2007/03/28 tomwalters@277: * \version \$Id$ tomwalters@277: */ tomwalters@277: tomwalters@283: #ifndef AIMC_MODULES_STROBES_PARABOLA_H_ tomwalters@283: #define AIMC_MODULES_STROBES_PARABOLA_H_ tomwalters@277: tomwalters@277: #include tomwalters@277: tomwalters@277: #include "Support/Module.h" tomwalters@277: #include "Support/Parameters.h" tomwalters@277: #include "Support/SignalBank.h" tomwalters@277: tomwalters@277: namespace aimc { tomwalters@277: using std::vector; tomwalters@277: class ModuleParabola : public Module { tomwalters@277: public: tomwalters@280: explicit ModuleParabola(Parameters *params); tomwalters@279: virtual ~ModuleParabola(); tomwalters@279: void Process(const SignalBank& input); tomwalters@280: private: tomwalters@277: /*! \brief Prepare the module tomwalters@279: * \param input Input signal bank tomwalters@279: * \param output true on success false on failure tomwalters@279: */ tomwalters@279: virtual bool InitializeInternal(const SignalBank& input); tomwalters@277: tomwalters@279: virtual void ResetInternal(); tomwalters@277: tomwalters@277: tomwalters@280: /*! \brief Number of samples over which the strobe should be decayed to tomwalters@280: * zero tomwalters@280: */ tomwalters@279: int strobe_decay_samples_; tomwalters@277: tomwalters@279: /*! \brief Current strobe thresholds, one for each bank channel. tomwalters@279: * tomwalters@279: * This value is decayed over time. tomwalters@279: */ tomwalters@279: vector threshold_; tomwalters@277: tomwalters@279: /*! \brief Signal value at the last strobe, one for each bank channel. tomwalters@279: * tomwalters@279: * This value is not decayed over time. tomwalters@279: */ tomwalters@279: vector last_threshold_; tomwalters@277: tomwalters@280: /*! \brief Parabola height parameter tomwalters@280: */ tomwalters@277: float height_; tomwalters@277: tomwalters@280: /*! \brief Parabola width paramters tomwalters@280: */ tomwalters@277: float parabw_; tomwalters@277: tomwalters@280: /*! \brief Parabola a value tomwalters@280: */ tomwalters@277: vector parab_a_; tomwalters@277: tomwalters@280: /*! \brief Parabola b value tomwalters@280: */ tomwalters@277: vector parab_b_; tomwalters@277: tomwalters@280: /*! \brief Parabola calculation variable tomwalters@280: */ tomwalters@277: vector parab_wnull_; tomwalters@277: tomwalters@280: /*! \brief Parabola calculation variable tomwalters@280: */ tomwalters@277: vector parab_var_samples_; tomwalters@277: tomwalters@280: /*! \brief Storage for the number of samples since the last strobe tomwalters@280: */ tomwalters@277: vector samples_since_last_strobe_; tomwalters@277: tomwalters@277: vector prev_sample_; tomwalters@277: vector curr_sample_; tomwalters@277: vector next_sample_; tomwalters@277: tomwalters@277: float alpha_; tomwalters@277: int channel_count_; tomwalters@277: float sample_rate_; tomwalters@277: float strobe_decay_time_; tomwalters@277: }; tomwalters@277: } // namespace aimc tomwalters@277: tomwalters@283: #endif // AIMC_MODULES_STROBES_PARABOLA_H_