tomwalters@268: // Copyright 2006-2010, Thomas Walters
tomwalters@268: //
tomwalters@268: // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@268: // http://www.acousticscale.org/AIMC
tomwalters@268: //
tomwalters@268: // This program is free software: you can redistribute it and/or modify
tomwalters@268: // it under the terms of the GNU General Public License as published by
tomwalters@268: // the Free Software Foundation, either version 3 of the License, or
tomwalters@268: // (at your option) any later version.
tomwalters@268: //
tomwalters@268: // This program is distributed in the hope that it will be useful,
tomwalters@268: // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@268: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@268: // GNU General Public License for more details.
tomwalters@268: //
tomwalters@268: // You should have received a copy of the GNU General Public License
tomwalters@268: // along with this program. If not, see .
tomwalters@268:
tomwalters@268: /*! \file
tomwalters@268: * \brief SAI module
tomwalters@268: */
tomwalters@268:
tomwalters@268: /*! \author Thomas Walters
tomwalters@268: * \date created 2007/08/29
tomwalters@296: * \version \$Id$
tomwalters@268: */
tomwalters@283: #ifndef AIMC_MODULES_SAI_SAI_H_
tomwalters@283: #define AIMC_MODULES_SAI_SAI_H_
tomwalters@268:
tomwalters@268: #include
tomwalters@268:
tomwalters@268: #include "Support/Module.h"
tomwalters@268: #include "Support/SignalBank.h"
tomwalters@268: #include "Support/StrobeList.h"
tomwalters@268:
tomwalters@268: namespace aimc {
tomwalters@268: using std::vector;
tomwalters@268: class ModuleSAI : public Module {
tomwalters@268: public:
tomwalters@280: explicit ModuleSAI(Parameters *parameters);
tomwalters@268: virtual ~ModuleSAI();
tomwalters@268: void Process(const SignalBank &input);
tomwalters@268:
tomwalters@268: private:
tomwalters@268: /*! \brief Prepare the module
tomwalters@268: * \param input Input signal bank
tomwalters@268: * \param output true on success false on failure
tomwalters@268: */
tomwalters@268: bool InitializeInternal(const SignalBank &input);
tomwalters@268:
tomwalters@275: virtual void ResetInternal();
tomwalters@275:
tomwalters@280: /*! \brief Temporary buffer for constructing the current SAI frame
tomwalters@280: */
tomwalters@268: SignalBank sai_temp_;
tomwalters@268:
tomwalters@280: /*! \brief List of strobes for each channel
tomwalters@280: */
tomwalters@268: vector active_strobes_;
tomwalters@268:
tomwalters@280: /*! \brief Buffer decay parameter
tomwalters@280: */
tomwalters@268: float buffer_memory_decay_;
tomwalters@268:
tomwalters@280: /*! \brief Sample index of minimum strobe delay
tomwalters@280: */
tomwalters@268: int min_strobe_delay_idx_;
tomwalters@268:
tomwalters@280: /*! \brief Sample index of maximum strobe delay
tomwalters@280: */
tomwalters@268: int max_strobe_delay_idx_;
tomwalters@268:
tomwalters@280: /*! \brief Factor with which the SAI should be decayed
tomwalters@280: */
tomwalters@268: float sai_decay_factor_;
tomwalters@268:
tomwalters@280: /*! \brief Precomputed 1/n^alpha values for strobe weighting
tomwalters@280: */
tomwalters@268: vector strobe_weights_;
tomwalters@268:
tomwalters@280: /*! \brief Next Strobe for each channels
tomwalters@280: */
tomwalters@268: vector next_strobes_;
tomwalters@268:
tomwalters@268: float strobe_weight_alpha_;
tomwalters@268:
tomwalters@268: /*! \brief The maximum number strobes that can be active at the same time.
tomwalters@268: *
tomwalters@268: */
tomwalters@268: int max_concurrent_strobes_;
tomwalters@268:
tomwalters@268: int fire_counter_;
tomwalters@268:
tomwalters@280: /*! \brief Period in milliseconds between output frames
tomwalters@280: */
tomwalters@277: float frame_period_ms_;
tomwalters@277: int frame_period_samples_;
tomwalters@268:
tomwalters@277: float min_delay_ms_;
tomwalters@277: float max_delay_ms_;
tomwalters@277: int channel_count_;
tomwalters@268: };
tomwalters@268: } // namespace aimc
tomwalters@268:
tomwalters@283: #endif // AIMC_MODULES_SAI_SAI_H_