Mercurial > hg > svcore
comparison data/fileio/AudioFileReader.cpp @ 1069:32ab6c48efaa
Merge from branch tonioni
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:11:34 +0100 |
parents | 843f67be0ed9 |
children | 4d9816ba0ebe |
comparison
equal
deleted
inserted
replaced
1036:682d64f05e72 | 1069:32ab6c48efaa |
---|---|
13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
14 */ | 14 */ |
15 | 15 |
16 #include "AudioFileReader.h" | 16 #include "AudioFileReader.h" |
17 | 17 |
18 void | 18 using std::vector; |
19 AudioFileReader::getDeInterleavedFrames(int start, int count, | 19 |
20 std::vector<SampleBlock> &frames) const | 20 vector<SampleBlock> |
21 AudioFileReader::getDeInterleavedFrames(sv_frame_t start, sv_frame_t count) const | |
21 { | 22 { |
22 SampleBlock interleaved; | 23 SampleBlock interleaved = getInterleavedFrames(start, count); |
23 getInterleavedFrames(start, count, interleaved); | |
24 | 24 |
25 int channels = getChannelCount(); | 25 int channels = getChannelCount(); |
26 int rc = interleaved.size() / channels; | 26 sv_frame_t rc = interleaved.size() / channels; |
27 | 27 |
28 frames.clear(); | 28 vector<SampleBlock> frames(channels, SampleBlock(rc, 0.f)); |
29 | 29 |
30 for (int c = 0; c < channels; ++c) { | 30 for (int c = 0; c < channels; ++c) { |
31 frames.push_back(SampleBlock()); | 31 for (sv_frame_t i = 0; i < rc; ++i) { |
32 frames[c][i] = interleaved[i * channels + c]; | |
33 } | |
32 } | 34 } |
33 | 35 |
34 for (int i = 0; i < rc; ++i) { | 36 return frames; |
35 for (int c = 0; c < channels; ++c) { | |
36 frames[c].push_back(interleaved[i * channels + c]); | |
37 } | |
38 } | |
39 } | 37 } |
40 | 38 |