diff 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
line wrap: on
line diff
--- a/data/fileio/AudioFileReader.cpp	Mon Mar 02 17:21:34 2015 +0000
+++ b/data/fileio/AudioFileReader.cpp	Mon Apr 20 09:11:34 2015 +0100
@@ -15,26 +15,24 @@
 
 #include "AudioFileReader.h"
 
-void
-AudioFileReader::getDeInterleavedFrames(int start, int count,
-                                        std::vector<SampleBlock> &frames) const
+using std::vector;
+
+vector<SampleBlock>
+AudioFileReader::getDeInterleavedFrames(sv_frame_t start, sv_frame_t count) const
 {
-    SampleBlock interleaved;
-    getInterleavedFrames(start, count, interleaved);
+    SampleBlock interleaved = getInterleavedFrames(start, count);
     
     int channels = getChannelCount();
-    int rc = interleaved.size() / channels;
+    sv_frame_t rc = interleaved.size() / channels;
 
-    frames.clear();
-
+    vector<SampleBlock> frames(channels, SampleBlock(rc, 0.f));
+    
     for (int c = 0; c < channels; ++c) {
-        frames.push_back(SampleBlock());
+        for (sv_frame_t i = 0; i < rc; ++i) {
+            frames[c][i] = interleaved[i * channels + c];
+        }
     }
 
-    for (int i = 0; i < rc; ++i) {
-        for (int c = 0; c < channels; ++c) {
-            frames[c].push_back(interleaved[i * channels + c]);
-        }
-    }
+    return frames;
 }