Chris@147: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@147: Chris@147: /* Chris@147: Sonic Visualiser Chris@147: An audio file viewer and annotation editor. Chris@147: Centre for Digital Music, Queen Mary, University of London. Chris@147: This file copyright 2006 Chris Cannam. Chris@147: Chris@147: This program is free software; you can redistribute it and/or Chris@147: modify it under the terms of the GNU General Public License as Chris@147: published by the Free Software Foundation; either version 2 of the Chris@147: License, or (at your option) any later version. See the file Chris@147: COPYING included with this distribution for more information. Chris@147: */ Chris@147: Chris@147: #include "DenseTimeValueModel.h" Chris@147: Chris@838: #include Chris@1815: Chris@1833: using namespace std; Chris@1833: Chris@1833: QVector Chris@1833: DenseTimeValueModel::getStringExportHeaders(DataExportOptions) const Chris@1815: { Chris@1815: int ch = getChannelCount(); Chris@1833: QVector sv; Chris@1815: for (int i = 0; i < ch; ++i) { Chris@1833: sv.push_back(QString("Channel%1").arg(i+1)); Chris@1815: } Chris@1833: return sv; Chris@1815: } Chris@1815: Chris@1833: QVector> Chris@1833: DenseTimeValueModel::toStringExportRows(DataExportOptions, Chris@1833: sv_frame_t startFrame, Chris@1833: sv_frame_t duration) const Chris@838: { Chris@929: int ch = getChannelCount(); Chris@838: Chris@1833: if (duration <= 0) return {}; Chris@838: Chris@1679: auto data = getMultiChannelData(0, ch - 1, startFrame, duration); Chris@838: Chris@1833: if (data.empty() || data[0].empty()) return {}; Chris@1096: Chris@1833: QVector> rows; Chris@1833: Chris@1096: for (sv_frame_t i = 0; in_range_for(data[0], i); ++i) { Chris@1833: QVector row; Chris@1833: row.push_back(QString("%1").arg(startFrame + i)); Chris@1096: for (int c = 0; in_range_for(data, c); ++c) { Chris@1833: row.push_back(QString("%1").arg(data[c][i])); Chris@838: } Chris@1833: rows.push_back(row); Chris@838: } Chris@838: Chris@1833: return rows; Chris@838: }