Mercurial > hg > svcore
comparison data/model/WaveFileModel.cpp @ 1041:843f67be0ed9 cxx11
Replace the get*Frames calls in AudioFileReader with less stupid API
author | Chris Cannam |
---|---|
date | Wed, 04 Mar 2015 12:30:41 +0000 |
parents | a1cd5abcb38b |
children | 16dc7307d43a |
comparison
equal
deleted
inserted
replaced
1040:a1cd5abcb38b | 1041:843f67be0ed9 |
---|---|
227 // << start << ", " << end << "): calling reader" << endl; | 227 // << start << ", " << end << "): calling reader" << endl; |
228 #endif | 228 #endif |
229 | 229 |
230 int channels = getChannelCount(); | 230 int channels = getChannelCount(); |
231 | 231 |
232 SampleBlock frames(count * channels); | 232 SampleBlock frames = m_reader->getInterleavedFrames(start, count); |
233 m_reader->getInterleavedFrames(start, count, frames); | |
234 | 233 |
235 sv_frame_t i = 0; | 234 sv_frame_t i = 0; |
236 | 235 |
237 int ch0 = channel, ch1 = channel; | 236 int ch0 = channel, ch1 = channel; |
238 if (channel == -1) { | 237 if (channel == -1) { |
284 return 0; | 283 return 0; |
285 } | 284 } |
286 | 285 |
287 int channels = getChannelCount(); | 286 int channels = getChannelCount(); |
288 | 287 |
289 SampleBlock frames(count * channels); | 288 SampleBlock frames = m_reader->getInterleavedFrames(start, count); |
290 m_reader->getInterleavedFrames(start, count, frames); | |
291 | 289 |
292 sv_frame_t i = 0; | 290 sv_frame_t i = 0; |
293 | 291 |
294 int ch0 = channel, ch1 = channel; | 292 int ch0 = channel, ch1 = channel; |
295 if (channel == -1) { | 293 if (channel == -1) { |
370 for (sv_frame_t i = 0; i < count; ++i) buffer[c][i] = 0.f; | 368 for (sv_frame_t i = 0; i < count; ++i) buffer[c][i] = 0.f; |
371 } | 369 } |
372 return 0; | 370 return 0; |
373 } | 371 } |
374 | 372 |
375 SampleBlock frames(count * channels); | 373 SampleBlock frames = m_reader->getInterleavedFrames(start, count); |
376 m_reader->getInterleavedFrames(start, count, frames); | |
377 | 374 |
378 sv_frame_t i = 0; | 375 sv_frame_t i = 0; |
379 | 376 |
380 sv_frame_t index = 0, available = frames.size(); | 377 sv_frame_t index = 0, available = frames.size(); |
381 | 378 |
453 | 450 |
454 if (m_lastDirectReadStart != start || | 451 if (m_lastDirectReadStart != start || |
455 m_lastDirectReadCount != count || | 452 m_lastDirectReadCount != count || |
456 m_directRead.empty()) { | 453 m_directRead.empty()) { |
457 | 454 |
458 m_reader->getInterleavedFrames(start, count, m_directRead); | 455 m_directRead = m_reader->getInterleavedFrames(start, count); |
459 m_lastDirectReadStart = start; | 456 m_lastDirectReadStart = start; |
460 m_lastDirectReadCount = count; | 457 m_lastDirectReadCount = count; |
461 } | 458 } |
462 | 459 |
463 float max = 0.0, min = 0.0, total = 0.0; | 460 float max = 0.0, min = 0.0, total = 0.0; |
707 | 704 |
708 // SVDEBUG << "WaveFileModel::fill inner loop: frame = " << frame << ", count = " << m_frameCount << ", blocksize " << readBlockSize << endl; | 705 // SVDEBUG << "WaveFileModel::fill inner loop: frame = " << frame << ", count = " << m_frameCount << ", blocksize " << readBlockSize << endl; |
709 | 706 |
710 if (updating && (frame + readBlockSize > m_frameCount)) break; | 707 if (updating && (frame + readBlockSize > m_frameCount)) break; |
711 | 708 |
712 m_model.m_reader->getInterleavedFrames(frame, readBlockSize, block); | 709 block = m_model.m_reader->getInterleavedFrames(frame, readBlockSize); |
713 | 710 |
714 // cerr << "block is " << block.size() << endl; | 711 // cerr << "block is " << block.size() << endl; |
715 | 712 |
716 for (sv_frame_t i = 0; i < readBlockSize; ++i) { | 713 for (sv_frame_t i = 0; i < readBlockSize; ++i) { |
717 | 714 |