Mercurial > hg > svcore
comparison data/model/WritableWaveFileModel.h @ 1069:32ab6c48efaa
Merge from branch tonioni
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:11:34 +0100 |
parents | 0fd3661bcfff |
children | 9f4505ac9072 |
comparison
equal
deleted
inserted
replaced
1036:682d64f05e72 | 1069:32ab6c48efaa |
---|---|
24 class WritableWaveFileModel : public RangeSummarisableTimeValueModel | 24 class WritableWaveFileModel : public RangeSummarisableTimeValueModel |
25 { | 25 { |
26 Q_OBJECT | 26 Q_OBJECT |
27 | 27 |
28 public: | 28 public: |
29 WritableWaveFileModel(int sampleRate, int channels, QString path = ""); | 29 WritableWaveFileModel(sv_samplerate_t sampleRate, int channels, QString path = ""); |
30 ~WritableWaveFileModel(); | 30 ~WritableWaveFileModel(); |
31 | 31 |
32 /** | 32 /** |
33 * Call addSamples to append a block of samples to the end of the | 33 * Call addSamples to append a block of samples to the end of the |
34 * file. Caller should also call setCompletion to update the | 34 * file. Caller should also call setCompletion to update the |
35 * progress of this file, if it has a known end point, and should | 35 * progress of this file, if it has a known end point, and should |
36 * call setCompletion(100) when the file has been written. | 36 * call setCompletion(100) when the file has been written. |
37 */ | 37 */ |
38 virtual bool addSamples(float **samples, int count); | 38 virtual bool addSamples(float **samples, sv_frame_t count); |
39 | 39 |
40 bool isOK() const; | 40 bool isOK() const; |
41 bool isReady(int *) const; | 41 bool isReady(int *) const; |
42 | 42 |
43 virtual void setCompletion(int completion); // percentage | 43 virtual void setCompletion(int completion); // percentage |
46 const ZoomConstraint *getZoomConstraint() const { | 46 const ZoomConstraint *getZoomConstraint() const { |
47 static PowerOfSqrtTwoZoomConstraint zc; | 47 static PowerOfSqrtTwoZoomConstraint zc; |
48 return &zc; | 48 return &zc; |
49 } | 49 } |
50 | 50 |
51 int getFrameCount() const; | 51 sv_frame_t getFrameCount() const; |
52 int getChannelCount() const { return m_channels; } | 52 int getChannelCount() const { return m_channels; } |
53 int getSampleRate() const { return m_sampleRate; } | 53 sv_samplerate_t getSampleRate() const { return m_sampleRate; } |
54 | |
55 virtual Model *clone() const; | |
56 | 54 |
57 float getValueMinimum() const { return -1.0f; } | 55 float getValueMinimum() const { return -1.0f; } |
58 float getValueMaximum() const { return 1.0f; } | 56 float getValueMaximum() const { return 1.0f; } |
59 | 57 |
60 virtual int getStartFrame() const { return m_startFrame; } | 58 virtual sv_frame_t getStartFrame() const { return m_startFrame; } |
61 virtual int getEndFrame() const { return m_startFrame + getFrameCount(); } | 59 virtual sv_frame_t getEndFrame() const { return m_startFrame + getFrameCount(); } |
62 | 60 |
63 void setStartFrame(int startFrame); | 61 void setStartFrame(sv_frame_t startFrame); |
64 | 62 |
65 virtual int getData(int channel, int start, int count, | 63 virtual sv_frame_t getData(int channel, sv_frame_t start, sv_frame_t count, |
66 float *buffer) const; | 64 float *buffer) const; |
67 | 65 |
68 virtual int getData(int channel, int start, int count, | 66 virtual sv_frame_t getData(int channel, sv_frame_t start, sv_frame_t count, |
69 double *buffer) const; | 67 double *buffer) const; |
70 | 68 |
71 virtual int getData(int fromchannel, int tochannel, | 69 virtual sv_frame_t getData(int fromchannel, int tochannel, |
72 int start, int count, | 70 sv_frame_t start, sv_frame_t count, |
73 float **buffer) const; | 71 float **buffer) const; |
74 | 72 |
75 virtual int getSummaryBlockSize(int desired) const; | 73 virtual int getSummaryBlockSize(int desired) const; |
76 | 74 |
77 virtual void getSummaries(int channel, int start, int count, | 75 virtual void getSummaries(int channel, sv_frame_t start, sv_frame_t count, |
78 RangeBlock &ranges, int &blockSize) const; | 76 RangeBlock &ranges, int &blockSize) const; |
79 | 77 |
80 virtual Range getSummary(int channel, int start, int count) const; | 78 virtual Range getSummary(int channel, sv_frame_t start, sv_frame_t count) const; |
81 | 79 |
82 QString getTypeName() const { return tr("Writable Wave File"); } | 80 QString getTypeName() const { return tr("Writable Wave File"); } |
83 | 81 |
84 virtual void toXml(QTextStream &out, | 82 virtual void toXml(QTextStream &out, |
85 QString indent = "", | 83 QString indent = "", |
87 | 85 |
88 protected: | 86 protected: |
89 WaveFileModel *m_model; | 87 WaveFileModel *m_model; |
90 WavFileWriter *m_writer; | 88 WavFileWriter *m_writer; |
91 WavFileReader *m_reader; | 89 WavFileReader *m_reader; |
92 int m_sampleRate; | 90 sv_samplerate_t m_sampleRate; |
93 int m_channels; | 91 int m_channels; |
94 int m_frameCount; | 92 sv_frame_t m_frameCount; |
95 int m_startFrame; | 93 sv_frame_t m_startFrame; |
96 int m_completion; | 94 int m_completion; |
97 }; | 95 }; |
98 | 96 |
99 #endif | 97 #endif |
100 | 98 |