Mercurial > hg > svcore
comparison data/fileio/CodedAudioFileReader.cpp @ 1170:6877f4200912 3.0-integration
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 02 Mar 2016 16:16:36 +0000 |
parents | 457a1a619c5f 5b463c7727e5 |
children | 0a9193dc136b |
comparison
equal
deleted
inserted
replaced
1160:ea636412f9fe | 1170:6877f4200912 |
---|---|
144 << m_sampleRate << " presented for writing, rounding to " << fileRate | 144 << m_sampleRate << " presented for writing, rounding to " << fileRate |
145 << endl; | 145 << endl; |
146 } | 146 } |
147 fileInfo.samplerate = fileRate; | 147 fileInfo.samplerate = fileRate; |
148 fileInfo.channels = m_channelCount; | 148 fileInfo.channels = m_channelCount; |
149 | 149 |
150 // No point in writing 24-bit or float; generally this | 150 // Previously we were writing SF_FORMAT_PCM_16 and in a |
151 // class is used for decoding files that have come from a | 151 // comment I wrote: "No point in writing 24-bit or float; |
152 // 16 bit source or that decode to only 16 bits anyway. | 152 // generally this class is used for decoding files that |
153 fileInfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16; | 153 // have come from a 16 bit source or that decode to only |
154 // 16 bits anyway." That was naive -- we want to preserve | |
155 // the original values to the same float precision that we | |
156 // use internally. Saving PCM_16 obviously doesn't | |
157 // preserve values for sources at bit depths greater than | |
158 // 16, but it also doesn't always do so for sources at bit | |
159 // depths less than 16. | |
160 // | |
161 // (This came to light with a bug in libsndfile 1.0.26, | |
162 // which always reports every file as non-seekable, so | |
163 // that coded readers were being used even for WAV | |
164 // files. This changed the values that came from PCM_8 WAV | |
165 // sources, breaking Sonic Annotator's output comparison | |
166 // tests.) | |
167 // | |
168 // So: now we write floats. | |
169 fileInfo.format = SF_FORMAT_WAV | SF_FORMAT_FLOAT; | |
154 | 170 |
155 m_cacheFileWritePtr = sf_open(m_cacheFileName.toLocal8Bit(), | 171 m_cacheFileWritePtr = sf_open(m_cacheFileName.toLocal8Bit(), |
156 SFM_WRITE, &fileInfo); | 172 SFM_WRITE, &fileInfo); |
157 | 173 |
158 if (m_cacheFileWritePtr) { | 174 if (m_cacheFileWritePtr) { |