Chris@175: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@175: Chris@175: /* Chris@175: Sonic Visualiser Chris@175: An audio file viewer and annotation editor. Chris@175: Centre for Digital Music, Queen Mary, University of London. Chris@175: This file copyright 2006 Chris Cannam. Chris@175: Chris@175: This program is free software; you can redistribute it and/or Chris@175: modify it under the terms of the GNU General Public License as Chris@175: published by the Free Software Foundation; either version 2 of the Chris@175: License, or (at your option) any later version. See the file Chris@175: COPYING included with this distribution for more information. Chris@175: */ Chris@175: Chris@175: #include "AudioFileReader.h" Chris@175: Chris@1041: using std::vector; Chris@1041: Chris@1041: vector Chris@1041: AudioFileReader::getDeInterleavedFrames(sv_frame_t start, sv_frame_t count) const Chris@327: { Chris@1041: SampleBlock interleaved = getInterleavedFrames(start, count); Chris@327: Chris@929: int channels = getChannelCount(); Chris@1038: sv_frame_t rc = interleaved.size() / channels; Chris@327: Chris@1041: vector frames(channels, SampleBlock(rc, 0.f)); Chris@1041: Chris@929: for (int c = 0; c < channels; ++c) { Chris@1041: for (sv_frame_t i = 0; i < rc; ++i) { Chris@1041: frames[c][i] = interleaved[i * channels + c]; Chris@1041: } Chris@327: } Chris@327: Chris@1041: return frames; Chris@327: } Chris@327: