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@1556
|
42 Colour3DPlotExporter(Sources sources, Parameters parameters);
|
Chris@1556
|
43 ~Colour3DPlotExporter();
|
Chris@1554
|
44
|
Chris@1556
|
45 void discardSources();
|
Chris@1554
|
46
|
Chris@1554
|
47 QString toDelimitedDataString(QString, DataExportOptions,
|
Chris@1554
|
48 sv_frame_t, sv_frame_t) const override;
|
Chris@1554
|
49
|
Chris@1556
|
50
|
Chris@1556
|
51 // Further Model methods that we just delegate
|
Chris@1556
|
52
|
Chris@1556
|
53 bool isOK() const override {
|
Chris@1556
|
54 if (auto model = ModelById::get(m_sources.source)) {
|
Chris@1556
|
55 return model->isOK();
|
Chris@1556
|
56 }
|
Chris@1556
|
57 return false;
|
Chris@1556
|
58 }
|
Chris@1556
|
59
|
Chris@1556
|
60 sv_frame_t getStartFrame() const override {
|
Chris@1556
|
61 if (auto model = ModelById::get(m_sources.source)) {
|
Chris@1556
|
62 return model->getStartFrame();
|
Chris@1556
|
63 }
|
Chris@1556
|
64 return 0;
|
Chris@1556
|
65 }
|
Chris@1556
|
66
|
Chris@1556
|
67 sv_frame_t getTrueEndFrame() const override {
|
Chris@1556
|
68 if (auto model = ModelById::get(m_sources.source)) {
|
Chris@1556
|
69 return model->getTrueEndFrame();
|
Chris@1556
|
70 }
|
Chris@1556
|
71 return 0;
|
Chris@1556
|
72 }
|
Chris@1556
|
73
|
Chris@1556
|
74 sv_samplerate_t getSampleRate() const override {
|
Chris@1556
|
75 if (auto model = ModelById::get(m_sources.source)) {
|
Chris@1556
|
76 return model->getSampleRate();
|
Chris@1556
|
77 }
|
Chris@1556
|
78 return 0;
|
Chris@1556
|
79 }
|
Chris@1556
|
80
|
Chris@1556
|
81 QString getTypeName() const override {
|
Chris@1556
|
82 if (auto model = ModelById::get(m_sources.source)) {
|
Chris@1556
|
83 return model->getTypeName();
|
Chris@1556
|
84 }
|
Chris@1556
|
85 return "(exporter)"; // internal fallback, no translation needed
|
Chris@1556
|
86 }
|
Chris@1556
|
87
|
Chris@1556
|
88 int getCompletion() const override {
|
Chris@1556
|
89 if (auto model = ModelById::get(m_sources.source)) {
|
Chris@1556
|
90 return model->getCompletion();
|
Chris@1556
|
91 }
|
Chris@1556
|
92 return 0;
|
Chris@1556
|
93 }
|
Chris@1556
|
94
|
Chris@1554
|
95 private:
|
Chris@1554
|
96 Sources m_sources;
|
Chris@1554
|
97 Parameters m_params;
|
Chris@1554
|
98 };
|
Chris@1554
|
99
|
Chris@1554
|
100 #endif
|