comparison data/fileio/WavFileReader.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 59e7fe1b1003
children a1cd5abcb38b
comparison
equal deleted inserted replaced
1037:bf0e5944289b 1038:cc27f35aa75c
87 void 87 void
88 WavFileReader::updateFrameCount() 88 WavFileReader::updateFrameCount()
89 { 89 {
90 QMutexLocker locker(&m_mutex); 90 QMutexLocker locker(&m_mutex);
91 91
92 int prevCount = m_fileInfo.frames; 92 sv_frame_t prevCount = m_fileInfo.frames;
93 93
94 if (m_file) { 94 if (m_file) {
95 sf_close(m_file); 95 sf_close(m_file);
96 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); 96 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo);
97 if (!m_file || m_fileInfo.channels <= 0) { 97 if (!m_file || m_fileInfo.channels <= 0) {
121 updateFrameCount(); 121 updateFrameCount();
122 m_updating = false; 122 m_updating = false;
123 } 123 }
124 124
125 void 125 void
126 WavFileReader::getInterleavedFrames(int start, int count, 126 WavFileReader::getInterleavedFrames(sv_frame_t start, sv_frame_t count,
127 SampleBlock &results) const 127 SampleBlock &results) const
128 { 128 {
129 if (count == 0) return; 129 if (count == 0) return;
130 results.clear(); 130 results.clear();
131 results.reserve(count * m_fileInfo.channels); 131 results.reserve(count * m_fileInfo.channels);
171 171
172 m_lastStart = start; 172 m_lastStart = start;
173 m_lastCount = readCount; 173 m_lastCount = readCount;
174 } 174 }
175 175
176 for (int i = 0; i < count * m_fileInfo.channels; ++i) { 176 for (sv_frame_t i = 0; i < count * m_fileInfo.channels; ++i) {
177 if (i >= m_bufsiz) { 177 if (i >= m_bufsiz) {
178 cerr << "INTERNAL ERROR: WavFileReader::getInterleavedFrames: " << i << " >= " << m_bufsiz << endl; 178 cerr << "INTERNAL ERROR: WavFileReader::getInterleavedFrames: " << i << " >= " << m_bufsiz << endl;
179 } 179 }
180 results.push_back(m_buffer[i]); 180 results.push_back(m_buffer[i]);
181 } 181 }