comparison data/fileio/CodedAudioFileReader.cpp @ 1359:1c9bbbb6116a 3.0-integration

Use W64 instead of WAV for decoded files; use Ogg reader in preference to WAV one for Ogg files (WAV reader works, via libsndfile, but doesn't load metadata); fix Ogg reader to use QFile open instead of non-Win32-compatible API; add more encoder tests, audio writer test, midi reader test
author Chris Cannam
date Tue, 10 Jan 2017 10:58:25 +0000
parents 97deefd38060
children 49b43306778b
comparison
equal deleted inserted replaced
1358:b7be05d57f0a 1359:1c9bbbb6116a
162 162
163 if (m_cacheMode == CacheInTemporaryFile) { 163 if (m_cacheMode == CacheInTemporaryFile) {
164 164
165 try { 165 try {
166 QDir dir(TempDirectory::getInstance()->getPath()); 166 QDir dir(TempDirectory::getInstance()->getPath());
167 m_cacheFileName = dir.filePath(QString("decoded_%1.wav") 167 m_cacheFileName = dir.filePath(QString("decoded_%1.w64")
168 .arg((intptr_t)this)); 168 .arg((intptr_t)this));
169 169
170 SF_INFO fileInfo; 170 SF_INFO fileInfo;
171 int fileRate = int(round(m_sampleRate)); 171 int fileRate = int(round(m_sampleRate));
172 if (m_sampleRate != sv_samplerate_t(fileRate)) { 172 if (m_sampleRate != sv_samplerate_t(fileRate)) {
194 // files. This changed the values that came from PCM_8 WAV 194 // files. This changed the values that came from PCM_8 WAV
195 // sources, breaking Sonic Annotator's output comparison 195 // sources, breaking Sonic Annotator's output comparison
196 // tests.) 196 // tests.)
197 // 197 //
198 // So: now we write floats. 198 // So: now we write floats.
199 fileInfo.format = SF_FORMAT_WAV | SF_FORMAT_FLOAT; 199 fileInfo.format = SF_FORMAT_W64 | SF_FORMAT_FLOAT;
200 200
201 m_cacheFileWritePtr = sf_open(m_cacheFileName.toLocal8Bit(), 201 #ifdef Q_OS_WIN
202 SFM_WRITE, &fileInfo); 202 m_cacheFileWritePtr = sf_wchar_open
203 ((LPCWSTR)m_cacheFileName.utf16(), SFM_WRITE, &m_fileInfo);
204 #else
205 m_cacheFileWritePtr = sf_open
206 (m_cacheFileName.toLocal8Bit(), SFM_WRITE, &fileInfo);
207 #endif
203 208
204 if (m_cacheFileWritePtr) { 209 if (m_cacheFileWritePtr) {
205 210
206 // Ideally we would do this now only if we were in a 211 // Ideally we would do this now only if we were in a
207 // threaded mode -- creating the reader later if we're 212 // threaded mode -- creating the reader later if we're