diff data/fileio/AudioFileReaderFactory.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 c0fece5e7755
children 70e172e6cc59 c8fad3c14a2b
line wrap: on
line diff
--- a/data/fileio/AudioFileReaderFactory.cpp	Mon Jan 09 18:51:42 2017 +0000
+++ b/data/fileio/AudioFileReaderFactory.cpp	Tue Jan 10 10:58:25 2017 +0000
@@ -126,6 +126,27 @@
             SVDEBUG << "AudioFileReaderFactory: Source not officially handled by any reader, trying again with each reader in turn"
                     << endl;
         }
+    
+#ifdef HAVE_OGGZ
+#ifdef HAVE_FISHSOUND
+        // If we have the "real" Ogg reader, use that first. Otherwise
+        // the WavFileReader will likely accept Ogg files (as
+        // libsndfile supports them) but it has no ability to return
+        // file metadata, so we get a slightly less useful result.
+        if (anyReader || OggVorbisFileReader::supports(source)) {
+
+            reader = new OggVorbisFileReader
+                (source, decodeMode, cacheMode, targetRate, normalised, reporter);
+
+            if (reader->isOK()) {
+                SVDEBUG << "AudioFileReaderFactory: Ogg file reader is OK, returning it" << endl;
+                return reader;
+            } else {
+                delete reader;
+            }
+        }
+#endif
+#endif
 
         if (anyReader || WavFileReader::supports(source)) {
 
@@ -157,23 +178,6 @@
                 delete reader;
             }
         }
-    
-#ifdef HAVE_OGGZ
-#ifdef HAVE_FISHSOUND
-        if (anyReader || OggVorbisFileReader::supports(source)) {
-
-            reader = new OggVorbisFileReader
-                (source, decodeMode, cacheMode, targetRate, normalised, reporter);
-
-            if (reader->isOK()) {
-                SVDEBUG << "AudioFileReaderFactory: Ogg file reader is OK, returning it" << endl;
-                return reader;
-            } else {
-                delete reader;
-            }
-        }
-#endif
-#endif
 
 #ifdef HAVE_MAD
         if (anyReader || MP3FileReader::supports(source)) {