Mercurial > hg > svgui
changeset 1564:62b7699e5bfe spectrogram-export
Add option to export timestamp column
author | Chris Cannam |
---|---|
date | Fri, 10 Jan 2020 11:12:33 +0000 |
parents | 563bab925c9b |
children | a6a31908bd13 |
files | layer/Colour3DPlotExporter.cpp layer/Colour3DPlotExporter.h |
diffstat | 2 files changed, 24 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/Colour3DPlotExporter.cpp Thu Jan 09 14:35:55 2020 +0000 +++ b/layer/Colour3DPlotExporter.cpp Fri Jan 10 11:12:33 2020 +0000 @@ -127,6 +127,18 @@ QStringList list; + switch (m_params.timestampFormat) { + case TimestampFormat::None: + break; + case TimestampFormat::Frames: + list << QString("%1").arg(fr); + break; + case TimestampFormat::Seconds: + list << QString("%1").arg(RealTime::frame2RealTime + (fr, model->getSampleRate()).toDouble()); + break; + } + if (binDisplay == BinDisplay::PeakFrequencies) { FFTModel::PeakSet peaks = fftModel->getPeakFrequencies
--- a/layer/Colour3DPlotExporter.h Thu Jan 09 14:35:55 2020 +0000 +++ b/layer/Colour3DPlotExporter.h Fri Jan 10 11:12:33 2020 +0000 @@ -31,13 +31,20 @@ const LayerGeometryProvider *provider; // optionally }; + enum class TimestampFormat { + None, + Seconds, + Frames + }; + struct Parameters { Parameters() : binDisplay(BinDisplay::AllBins), scaleFactor(1.0), threshold(0.0), gain(1.0), - normalization(ColumnNormalization::None) { } + normalization(ColumnNormalization::None), + timestampFormat(TimestampFormat::None) { } /** Selection of bins to include in the export. */ BinDisplay binDisplay; @@ -63,6 +70,10 @@ * calculate thresholding level. The exported values are * un-normalized. */ ColumnNormalization normalization; + + /** Format to use for the timestamp column. If None, no + * timestamp column will be included. */ + TimestampFormat timestampFormat; }; Colour3DPlotExporter(Sources sources, Parameters parameters);