diff data/fileio/AudioFileReaderFactory.cpp @ 1279:0a9193dc136b 3.0-integration

Debug output updates
author Chris Cannam
date Tue, 22 Nov 2016 16:40:41 +0000
parents 13701ab9d2c7
children 9f9f55a8af92
line wrap: on
line diff
--- a/data/fileio/AudioFileReaderFactory.cpp	Tue Nov 22 16:40:28 2016 +0000
+++ b/data/fileio/AudioFileReaderFactory.cpp	Tue Nov 22 16:40:41 2016 +0000
@@ -29,8 +29,6 @@
 #include <QFileInfo>
 #include <iostream>
 
-//#define DEBUG_AUDIO_FILE_READER_FACTORY 1
-
 QString
 AudioFileReaderFactory::getKnownExtensions()
 {
@@ -89,17 +87,15 @@
 {
     QString err;
 
-#ifdef DEBUG_AUDIO_FILE_READER_FACTORY
-    cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\"): Requested rate: " << targetRate << endl;
-#endif
+    SVDEBUG << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\"): Requested rate: " << targetRate << (targetRate == 0 ? " (use source rate)" : "") << endl;
 
     if (!source.isOK()) {
-        cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Failed to retrieve source (transmission error?): " << source.getErrorString() << endl;
+        SVDEBUG << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Failed to retrieve source (transmission error?): " << source.getErrorString() << endl;
         return 0;
     }
 
     if (!source.isAvailable()) {
-        cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Source not found" << endl;
+        SVDEBUG << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Source not found" << endl;
         return 0;
     }
 
@@ -143,9 +139,7 @@
              (cacheMode == CodedAudioFileReader::CacheInMemory) ||
              (targetRate != 0 && fileRate != targetRate))) {
 
-#ifdef DEBUG_AUDIO_FILE_READER_FACTORY
-            cerr << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", normalised " << normalised << ", seekable " << reader->isQuicklySeekable() << ", in memory " << (cacheMode == CodedAudioFileReader::CacheInMemory) << ", creating decoding reader" << endl;
-#endif
+            SVDEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", normalised " << normalised << ", seekable " << reader->isQuicklySeekable() << ", in memory " << (cacheMode == CodedAudioFileReader::CacheInMemory) << ", creating decoding reader" << endl;
             
             delete reader;
             reader = new DecodingWavFileReader
@@ -214,9 +208,7 @@
          (cacheMode == CodedAudioFileReader::CacheInMemory) ||
          (targetRate != 0 && fileRate != targetRate))) {
 
-#ifdef DEBUG_AUDIO_FILE_READER_FACTORY
-        cerr << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", normalised " << normalised << ", seekable " << reader->isQuicklySeekable() << ", in memory " << (cacheMode == CodedAudioFileReader::CacheInMemory) << ", creating decoding reader" << endl;
-#endif
+        SVDEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", normalised " << normalised << ", seekable " << reader->isQuicklySeekable() << ", in memory " << (cacheMode == CodedAudioFileReader::CacheInMemory) << ", creating decoding reader" << endl;
 
         delete reader;
         reader = new DecodingWavFileReader
@@ -264,10 +256,10 @@
 #endif
 
     if (!reader) {
-        cerr << "AudioFileReaderFactory::Failed to create a reader for "
-             << "url \"" << source.getLocation()
-             << "\" (content type \""
-             << source.getContentType() << "\")" << endl;
+        SVDEBUG << "AudioFileReaderFactory::Failed to create a reader for "
+                << "url \"" << source.getLocation()
+                << "\" (content type \""
+                << source.getContentType() << "\")" << endl;
         return nullptr;
     }