annotate data/model/DenseTimeValueModel.h @ 625:608b4dc5ff34

* Improve behaviour when output file write fails (i.e. fail earlier)
author Chris Cannam
date Fri, 21 May 2010 10:21:18 +0000
parents 5858cc462d0a
children 33fca917c800
rev   line source
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@147 16 #ifndef _DENSE_TIME_VALUE_MODEL_H_
Chris@147 17 #define _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@147 25 * against time). For example, audio waveform data.
Chris@147 26 */
Chris@147 27
Chris@179 28 class DenseTimeValueModel : public Model
Chris@147 29 {
Chris@147 30 Q_OBJECT
Chris@147 31
Chris@147 32 public:
Chris@147 33 DenseTimeValueModel();
Chris@147 34
Chris@391 35 virtual ~DenseTimeValueModel();
Chris@391 36
Chris@147 37 /**
Chris@147 38 * Return the minimum possible value found in this model type.
Chris@147 39 * (That is, the minimum that would be valid, not the minimum
Chris@147 40 * actually found in a particular model).
Chris@147 41 */
Chris@147 42 virtual float getValueMinimum() const = 0;
Chris@147 43
Chris@147 44 /**
Chris@147 45 * Return the minimum possible value found in this model type.
Chris@147 46 * (That is, the minimum that would be valid, not the minimum
Chris@147 47 * actually found in a particular model).
Chris@147 48 */
Chris@147 49 virtual float getValueMaximum() const = 0;
Chris@147 50
Chris@147 51 /**
Chris@147 52 * Return the number of distinct channels for this model.
Chris@147 53 */
Chris@147 54 virtual size_t getChannelCount() const = 0;
Chris@147 55
Chris@147 56 /**
Chris@147 57 * Get the specified set of samples from the given channel of the
Chris@147 58 * model in single-precision floating-point format. Return the
Chris@147 59 * number of samples actually retrieved.
Chris@147 60 * If the channel is given as -1, mix all available channels and
Chris@147 61 * return the result.
Chris@147 62 */
Chris@300 63 virtual size_t getData(int channel, size_t start, size_t count,
Chris@300 64 float *buffer) const = 0;
Chris@147 65
Chris@147 66 /**
Chris@147 67 * Get the specified set of samples from the given channel of the
Chris@147 68 * model in double-precision floating-point format. Return the
Chris@147 69 * number of samples actually retrieved.
Chris@147 70 * If the channel is given as -1, mix all available channels and
Chris@147 71 * return the result.
Chris@147 72 */
Chris@300 73 virtual size_t getData(int channel, size_t start, size_t count,
Chris@300 74 double *buffer) const = 0;
Chris@345 75
Chris@363 76 /**
Chris@363 77 * Get the specified set of samples from given contiguous range
Chris@363 78 * of channels of the model in single-precision floating-point
Chris@363 79 * format. Return the number of sample frames actually retrieved.
Chris@363 80 */
Chris@363 81 virtual size_t getData(size_t fromchannel, size_t tochannel,
Chris@363 82 size_t start, size_t count,
Chris@363 83 float **buffers) const = 0;
Chris@363 84
Chris@391 85 virtual bool canPlay() const { return true; }
Chris@391 86 virtual QString getDefaultPlayPluginId() const { return ""; }
Chris@391 87 virtual QString getDefaultPlayPluginConfiguration() const { return ""; }
Chris@391 88
Chris@345 89 QString getTypeName() const { return tr("Dense Time-Value"); }
Chris@147 90 };
Chris@147 91
Chris@147 92 #endif