Chris@147: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@147: Chris@147: /* Chris@147: Sonic Visualiser Chris@147: An audio file viewer and annotation editor. Chris@147: Centre for Digital Music, Queen Mary, University of London. Chris@147: This file copyright 2006 Chris Cannam. Chris@147: Chris@147: This program is free software; you can redistribute it and/or Chris@147: modify it under the terms of the GNU General Public License as Chris@147: published by the Free Software Foundation; either version 2 of the Chris@147: License, or (at your option) any later version. See the file Chris@147: COPYING included with this distribution for more information. Chris@147: */ Chris@147: Chris@1326: #ifndef SV_DENSE_TIME_VALUE_MODEL_H Chris@1326: #define SV_DENSE_TIME_VALUE_MODEL_H Chris@147: Chris@147: #include Chris@147: Chris@150: #include "Model.h" Chris@147: Chris@147: /** Chris@147: * Base class for models containing dense two-dimensional data (value Chris@863: * against time). For example, audio waveform data. Other time-value Chris@863: * plot data, especially if editable, will normally go into a Chris@863: * SparseTimeValueModel instead even if regularly sampled. Chris@147: */ Chris@147: Chris@179: class DenseTimeValueModel : public Model Chris@147: { Chris@147: Q_OBJECT Chris@147: Chris@147: public: Chris@1751: DenseTimeValueModel() { } Chris@147: Chris@1751: virtual ~DenseTimeValueModel() { } Chris@391: Chris@147: /** Chris@147: * Return the minimum possible value found in this model type. Chris@147: * (That is, the minimum that would be valid, not the minimum Chris@147: * actually found in a particular model). Chris@147: */ Chris@147: virtual float getValueMinimum() const = 0; Chris@147: Chris@147: /** Chris@147: * Return the minimum possible value found in this model type. Chris@147: * (That is, the minimum that would be valid, not the minimum Chris@147: * actually found in a particular model). Chris@147: */ Chris@147: virtual float getValueMaximum() const = 0; Chris@147: Chris@147: /** Chris@147: * Return the number of distinct channels for this model. Chris@147: */ Chris@929: virtual int getChannelCount() const = 0; Chris@147: Chris@147: /** Chris@147: * Get the specified set of samples from the given channel of the Chris@1096: * model in single-precision floating-point format. Returned Chris@1096: * vector may have fewer samples than requested, if the end of Chris@1096: * file was reached. Chris@1096: * Chris@147: * If the channel is given as -1, mix all available channels and Chris@147: * return the result. Chris@147: */ Chris@1326: virtual floatvec_t getData(int channel, sv_frame_t start, sv_frame_t count) Chris@1326: const = 0; Chris@147: Chris@147: /** Chris@1096: * Get the specified set of samples from given contiguous range of Chris@1096: * channels of the model in single-precision floating-point Chris@1096: * format. Returned vector may have fewer samples than requested, Chris@1096: * if the end of file was reached. Chris@363: */ Chris@1326: virtual std::vector getMultiChannelData(int fromchannel, Chris@1326: int tochannel, Chris@1326: sv_frame_t start, Chris@1326: sv_frame_t count) Chris@1326: const = 0; Chris@363: Chris@1580: bool canPlay() const override { return true; } Chris@1580: QString getDefaultPlayClipId() const override { return ""; } Chris@391: Chris@1815: QString getDelimitedDataHeaderLine(QString delimiter, Chris@1815: DataExportOptions options) const override; Chris@1815: Chris@1679: QString toDelimitedDataString(QString delimiter, Chris@1679: DataExportOptions options, Chris@1679: sv_frame_t startFrame, Chris@1679: sv_frame_t duration) const override; Chris@838: Chris@1580: QString getTypeName() const override { return tr("Dense Time-Value"); } Chris@147: }; Chris@147: Chris@147: #endif