comparison data/model/WritableWaveFileModel.h @ 1122:b9faee02afa5 recording

Make WritableWaveFileModel a true WaveFileModel (and ReadOnlyWaveFileModel the other sort of it). Enable recording from an empty session using that.
author Chris Cannam
date Wed, 19 Aug 2015 17:03:31 +0100
parents 9f4505ac9072
children efea94b04d5a
comparison
equal deleted inserted replaced
1117:020277bfafcb 1122:b9faee02afa5
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; }
79 virtual void toXml(QTextStream &out, 95 virtual void toXml(QTextStream &out,
80 QString indent = "", 96 QString indent = "",
81 QString extraAttributes = "") const; 97 QString extraAttributes = "") const;
82 98
83 protected: 99 protected:
84 WaveFileModel *m_model; 100 ReadOnlyWaveFileModel *m_model;
85 WavFileWriter *m_writer; 101 WavFileWriter *m_writer;
86 WavFileReader *m_reader; 102 WavFileReader *m_reader;
87 sv_samplerate_t m_sampleRate; 103 sv_samplerate_t m_sampleRate;
88 int m_channels; 104 int m_channels;
89 sv_frame_t m_frameCount; 105 sv_frame_t m_frameCount;