Mercurial > hg > svcore
diff data/model/BoxModel.h @ 1815:c546429d4c2f
Add optional ability to write a header on delimited data output, & to write times in frames
author | Chris Cannam |
---|---|
date | Fri, 10 Jan 2020 14:29:54 +0000 |
parents | 343ef2a866a4 |
children | 21c792334c2e |
line wrap: on
line diff
--- a/data/model/BoxModel.h Wed Jan 08 15:26:49 2020 +0000 +++ b/data/model/BoxModel.h Fri Jan 10 14:29:54 2020 +0000 @@ -348,8 +348,26 @@ m_events.toXml(out, indent, QString("dimensions=\"2\""), options); } + QString getDelimitedDataHeaderLine(QString delimiter, + DataExportOptions opts) const override { + QStringList list; + + // These are considered API rather than human-readable text - + // they shouldn't be translated + + if (opts & DataExportWriteTimeInFrames) { + list << "startframe" << "endframe"; + } else { + list << "start" << "end"; + } + + list << "extent start" << "extent end" << "label"; + + return list.join(delimiter).toUpper(); + } + QString toDelimitedDataString(QString delimiter, - DataExportOptions, + DataExportOptions opts, sv_frame_t startFrame, sv_frame_t duration) const override { @@ -363,14 +381,25 @@ QStringList list; - list << RealTime::frame2RealTime - (e.getFrame(), getSampleRate()) - .toString().c_str() - << RealTime::frame2RealTime - (e.getFrame() + e.getDuration(), getSampleRate()) - .toString().c_str() - << QString("%1").arg(e.getValue()) - << QString("%1").arg(e.getValue() + fabsf(e.getLevel())); + if (opts & DataExportWriteTimeInFrames) { + + list << QString("%1").arg(e.getFrame()); + list << QString("%1").arg(e.getFrame() + e.getDuration()); + + } else { + + list << RealTime::frame2RealTime + (e.getFrame(), getSampleRate()) + .toString().c_str(); + + list << RealTime::frame2RealTime + (e.getFrame() + e.getDuration(), getSampleRate()) + .toString().c_str(); + } + + list << QString("%1").arg(e.getValue()); + + list << QString("%1").arg(e.getValue() + fabsf(e.getLevel())); if (e.getLabel() != "") { list << e.getLabel();