Mercurial > hg > svcore
annotate data/fileio/AudioFileReader.cpp @ 1881:b504df98c3be
Ensure completion on output model is started at zero, so if it's checked before the input model has become ready and the transform has begun, it is not accidentally reported as complete (affected re-aligning models in Sonic Lineup when replacing the session)
author | Chris Cannam |
---|---|
date | Fri, 26 Jun 2020 11:45:39 +0100 |
parents | 54af1e21705c |
children |
rev | line source |
---|---|
Chris@175 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@175 | 2 |
Chris@175 | 3 /* |
Chris@175 | 4 Sonic Visualiser |
Chris@175 | 5 An audio file viewer and annotation editor. |
Chris@175 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@175 | 7 This file copyright 2006 Chris Cannam. |
Chris@175 | 8 |
Chris@175 | 9 This program is free software; you can redistribute it and/or |
Chris@175 | 10 modify it under the terms of the GNU General Public License as |
Chris@175 | 11 published by the Free Software Foundation; either version 2 of the |
Chris@175 | 12 License, or (at your option) any later version. See the file |
Chris@175 | 13 COPYING included with this distribution for more information. |
Chris@175 | 14 */ |
Chris@175 | 15 |
Chris@175 | 16 #include "AudioFileReader.h" |
Chris@175 | 17 |
Chris@1041 | 18 using std::vector; |
Chris@1041 | 19 |
Chris@1326 | 20 vector<floatvec_t> |
Chris@1041 | 21 AudioFileReader::getDeInterleavedFrames(sv_frame_t start, sv_frame_t count) const |
Chris@327 | 22 { |
Chris@1326 | 23 floatvec_t interleaved = getInterleavedFrames(start, count); |
Chris@327 | 24 |
Chris@929 | 25 int channels = getChannelCount(); |
Chris@1096 | 26 if (channels == 1) return { interleaved }; |
Chris@1096 | 27 |
Chris@1038 | 28 sv_frame_t rc = interleaved.size() / channels; |
Chris@327 | 29 |
Chris@1326 | 30 vector<floatvec_t> frames(channels, floatvec_t(rc, 0.f)); |
Chris@1041 | 31 |
Chris@929 | 32 for (int c = 0; c < channels; ++c) { |
Chris@1041 | 33 for (sv_frame_t i = 0; i < rc; ++i) { |
Chris@1041 | 34 frames[c][i] = interleaved[i * channels + c]; |
Chris@1041 | 35 } |
Chris@327 | 36 } |
Chris@327 | 37 |
Chris@1041 | 38 return frames; |
Chris@327 | 39 } |
Chris@327 | 40 |