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