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@23: * \version \$Id$
tomwalters@0: */
tomwalters@11: #ifndef AIMC_MODULES_SAI_SAI_H_
tomwalters@11: #define AIMC_MODULES_SAI_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@8: explicit 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@8: /*! \brief Temporary buffer for constructing the current SAI frame
tomwalters@8: */
tomwalters@0: SignalBank sai_temp_;
tomwalters@0:
tomwalters@8: /*! \brief List of strobes for each channel
tomwalters@8: */
tomwalters@0: vector active_strobes_;
tomwalters@0:
tomwalters@8: /*! \brief Buffer decay parameter
tomwalters@8: */
tomwalters@0: float buffer_memory_decay_;
tomwalters@0:
tomwalters@8: /*! \brief Sample index of minimum strobe delay
tomwalters@8: */
tomwalters@0: int min_strobe_delay_idx_;
tomwalters@0:
tomwalters@8: /*! \brief Sample index of maximum strobe delay
tomwalters@8: */
tomwalters@0: int max_strobe_delay_idx_;
tomwalters@0:
tomwalters@8: /*! \brief Factor with which the SAI should be decayed
tomwalters@8: */
tomwalters@0: float sai_decay_factor_;
tomwalters@0:
tomwalters@8: /*! \brief Precomputed 1/n^alpha values for strobe weighting
tomwalters@8: */
tomwalters@0: vector strobe_weights_;
tomwalters@0:
tomwalters@8: /*! \brief Next Strobe for each channels
tomwalters@8: */
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@8: /*! \brief Period in milliseconds between output frames
tomwalters@8: */
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@11: #endif // AIMC_MODULES_SAI_SAI_H_