Mercurial > hg > svcore
comparison data/model/WritableWaveFileModel.h @ 1134:f8604a7c4660 3.0-integration
Merge from branch "tony-2.0-integration"
author | Chris Cannam |
---|---|
date | Wed, 14 Oct 2015 10:12:14 +0100 |
parents | e994747fb9dd |
children | 3aea4f7617bb |
comparison
equal
deleted
inserted
replaced
1132:0cb263a2f52c | 1134:f8604a7c4660 |
---|---|
31 WritableWaveFileModel(sv_samplerate_t sampleRate, int channels, QString path = ""); | 31 WritableWaveFileModel(sv_samplerate_t sampleRate, int channels, QString path = ""); |
32 ~WritableWaveFileModel(); | 32 ~WritableWaveFileModel(); |
33 | 33 |
34 /** | 34 /** |
35 * Call addSamples to append a block of samples to the end of the | 35 * Call addSamples to append a block of samples to the end of the |
36 * file. Caller should also call setCompletion to update the | 36 * file. Caller should also call setWriteProportion() to update |
37 * progress of this file, if it has a known end point, and should | 37 * the progress of this file, if it has a known end point, and |
38 * call setCompletion(100) when the file has been written. | 38 * should call writeComplete() when the file has been written. |
39 */ | 39 */ |
40 virtual bool addSamples(float **samples, sv_frame_t count); | 40 virtual bool addSamples(float **samples, sv_frame_t count); |
41 | |
42 /** | |
43 * Set the proportion of the file which has been written so far, | |
44 * as a percentage. This may be used to indicate progress. | |
45 * | |
46 * Note that this differs from the "completion" percentage | |
47 * reported through isReady()/getCompletion(). That percentage is | |
48 * updated when "internal processing has advanced... but the model | |
49 * has not changed externally", i.e. it reports progress in | |
50 * calculating the initial state of a model. In contrast, an | |
51 * update to setWriteProportion corresponds to a change in the | |
52 * externally visible state of the model (i.e. it contains more | |
53 * data than before). | |
54 */ | |
55 void setWriteProportion(int proportion); | |
56 | |
57 /** | |
58 * Indicate that writing is complete. You should call this even if | |
59 * you have never called setWriteProportion(). | |
60 */ | |
61 void writeComplete(); | |
62 | |
63 static const int PROPORTION_UNKNOWN; | |
64 | |
65 /** | |
66 * Get the proportion of the file which has been written so far, | |
67 * as a percentage. Return PROPORTION_UNKNOWN if unknown. | |
68 */ | |
69 int getWriteProportion() const; | |
41 | 70 |
42 bool isOK() const; | 71 bool isOK() const; |
43 bool isReady(int *) const; | 72 bool isReady(int *) const; |
44 | 73 |
45 virtual void setCompletion(int completion); // percentage | 74 /** |
46 virtual int getCompletion() const { return m_completion; } | 75 * Return the generation completion percentage of this model. This |
76 * is always 100, because the model is always in a complete state | |
77 * -- it just contains varying amounts of data depending on how | |
78 * much has been written. | |
79 */ | |
80 virtual int getCompletion() const { return 100; } | |
47 | 81 |
48 const ZoomConstraint *getZoomConstraint() const { | 82 const ZoomConstraint *getZoomConstraint() const { |
49 static PowerOfSqrtTwoZoomConstraint zc; | 83 static PowerOfSqrtTwoZoomConstraint zc; |
50 return &zc; | 84 return &zc; |
51 } | 85 } |
99 WavFileReader *m_reader; | 133 WavFileReader *m_reader; |
100 sv_samplerate_t m_sampleRate; | 134 sv_samplerate_t m_sampleRate; |
101 int m_channels; | 135 int m_channels; |
102 sv_frame_t m_frameCount; | 136 sv_frame_t m_frameCount; |
103 sv_frame_t m_startFrame; | 137 sv_frame_t m_startFrame; |
104 int m_completion; | 138 int m_proportion; |
105 }; | 139 }; |
106 | 140 |
107 #endif | 141 #endif |
108 | 142 |