comparison data/fileio/AudioFileReader.cpp @ 1126:39019ce29178 tony-2.0-integration

Merge through to branch for Tony 2.0
author Chris Cannam
date Thu, 20 Aug 2015 14:54:21 +0100
parents 4d9816ba0ebe
children 54af1e21705c
comparison
equal deleted inserted replaced
1119:e22bfe8ca248 1126:39019ce29178
15 15
16 #include "AudioFileReader.h" 16 #include "AudioFileReader.h"
17 17
18 using std::vector; 18 using std::vector;
19 19
20 vector<SampleBlock> 20 vector<vector<float>>
21 AudioFileReader::getDeInterleavedFrames(sv_frame_t start, sv_frame_t count) const 21 AudioFileReader::getDeInterleavedFrames(sv_frame_t start, sv_frame_t count) const
22 { 22 {
23 SampleBlock interleaved = getInterleavedFrames(start, count); 23 vector<float> interleaved = getInterleavedFrames(start, count);
24 24
25 int channels = getChannelCount(); 25 int channels = getChannelCount();
26 if (channels == 1) return { interleaved };
27
26 sv_frame_t rc = interleaved.size() / channels; 28 sv_frame_t rc = interleaved.size() / channels;
27 29
28 vector<SampleBlock> frames(channels, SampleBlock(rc, 0.f)); 30 vector<vector<float>> frames(channels, vector<float>(rc, 0.f));
29 31
30 for (int c = 0; c < channels; ++c) { 32 for (int c = 0; c < channels; ++c) {
31 for (sv_frame_t i = 0; i < rc; ++i) { 33 for (sv_frame_t i = 0; i < rc; ++i) {
32 frames[c][i] = interleaved[i * channels + c]; 34 frames[c][i] = interleaved[i * channels + c];
33 } 35 }