Chris@147
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@147
|
2
|
Chris@147
|
3 /*
|
Chris@147
|
4 Sonic Visualiser
|
Chris@147
|
5 An audio file viewer and annotation editor.
|
Chris@147
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@147
|
7 This file copyright 2006 Chris Cannam.
|
Chris@147
|
8
|
Chris@147
|
9 This program is free software; you can redistribute it and/or
|
Chris@147
|
10 modify it under the terms of the GNU General Public License as
|
Chris@147
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@147
|
12 License, or (at your option) any later version. See the file
|
Chris@147
|
13 COPYING included with this distribution for more information.
|
Chris@147
|
14 */
|
Chris@147
|
15
|
Chris@1326
|
16 #ifndef SV_DENSE_TIME_VALUE_MODEL_H
|
Chris@1326
|
17 #define SV_DENSE_TIME_VALUE_MODEL_H
|
Chris@147
|
18
|
Chris@147
|
19 #include <QObject>
|
Chris@147
|
20
|
Chris@150
|
21 #include "Model.h"
|
Chris@147
|
22
|
Chris@147
|
23 /**
|
Chris@147
|
24 * Base class for models containing dense two-dimensional data (value
|
Chris@863
|
25 * against time). For example, audio waveform data. Other time-value
|
Chris@863
|
26 * plot data, especially if editable, will normally go into a
|
Chris@863
|
27 * SparseTimeValueModel instead even if regularly sampled.
|
Chris@147
|
28 */
|
Chris@147
|
29
|
Chris@179
|
30 class DenseTimeValueModel : public Model
|
Chris@147
|
31 {
|
Chris@147
|
32 Q_OBJECT
|
Chris@147
|
33
|
Chris@147
|
34 public:
|
Chris@1751
|
35 DenseTimeValueModel() { }
|
Chris@147
|
36
|
Chris@1751
|
37 virtual ~DenseTimeValueModel() { }
|
Chris@391
|
38
|
Chris@147
|
39 /**
|
Chris@147
|
40 * Return the minimum possible value found in this model type.
|
Chris@147
|
41 * (That is, the minimum that would be valid, not the minimum
|
Chris@147
|
42 * actually found in a particular model).
|
Chris@147
|
43 */
|
Chris@147
|
44 virtual float getValueMinimum() const = 0;
|
Chris@147
|
45
|
Chris@147
|
46 /**
|
Chris@147
|
47 * Return the minimum possible value found in this model type.
|
Chris@147
|
48 * (That is, the minimum that would be valid, not the minimum
|
Chris@147
|
49 * actually found in a particular model).
|
Chris@147
|
50 */
|
Chris@147
|
51 virtual float getValueMaximum() const = 0;
|
Chris@147
|
52
|
Chris@147
|
53 /**
|
Chris@147
|
54 * Return the number of distinct channels for this model.
|
Chris@147
|
55 */
|
Chris@929
|
56 virtual int getChannelCount() const = 0;
|
Chris@147
|
57
|
Chris@147
|
58 /**
|
Chris@147
|
59 * Get the specified set of samples from the given channel of the
|
Chris@1096
|
60 * model in single-precision floating-point format. Returned
|
Chris@1096
|
61 * vector may have fewer samples than requested, if the end of
|
Chris@1096
|
62 * file was reached.
|
Chris@1096
|
63 *
|
Chris@147
|
64 * If the channel is given as -1, mix all available channels and
|
Chris@147
|
65 * return the result.
|
Chris@147
|
66 */
|
Chris@1326
|
67 virtual floatvec_t getData(int channel, sv_frame_t start, sv_frame_t count)
|
Chris@1326
|
68 const = 0;
|
Chris@147
|
69
|
Chris@147
|
70 /**
|
Chris@1096
|
71 * Get the specified set of samples from given contiguous range of
|
Chris@1096
|
72 * channels of the model in single-precision floating-point
|
Chris@1096
|
73 * format. Returned vector may have fewer samples than requested,
|
Chris@1096
|
74 * if the end of file was reached.
|
Chris@363
|
75 */
|
Chris@1326
|
76 virtual std::vector<floatvec_t> getMultiChannelData(int fromchannel,
|
Chris@1326
|
77 int tochannel,
|
Chris@1326
|
78 sv_frame_t start,
|
Chris@1326
|
79 sv_frame_t count)
|
Chris@1326
|
80 const = 0;
|
Chris@363
|
81
|
Chris@1580
|
82 bool canPlay() const override { return true; }
|
Chris@1580
|
83 QString getDefaultPlayClipId() const override { return ""; }
|
Chris@391
|
84
|
Chris@1679
|
85 QString toDelimitedDataString(QString delimiter,
|
Chris@1679
|
86 DataExportOptions options,
|
Chris@1679
|
87 sv_frame_t startFrame,
|
Chris@1679
|
88 sv_frame_t duration) const override;
|
Chris@838
|
89
|
Chris@1580
|
90 QString getTypeName() const override { return tr("Dense Time-Value"); }
|
Chris@147
|
91 };
|
Chris@147
|
92
|
Chris@147
|
93 #endif
|