annotate layer/Colour3DPlotExporter.h @ 1554:a0b2f3b4dd2f spectrogram-export

Start work on spectrogram export code
author Chris Cannam
date Mon, 06 Jan 2020 14:46:25 +0000
parents
children ac8da42674ff
rev   line source
Chris@1554 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@1554 2
Chris@1554 3 /*
Chris@1554 4 Sonic Visualiser
Chris@1554 5 An audio file viewer and annotation editor.
Chris@1554 6 Centre for Digital Music, Queen Mary, University of London.
Chris@1554 7
Chris@1554 8 This program is free software; you can redistribute it and/or
Chris@1554 9 modify it under the terms of the GNU General Public License as
Chris@1554 10 published by the Free Software Foundation; either version 2 of the
Chris@1554 11 License, or (at your option) any later version. See the file
Chris@1554 12 COPYING included with this distribution for more information.
Chris@1554 13 */
Chris@1554 14
Chris@1554 15 #ifndef COLOUR_3D_PLOT_EXPORTER_H
Chris@1554 16 #define COLOUR_3D_PLOT_EXPORTER_H
Chris@1554 17
Chris@1554 18 #include "Colour3DPlotRenderer.h"
Chris@1554 19
Chris@1554 20 class Colour3DPlotExporter : public Model
Chris@1554 21 {
Chris@1554 22 Q_OBJECT
Chris@1554 23
Chris@1554 24 public:
Chris@1554 25 struct Sources {
Chris@1554 26 // These must all outlive this class, or else discardSources()
Chris@1554 27 // must be called
Chris@1554 28 const VerticalBinLayer *verticalBinLayer; // always
Chris@1554 29 ModelId source; // always; a DenseThreeDimensionalModel
Chris@1554 30 ModelId fft; // optionally; an FFTModel; used for phase/peak-freq modes
Chris@1554 31 const LayerGeometryProvider *provider; // optionally
Chris@1554 32 };
Chris@1554 33
Chris@1554 34 struct Parameters {
Chris@1554 35 Parameters() :
Chris@1554 36 binDisplay(BinDisplay::AllBins) { }
Chris@1554 37
Chris@1554 38 /** Selection of bins to include in the export. */
Chris@1554 39 BinDisplay binDisplay;
Chris@1554 40 };
Chris@1554 41
Chris@1554 42 Colour3DPlotExporter(Sources sources, Parameters parameters) :
Chris@1554 43 m_sources(sources),
Chris@1554 44 m_params(parameters)
Chris@1554 45 { }
Chris@1554 46
Chris@1554 47 void discardSources() {
Chris@1554 48 QMutexLocker locker(&m_mutex);
Chris@1554 49 m_sources.verticalBinLayer = nullptr;
Chris@1554 50 m_sources.source = {};
Chris@1554 51 m_sources.fft = {};
Chris@1554 52 m_sources.provider = nullptr;
Chris@1554 53 }
Chris@1554 54
Chris@1554 55 QString toDelimitedDataString(QString, DataExportOptions,
Chris@1554 56 sv_frame_t, sv_frame_t) const override;
Chris@1554 57
Chris@1554 58 private:
Chris@1554 59 Sources m_sources;
Chris@1554 60 Parameters m_params;
Chris@1554 61 };
Chris@1554 62
Chris@1554 63 #endif