Mercurial > hg > svcore
comparison data/model/ReadOnlyWaveFileModel.cpp @ 1457:0925b37a3ed1
Some messing around with profiling
author | Chris Cannam |
---|---|
date | Tue, 24 Apr 2018 14:13:51 +0100 |
parents | 87ae75da6527 |
children | 710e6250a401 |
comparison
equal
deleted
inserted
replaced
1456:904e031c9c76 | 1457:0925b37a3ed1 |
---|---|
205 if (m_reader) return m_reader->getLocalFilename(); | 205 if (m_reader) return m_reader->getLocalFilename(); |
206 return ""; | 206 return ""; |
207 } | 207 } |
208 | 208 |
209 floatvec_t | 209 floatvec_t |
210 ReadOnlyWaveFileModel::getData(int channel, sv_frame_t start, sv_frame_t count) const | 210 ReadOnlyWaveFileModel::getData(int channel, |
211 { | 211 sv_frame_t start, |
212 // Read directly from the file. This is used for e.g. audio | 212 sv_frame_t count) |
213 // playback or input to transforms. | 213 const |
214 | 214 { |
215 // Read a single channel (if channel >= 0) or a mixdown of all | |
216 // channels (if channel == -1) directly from the file. This is | |
217 // used for e.g. audio playback or input to transforms. | |
218 | |
219 Profiler profiler("ReadOnlyWaveFileModel::getData"); | |
220 | |
215 #ifdef DEBUG_WAVE_FILE_MODEL | 221 #ifdef DEBUG_WAVE_FILE_MODEL |
216 cout << "ReadOnlyWaveFileModel::getData[" << this << "]: " << channel << ", " << start << ", " << count << endl; | 222 cout << "ReadOnlyWaveFileModel::getData[" << this << "]: " << channel << ", " << start << ", " << count << endl; |
217 #endif | 223 #endif |
218 | 224 |
219 int channels = getChannelCount(); | 225 int channels = getChannelCount(); |
266 | 272 |
267 vector<floatvec_t> | 273 vector<floatvec_t> |
268 ReadOnlyWaveFileModel::getMultiChannelData(int fromchannel, int tochannel, | 274 ReadOnlyWaveFileModel::getMultiChannelData(int fromchannel, int tochannel, |
269 sv_frame_t start, sv_frame_t count) const | 275 sv_frame_t start, sv_frame_t count) const |
270 { | 276 { |
271 // Read directly from the file. This is used for e.g. audio | 277 // Read a set of channels directly from the file. This is used |
272 // playback or input to transforms. | 278 // for e.g. audio playback or input to transforms. |
279 | |
280 Profiler profiler("ReadOnlyWaveFileModel::getMultiChannelData"); | |
273 | 281 |
274 #ifdef DEBUG_WAVE_FILE_MODEL | 282 #ifdef DEBUG_WAVE_FILE_MODEL |
275 cout << "ReadOnlyWaveFileModel::getData[" << this << "]: " << fromchannel << "," << tochannel << ", " << start << ", " << count << endl; | 283 cout << "ReadOnlyWaveFileModel::getData[" << this << "]: " << fromchannel << "," << tochannel << ", " << start << ", " << count << endl; |
276 #endif | 284 #endif |
277 | 285 |
278 int channels = getChannelCount(); | 286 int channels = getChannelCount(); |
279 | 287 |
280 if (fromchannel > tochannel) { | 288 if (fromchannel > tochannel) { |
281 SVCERR << "ERROR: ReadOnlyWaveFileModel::getData: fromchannel (" | 289 SVCERR << "ERROR: ReadOnlyWaveFileModel::getMultiChannelData: " |
282 << fromchannel << ") > tochannel (" << tochannel << ")" | 290 << "fromchannel (" << fromchannel |
283 << endl; | 291 << ") > tochannel (" << tochannel << ")" |
292 << endl; | |
284 return {}; | 293 return {}; |
285 } | 294 } |
286 | 295 |
287 if (tochannel >= channels) { | 296 if (tochannel >= channels) { |
288 SVCERR << "ERROR: ReadOnlyWaveFileModel::getData: tochannel (" | 297 SVCERR << "ERROR: ReadOnlyWaveFileModel::getMultiChannelData: " |
289 << tochannel << ") >= channel count (" << channels << ")" | 298 << "tochannel (" << tochannel |
290 << endl; | 299 << ") >= channel count (" << channels << ")" |
300 << endl; | |
291 return {}; | 301 return {}; |
292 } | 302 } |
293 | 303 |
294 if (!m_reader || !m_reader->isOK() || count == 0) { | 304 if (!m_reader || !m_reader->isOK() || count == 0) { |
295 return {}; | 305 return {}; |