Mercurial > hg > svcore
comparison data/fileio/WavFileReader.cpp @ 1343:c380e56c95f5 3.0-integration
Untabify some more
author | Chris Cannam |
---|---|
date | Fri, 06 Jan 2017 09:50:13 +0000 |
parents | 54af1e21705c |
children | b3cb0edc25cd |
comparison
equal
deleted
inserted
replaced
1342:c0fece5e7755 | 1343:c380e56c95f5 |
---|---|
41 m_fileInfo.format = 0; | 41 m_fileInfo.format = 0; |
42 m_fileInfo.frames = 0; | 42 m_fileInfo.frames = 0; |
43 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); | 43 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); |
44 | 44 |
45 if (!m_file || (!fileUpdating && m_fileInfo.channels <= 0)) { | 45 if (!m_file || (!fileUpdating && m_fileInfo.channels <= 0)) { |
46 SVDEBUG << "WavFileReader::initialize: Failed to open file at \"" | 46 SVDEBUG << "WavFileReader::initialize: Failed to open file at \"" |
47 << m_path << "\" (" | 47 << m_path << "\" (" |
48 << sf_strerror(m_file) << ")" << endl; | 48 << sf_strerror(m_file) << ")" << endl; |
49 | 49 |
50 if (m_file) { | 50 if (m_file) { |
51 m_error = QString("Couldn't load audio file '%1':\n%2") | 51 m_error = QString("Couldn't load audio file '%1':\n%2") |
52 .arg(m_path).arg(sf_strerror(m_file)); | 52 .arg(m_path).arg(sf_strerror(m_file)); |
53 } else { | 53 } else { |
54 m_error = QString("Failed to open audio file '%1'") | 54 m_error = QString("Failed to open audio file '%1'") |
55 .arg(m_path); | 55 .arg(m_path); |
56 } | 56 } |
57 return; | 57 return; |
58 } | 58 } |
59 | 59 |
60 if (m_fileInfo.channels > 0) { | 60 if (m_fileInfo.channels > 0) { |
61 | 61 |
62 m_frameCount = m_fileInfo.frames; | 62 m_frameCount = m_fileInfo.frames; |
145 } | 145 } |
146 | 146 |
147 if (start >= m_fileInfo.frames) { | 147 if (start >= m_fileInfo.frames) { |
148 // SVDEBUG << "WavFileReader::getInterleavedFrames: " << start | 148 // SVDEBUG << "WavFileReader::getInterleavedFrames: " << start |
149 // << " > " << m_fileInfo.frames << endl; | 149 // << " > " << m_fileInfo.frames << endl; |
150 return {}; | 150 return {}; |
151 } | 151 } |
152 | 152 |
153 if (start + count > m_fileInfo.frames) { | 153 if (start + count > m_fileInfo.frames) { |
154 count = m_fileInfo.frames - start; | 154 count = m_fileInfo.frames - start; |
155 } | 155 } |
156 | 156 |
157 // Because WaveFileModel::getSummaries() is called separately for | 157 // Because WaveFileModel::getSummaries() is called separately for |
158 // individual channels, it's quite common for us to be called | 158 // individual channels, it's quite common for us to be called |
159 // repeatedly for the same data. So this is worth cacheing. | 159 // repeatedly for the same data. So this is worth cacheing. |