comparison trunk/src/Support/SignalBank.cc @ 277:6b4921704eb1

- Ported over HTK file output - Added some more meat to the Slaney IIR gammatone implementation - Ported over the AIM-MAT sf2003 parabola strobe algorithm - Finished making the SAI implementation compile - Ported over the strobe list class (now uses STL deques internally)
author tomwalters
date Thu, 18 Feb 2010 16:55:40 +0000
parents c26222c51fb7
children ed91095d9240
comparison
equal deleted inserted replaced
276:a57b29e373c7 277:6b4921704eb1
82 signals_.resize(channel_count_); 82 signals_.resize(channel_count_);
83 strobes_.resize(channel_count_); 83 strobes_.resize(channel_count_);
84 84
85 centre_frequencies_.resize(channel_count_, 0.0f); 85 centre_frequencies_.resize(channel_count_, 0.0f);
86 for (int i = 0; i < channel_count_; ++i) { 86 for (int i = 0; i < channel_count_; ++i) {
87 centre_frequencies_[i] = input.get_centre_frequency(i); 87 centre_frequencies_[i] = input.centre_frequency(i);
88 } 88 }
89 89
90 for (int i = 0; i < channel_count_; ++i) { 90 for (int i = 0; i < channel_count_; ++i) {
91 signals_[i].resize(buffer_length_, 0.0f); 91 signals_[i].resize(buffer_length_, 0.0f);
92 strobes_[i].resize(0);
92 } 93 }
93 initialized_ = true; 94 initialized_ = true;
94 return true; 95 return true;
95 } 96 }
96 97
120 121
121 void SignalBank::set_sample(int channel, int index, float value) { 122 void SignalBank::set_sample(int channel, int index, float value) {
122 signals_[channel][index] = value; 123 signals_[channel][index] = value;
123 } 124 }
124 125
125 const deque<int> &SignalBank::strobes(int channel) const { 126 int SignalBank::strobe(int channel, int index) const {
126 return strobes_[channel]; 127 return strobes_[channel][index];
128 }
129
130 int SignalBank::strobe_count(int channel) const {
131 return strobes_[channel].size();
132 }
133
134 void SignalBank::AddStrobe(int channel, int time) {
135 strobes_[channel].push_back(time);
136 }
137
138 void SignalBank::ResetStrobes(int channel) {
139 strobes_[channel].resize(0);
127 } 140 }
128 141
129 float SignalBank::sample_rate() const { 142 float SignalBank::sample_rate() const {
130 return sample_rate_; 143 return sample_rate_;
131 } 144 }
140 153
141 void SignalBank::set_start_time(int start_time) { 154 void SignalBank::set_start_time(int start_time) {
142 start_time_ = start_time; 155 start_time_ = start_time;
143 } 156 }
144 157
145 float SignalBank::get_centre_frequency(int i) const { 158 float SignalBank::centre_frequency(int i) const {
146 if (i < channel_count_) 159 if (i < channel_count_)
147 return centre_frequencies_[i]; 160 return centre_frequencies_[i];
148 else 161 else
149 return 0.0f; 162 return 0.0f;
150 } 163 }