comparison data/model/WritableWaveFileModel.h @ 1126:39019ce29178 tony-2.0-integration

Merge through to branch for Tony 2.0
author Chris Cannam
date Thu, 20 Aug 2015 14:54:21 +0100
parents efea94b04d5a
children e994747fb9dd
comparison
equal deleted inserted replaced
1119:e22bfe8ca248 1126:39019ce29178
11 published by the Free Software Foundation; either version 2 of the 11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #ifndef _WRITABLE_WAVE_FILE_MODEL_H_ 16 #ifndef WRITABLE_WAVE_FILE_MODEL_H
17 #define _WRITABLE_WAVE_FILE_MODEL_H_ 17 #define WRITABLE_WAVE_FILE_MODEL_H
18 18
19 #include "WaveFileModel.h" 19 #include "WaveFileModel.h"
20 #include "ReadOnlyWaveFileModel.h"
21 #include "PowerOfSqrtTwoZoomConstraint.h"
20 22
21 class WavFileWriter; 23 class WavFileWriter;
22 class WavFileReader; 24 class WavFileReader;
23 25
24 class WritableWaveFileModel : public RangeSummarisableTimeValueModel 26 class WritableWaveFileModel : public WaveFileModel
25 { 27 {
26 Q_OBJECT 28 Q_OBJECT
27 29
28 public: 30 public:
29 WritableWaveFileModel(sv_samplerate_t sampleRate, int channels, QString path = ""); 31 WritableWaveFileModel(sv_samplerate_t sampleRate, int channels, QString path = "");
49 } 51 }
50 52
51 sv_frame_t getFrameCount() const; 53 sv_frame_t getFrameCount() const;
52 int getChannelCount() const { return m_channels; } 54 int getChannelCount() const { return m_channels; }
53 sv_samplerate_t getSampleRate() const { return m_sampleRate; } 55 sv_samplerate_t getSampleRate() const { return m_sampleRate; }
56 sv_samplerate_t getNativeRate() const { return m_sampleRate; }
57
58 QString getTitle() const {
59 if (m_model) return m_model->getTitle();
60 else return "";
61 }
62 QString getMaker() const {
63 if (m_model) return m_model->getMaker();
64 else return "";
65 }
66 QString getLocation() const {
67 if (m_model) return m_model->getLocation();
68 else return "";
69 }
54 70
55 float getValueMinimum() const { return -1.0f; } 71 float getValueMinimum() const { return -1.0f; }
56 float getValueMaximum() const { return 1.0f; } 72 float getValueMaximum() const { return 1.0f; }
57 73
58 virtual sv_frame_t getStartFrame() const { return m_startFrame; } 74 virtual sv_frame_t getStartFrame() const { return m_startFrame; }
59 virtual sv_frame_t getEndFrame() const { return m_startFrame + getFrameCount(); } 75 virtual sv_frame_t getEndFrame() const { return m_startFrame + getFrameCount(); }
60 76
61 void setStartFrame(sv_frame_t startFrame); 77 void setStartFrame(sv_frame_t startFrame);
62 78
63 virtual sv_frame_t getData(int channel, sv_frame_t start, sv_frame_t count, 79 virtual std::vector<float> getData(int channel, sv_frame_t start, sv_frame_t count) const;
64 float *buffer) const;
65 80
66 virtual sv_frame_t getData(int channel, sv_frame_t start, sv_frame_t count, 81 virtual std::vector<std::vector<float>> getMultiChannelData(int fromchannel, int tochannel, sv_frame_t start, sv_frame_t count) const;
67 double *buffer) const;
68
69 virtual sv_frame_t getData(int fromchannel, int tochannel,
70 sv_frame_t start, sv_frame_t count,
71 float **buffer) const;
72 82
73 virtual int getSummaryBlockSize(int desired) const; 83 virtual int getSummaryBlockSize(int desired) const;
74 84
75 virtual void getSummaries(int channel, sv_frame_t start, sv_frame_t count, 85 virtual void getSummaries(int channel, sv_frame_t start, sv_frame_t count,
76 RangeBlock &ranges, int &blockSize) const; 86 RangeBlock &ranges, int &blockSize) const;
82 virtual void toXml(QTextStream &out, 92 virtual void toXml(QTextStream &out,
83 QString indent = "", 93 QString indent = "",
84 QString extraAttributes = "") const; 94 QString extraAttributes = "") const;
85 95
86 protected: 96 protected:
87 WaveFileModel *m_model; 97 ReadOnlyWaveFileModel *m_model;
88 WavFileWriter *m_writer; 98 WavFileWriter *m_writer;
89 WavFileReader *m_reader; 99 WavFileReader *m_reader;
90 sv_samplerate_t m_sampleRate; 100 sv_samplerate_t m_sampleRate;
91 int m_channels; 101 int m_channels;
92 sv_frame_t m_frameCount; 102 sv_frame_t m_frameCount;