comparison data/model/WritableWaveFileModel.cpp @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents cd42620e3f40
children a1cd5abcb38b
comparison
equal deleted inserted replaced
1037:bf0e5944289b 1038:cc27f35aa75c
84 return; 84 return;
85 } 85 }
86 m_model->setStartFrame(m_startFrame); 86 m_model->setStartFrame(m_startFrame);
87 87
88 connect(m_model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged())); 88 connect(m_model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged()));
89 connect(m_model, SIGNAL(modelChangedWithin(int, int)), 89 connect(m_model, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)),
90 this, SIGNAL(modelChangedWithin(int, int))); 90 this, SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)));
91 } 91 }
92 92
93 WritableWaveFileModel::~WritableWaveFileModel() 93 WritableWaveFileModel::~WritableWaveFileModel()
94 { 94 {
95 delete m_model; 95 delete m_model;
96 delete m_writer; 96 delete m_writer;
97 delete m_reader; 97 delete m_reader;
98 } 98 }
99 99
100 void 100 void
101 WritableWaveFileModel::setStartFrame(int startFrame) 101 WritableWaveFileModel::setStartFrame(sv_frame_t startFrame)
102 { 102 {
103 m_startFrame = startFrame; 103 m_startFrame = startFrame;
104 if (m_model) m_model->setStartFrame(startFrame); 104 if (m_model) m_model->setStartFrame(startFrame);
105 } 105 }
106 106
107 bool 107 bool
108 WritableWaveFileModel::addSamples(float **samples, int count) 108 WritableWaveFileModel::addSamples(float **samples, sv_frame_t count)
109 { 109 {
110 if (!m_writer) return false; 110 if (!m_writer) return false;
111 111
112 #ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL 112 #ifdef DEBUG_WRITABLE_WAVE_FILE_MODEL
113 // SVDEBUG << "WritableWaveFileModel::addSamples(" << count << ")" << endl; 113 // SVDEBUG << "WritableWaveFileModel::addSamples(" << count << ")" << endl;
160 if (completion == 100) { 160 if (completion == 100) {
161 if (m_reader) m_reader->updateDone(); 161 if (m_reader) m_reader->updateDone();
162 } 162 }
163 } 163 }
164 164
165 int 165 sv_frame_t
166 WritableWaveFileModel::getFrameCount() const 166 WritableWaveFileModel::getFrameCount() const
167 { 167 {
168 // SVDEBUG << "WritableWaveFileModel::getFrameCount: count = " << m_frameCount << endl; 168 // SVDEBUG << "WritableWaveFileModel::getFrameCount: count = " << m_frameCount << endl;
169 return m_frameCount; 169 return m_frameCount;
170 } 170 }
174 { 174 {
175 assert(0); //!!! 175 assert(0); //!!!
176 return 0; 176 return 0;
177 } 177 }
178 178
179 int 179 sv_frame_t
180 WritableWaveFileModel::getData(int channel, int start, int count, 180 WritableWaveFileModel::getData(int channel, sv_frame_t start, sv_frame_t count,
181 float *buffer) const 181 float *buffer) const
182 { 182 {
183 if (!m_model || m_model->getChannelCount() == 0) return 0; 183 if (!m_model || m_model->getChannelCount() == 0) return 0;
184 return m_model->getData(channel, start, count, buffer); 184 return m_model->getData(channel, start, count, buffer);
185 } 185 }
186 186
187 int 187 sv_frame_t
188 WritableWaveFileModel::getData(int channel, int start, int count, 188 WritableWaveFileModel::getData(int channel, sv_frame_t start, sv_frame_t count,
189 double *buffer) const 189 double *buffer) const
190 { 190 {
191 if (!m_model || m_model->getChannelCount() == 0) return 0; 191 if (!m_model || m_model->getChannelCount() == 0) return 0;
192 return m_model->getData(channel, start, count, buffer); 192 return m_model->getData(channel, start, count, buffer);
193 } 193 }
194 194
195 int 195 sv_frame_t
196 WritableWaveFileModel::getData(int fromchannel, int tochannel, 196 WritableWaveFileModel::getData(int fromchannel, int tochannel,
197 int start, int count, 197 sv_frame_t start, sv_frame_t count,
198 float **buffers) const 198 float **buffers) const
199 { 199 {
200 if (!m_model || m_model->getChannelCount() == 0) return 0; 200 if (!m_model || m_model->getChannelCount() == 0) return 0;
201 return m_model->getData(fromchannel, tochannel, start, count, buffers); 201 return m_model->getData(fromchannel, tochannel, start, count, buffers);
202 } 202 }
207 if (!m_model) return desired; 207 if (!m_model) return desired;
208 return m_model->getSummaryBlockSize(desired); 208 return m_model->getSummaryBlockSize(desired);
209 } 209 }
210 210
211 void 211 void
212 WritableWaveFileModel::getSummaries(int channel, int start, int count, 212 WritableWaveFileModel::getSummaries(int channel, sv_frame_t start, sv_frame_t count,
213 RangeBlock &ranges, 213 RangeBlock &ranges,
214 int &blockSize) const 214 int &blockSize) const
215 { 215 {
216 ranges.clear(); 216 ranges.clear();
217 if (!m_model || m_model->getChannelCount() == 0) return; 217 if (!m_model || m_model->getChannelCount() == 0) return;
218 m_model->getSummaries(channel, start, count, ranges, blockSize); 218 m_model->getSummaries(channel, start, count, ranges, blockSize);
219 } 219 }
220 220
221 WritableWaveFileModel::Range 221 WritableWaveFileModel::Range
222 WritableWaveFileModel::getSummary(int channel, int start, int count) const 222 WritableWaveFileModel::getSummary(int channel, sv_frame_t start, sv_frame_t count) const
223 { 223 {
224 if (!m_model || m_model->getChannelCount() == 0) return Range(); 224 if (!m_model || m_model->getChannelCount() == 0) return Range();
225 return m_model->getSummary(channel, start, count); 225 return m_model->getSummary(channel, start, count);
226 } 226 }
227 227