annotate trunk/src/Modules/SAI/ModuleSAI.h @ 706:f8e90b5d85fd tip

Delete CARFAC code from this repository. It has been moved to https://github.com/google/carfac Please email me with your github username to get access. I've also created a new mailing list to discuss CARFAC development: https://groups.google.com/forum/#!forum/carfac-dev
author ronw@google.com
date Thu, 18 Jul 2013 20:56:51 +0000
parents 30dde71d0230
children
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@318 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@318 7 // you may not use this file except in compliance with the License.
tomwalters@318 8 // You may obtain a copy of the License at
tomwalters@268 9 //
tomwalters@318 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@268 11 //
tomwalters@318 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@318 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@318 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@318 15 // See the License for the specific language governing permissions and
tomwalters@318 16 // limitations under the License.
tomwalters@268 17
tomwalters@268 18 /*! \file
tomwalters@268 19 * \brief SAI module
tomwalters@268 20 */
tomwalters@268 21
tomwalters@268 22 /*! \author Thomas Walters <tom@acousticscale.org>
tomwalters@268 23 * \date created 2007/08/29
tomwalters@296 24 * \version \$Id$
tomwalters@268 25 */
tomwalters@283 26 #ifndef AIMC_MODULES_SAI_SAI_H_
tomwalters@283 27 #define AIMC_MODULES_SAI_SAI_H_
tomwalters@268 28
tomwalters@268 29 #include <vector>
tomwalters@268 30
tomwalters@268 31 #include "Support/Module.h"
tomwalters@268 32 #include "Support/SignalBank.h"
tomwalters@268 33 #include "Support/StrobeList.h"
tomwalters@268 34
tomwalters@268 35 namespace aimc {
tomwalters@268 36 using std::vector;
tomwalters@268 37 class ModuleSAI : public Module {
tomwalters@268 38 public:
tomwalters@280 39 explicit ModuleSAI(Parameters *parameters);
tomwalters@268 40 virtual ~ModuleSAI();
tomwalters@268 41 void Process(const SignalBank &input);
tomwalters@268 42
tomwalters@268 43 private:
tomwalters@268 44 /*! \brief Prepare the module
tomwalters@268 45 * \param input Input signal bank
tomwalters@268 46 * \param output true on success false on failure
tomwalters@268 47 */
tomwalters@268 48 bool InitializeInternal(const SignalBank &input);
tomwalters@268 49
tomwalters@275 50 virtual void ResetInternal();
tomwalters@275 51
tomwalters@280 52 /*! \brief Temporary buffer for constructing the current SAI frame
tomwalters@280 53 */
tomwalters@268 54 SignalBank sai_temp_;
tomwalters@268 55
tomwalters@280 56 /*! \brief List of strobes for each channel
tomwalters@280 57 */
tomwalters@268 58 vector<StrobeList> active_strobes_;
tomwalters@268 59
tomwalters@280 60 /*! \brief Buffer decay parameter
tomwalters@280 61 */
tomwalters@268 62 float buffer_memory_decay_;
tomwalters@268 63
tomwalters@280 64 /*! \brief Sample index of minimum strobe delay
tomwalters@280 65 */
tomwalters@268 66 int min_strobe_delay_idx_;
tomwalters@268 67
tomwalters@280 68 /*! \brief Sample index of maximum strobe delay
tomwalters@280 69 */
tomwalters@268 70 int max_strobe_delay_idx_;
tomwalters@268 71
tomwalters@280 72 /*! \brief Factor with which the SAI should be decayed
tomwalters@280 73 */
tomwalters@268 74 float sai_decay_factor_;
tomwalters@268 75
tomwalters@280 76 /*! \brief Precomputed 1/n^alpha values for strobe weighting
tomwalters@280 77 */
tomwalters@268 78 vector<float> strobe_weights_;
tomwalters@268 79
tomwalters@280 80 /*! \brief Next Strobe for each channels
tomwalters@280 81 */
tomwalters@268 82 vector<int> next_strobes_;
tomwalters@268 83
tomwalters@268 84 float strobe_weight_alpha_;
tomwalters@268 85
tomwalters@268 86 /*! \brief The maximum number strobes that can be active at the same time.
tomwalters@268 87 *
tomwalters@268 88 */
tomwalters@268 89 int max_concurrent_strobes_;
tomwalters@268 90
tomwalters@268 91 int fire_counter_;
tomwalters@268 92
tomwalters@280 93 /*! \brief Period in milliseconds between output frames
tomwalters@280 94 */
tomwalters@277 95 float frame_period_ms_;
tomwalters@277 96 int frame_period_samples_;
tomwalters@268 97
tomwalters@277 98 float min_delay_ms_;
tomwalters@277 99 float max_delay_ms_;
tomwalters@277 100 int channel_count_;
tomwalters@268 101 };
tomwalters@268 102 } // namespace aimc
tomwalters@268 103
tomwalters@283 104 #endif // AIMC_MODULES_SAI_SAI_H_