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