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