comparison runner/MultiplexedReader.cpp @ 195:3f7c65f26559

Fixes from last merge
author Chris Cannam
date Wed, 26 Aug 2015 21:46:52 +0100
parents 3287df4588dd
children d0fe861bb116
comparison
equal deleted inserted replaced
194:c71d6ae15882 195:3f7c65f26559
47 foreach (AudioFileReader *r, m_readers) { 47 foreach (AudioFileReader *r, m_readers) {
48 delete r; 48 delete r;
49 } 49 }
50 } 50 }
51 51
52 void 52 SampleBlock
53 MultiplexedReader::getInterleavedFrames(int start, int frameCount, 53 MultiplexedReader::getInterleavedFrames(sv_frame_t start, sv_frame_t frameCount) const
54 SampleBlock &block) const
55 { 54 {
56 int out_chans = m_readers.size(); 55 int out_chans = m_readers.size();
57 56
58 // Allocate and zero 57 // Allocate and zero
59 block = SampleBlock(frameCount * out_chans, 0.f); 58 SampleBlock block(frameCount * out_chans, 0.f);
60 59
61 for (int out_chan = 0; out_chan < out_chans; ++out_chan) { 60 for (int out_chan = 0; out_chan < out_chans; ++out_chan) {
62 61
63 AudioFileReader *reader = m_readers[out_chan]; 62 AudioFileReader *reader = m_readers[out_chan];
64 SampleBlock readerBlock; 63 SampleBlock readerBlock = getInterleavedFrames(start, frameCount);
65 reader->getInterleavedFrames(start, frameCount, readerBlock);
66 64
67 int in_chans = reader->getChannelCount(); 65 int in_chans = reader->getChannelCount();
68 66
69 for (int frame = 0; frame < frameCount; ++frame) { 67 for (int frame = 0; frame < frameCount; ++frame) {
70 68
79 if (in_chans > 1) { 77 if (in_chans > 1) {
80 block[out_index] /= float(in_chans); 78 block[out_index] /= float(in_chans);
81 } 79 }
82 } 80 }
83 } 81 }
82
83 return block;
84 } 84 }
85 85
86 int 86 int
87 MultiplexedReader::getDecodeCompletion() const 87 MultiplexedReader::getDecodeCompletion() const
88 { 88 {