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