comparison data/model/AggregateWaveModel.cpp @ 363:0e30c8ec15a0

* Add wave file model method for reading more than one channel at once, avoiding ludicrously expensive backward seeks and double-reads when playing multi-channel files or using them as inputs to feature extraction plugins
author Chris Cannam
date Thu, 24 Jan 2008 14:35:43 +0000
parents 70a232b1f12a
children 166c22eff678
comparison
equal deleted inserted replaced
362:cc4eb32efc6c 363:0e30c8ec15a0
173 } 173 }
174 174
175 if (mixing) delete[] readbuf; 175 if (mixing) delete[] readbuf;
176 return sz; 176 return sz;
177 } 177 }
178
179 size_t
180 AggregateWaveModel::getData(size_t fromchannel, size_t tochannel,
181 size_t start, size_t count,
182 float **buffer) const
183 {
184 size_t min = count;
185
186 for (size_t c = fromchannel; c <= tochannel; ++c) {
187 size_t here = getData(c, start, count, buffer[c - fromchannel]);
188 if (here < min) min = here;
189 }
190
191 return min;
192 }
178 193
179 void 194 void
180 AggregateWaveModel::getSummaries(size_t channel, size_t start, size_t count, 195 AggregateWaveModel::getSummaries(size_t channel, size_t start, size_t count,
181 RangeBlock &ranges, size_t &blockSize) const 196 RangeBlock &ranges, size_t &blockSize) const
182 { 197 {