annotate trunk/src/Modules/SAI/ModuleSAI.h @ 272:2147f317aedc

Created wiki page through web user interface.
author tomwalters
date Sun, 14 Feb 2010 22:42:58 +0000
parents e14c70d1b171
children ce2bab04f155
rev   line source
tomwalters@268 1 // Copyright 2006-2010, Thomas Walters
tomwalters@268 2 //
tomwalters@268 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@268 4 // http://www.acousticscale.org/AIMC
tomwalters@268 5 //
tomwalters@268 6 // This program is free software: you can redistribute it and/or modify
tomwalters@268 7 // it under the terms of the GNU General Public License as published by
tomwalters@268 8 // the Free Software Foundation, either version 3 of the License, or
tomwalters@268 9 // (at your option) any later version.
tomwalters@268 10 //
tomwalters@268 11 // This program is distributed in the hope that it will be useful,
tomwalters@268 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
tomwalters@268 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tomwalters@268 14 // GNU General Public License for more details.
tomwalters@268 15 //
tomwalters@268 16 // You should have received a copy of the GNU General Public License
tomwalters@268 17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
tomwalters@268 18
tomwalters@268 19 /*! \file
tomwalters@268 20 * \brief SAI module
tomwalters@268 21 */
tomwalters@268 22
tomwalters@268 23 /*! \author Thomas Walters <tom@acousticscale.org>
tomwalters@268 24 * \date created 2007/08/29
tomwalters@268 25 * \version \$Id: ModuleSAI.h 4 2010-02-03 18:44:58Z tcw $
tomwalters@268 26 */
tomwalters@268 27 #ifndef _AIMC_MODULE_SAI_H_
tomwalters@268 28 #define _AIMC_MODULE_SAI_H_
tomwalters@268 29
tomwalters@268 30 #include <vector>
tomwalters@268 31
tomwalters@268 32 #include "Support/Module.h"
tomwalters@268 33 #include "Support/SignalBank.h"
tomwalters@268 34 #include "Support/StrobeList.h"
tomwalters@268 35
tomwalters@268 36 namespace aimc {
tomwalters@268 37 using std::vector;
tomwalters@268 38 class ModuleSAI : public Module {
tomwalters@268 39 public:
tomwalters@268 40 ModuleSAI(Parameters *parameters);
tomwalters@268 41 virtual ~ModuleSAI();
tomwalters@268 42 void Process(const SignalBank &input);
tomwalters@268 43 void Reset();
tomwalters@268 44
tomwalters@268 45 private:
tomwalters@268 46 /*! \brief Prepare the module
tomwalters@268 47 * \param input Input signal bank
tomwalters@268 48 * \param output true on success false on failure
tomwalters@268 49 */
tomwalters@268 50 bool InitializeInternal(const SignalBank &input);
tomwalters@268 51
tomwalters@268 52 //! \brief Temporary buffer for constructing the current SAI frame
tomwalters@268 53 SignalBank sai_temp_;
tomwalters@268 54
tomwalters@268 55 //! \brief List of strobes for each channel
tomwalters@268 56 vector<StrobeList> active_strobes_;
tomwalters@268 57
tomwalters@268 58 //! \brief Buffer decay parameter
tomwalters@268 59 float buffer_memory_decay_;
tomwalters@268 60
tomwalters@268 61 //! \brief Sample index of minimum strobe delay
tomwalters@268 62 int min_strobe_delay_idx_;
tomwalters@268 63
tomwalters@268 64 //! \brief Sample index of maximum strobe delay
tomwalters@268 65 int max_strobe_delay_idx_;
tomwalters@268 66
tomwalters@268 67 //! \brief Factor with which the SAI should be decayed
tomwalters@268 68 float sai_decay_factor_;
tomwalters@268 69
tomwalters@268 70 //! \brief Precomputed 1/n^alpha values for strobe weighting
tomwalters@268 71 vector<float> strobe_weights_;
tomwalters@268 72
tomwalters@268 73 //! \brief Next Strobe for each channels
tomwalters@268 74 vector<int> next_strobes_;
tomwalters@268 75
tomwalters@268 76 float strobe_weight_alpha_;
tomwalters@268 77
tomwalters@268 78 /*! \brief The maximum number strobes that can be active at the same time.
tomwalters@268 79 *
tomwalters@268 80 * A strobe lasts for strobe.maxdelay, there can only be a certain number
tomwalters@268 81 * of strobes active at the same time, that's this value. It's used for
tomwalters@268 82 * allocating memory buffers, like m_pUnfinishedStrobeCount and
tomwalters@268 83 * m_pStrobeWeights.
tomwalters@268 84 */
tomwalters@268 85 int max_concurrent_strobes_;
tomwalters@268 86
tomwalters@268 87 int fire_period_samples_;
tomwalters@268 88 int fire_counter_;
tomwalters@268 89
tomwalters@268 90 //! \brief Period in milliseconds between output frames
tomwalters@268 91 float output_frame_period_ms_;
tomwalters@268 92
tomwalters@268 93 //! \brief Time of the last frame output
tomwalters@268 94 float last_output_frame_time_ms_;
tomwalters@268 95 };
tomwalters@268 96 } // namespace aimc
tomwalters@268 97
tomwalters@268 98 #endif // _AIMC_MODULE_SAI_H_