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