comparison data/fileio/AudioFileReaderFactory.cpp @ 742:c10cb8782576 coreaudio_tests

Merge from branch "default"
author Chris Cannam
date Sun, 01 Jul 2012 11:53:00 +0100
parents 029dd9e5cc29 1424aa29ae95
children 02390a4c2abe
comparison
equal deleted inserted replaced
666:4efa7429cd85 742:c10cb8782576
75 AudioFileReaderFactory::create(FileSource source, size_t targetRate, bool threading, 75 AudioFileReaderFactory::create(FileSource source, size_t targetRate, bool threading,
76 ProgressReporter *reporter) 76 ProgressReporter *reporter)
77 { 77 {
78 QString err; 78 QString err;
79 79
80 std::cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation().toStdString() << "\"): Requested rate: " << targetRate << std::endl; 80 SVDEBUG << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\"): Requested rate: " << targetRate << endl;
81 81
82 if (!source.isOK() || !source.isAvailable()) { 82 if (!source.isOK()) {
83 std::cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation().toStdString() << "\": Source unavailable" << std::endl; 83 std::cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Failed to retrieve source (transmission error?): " << source.getErrorString() << std::endl;
84 return 0;
85 }
86
87 if (!source.isAvailable()) {
88 SVDEBUG << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Source not found" << endl;
84 return 0; 89 return 0;
85 } 90 }
86 91
87 AudioFileReader *reader = 0; 92 AudioFileReader *reader = 0;
88 93
95 100
96 if (targetRate != 0 && 101 if (targetRate != 0 &&
97 reader->isOK() && 102 reader->isOK() &&
98 reader->getSampleRate() != targetRate) { 103 reader->getSampleRate() != targetRate) {
99 104
100 std::cerr << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", creating resampling reader" << std::endl; 105 SVDEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", creating resampling reader" << endl;
101 106
102 delete reader; 107 delete reader;
103 reader = new ResamplingWavFileReader 108 reader = new ResamplingWavFileReader
104 (source, 109 (source,
105 threading ? 110 threading ?
206 211
207 if (targetRate != 0 && 212 if (targetRate != 0 &&
208 reader->isOK() && 213 reader->isOK() &&
209 reader->getSampleRate() != targetRate) { 214 reader->getSampleRate() != targetRate) {
210 215
211 std::cerr << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", creating resampling reader" << std::endl; 216 SVDEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", creating resampling reader" << endl;
212 217
213 delete reader; 218 delete reader;
214 reader = new ResamplingWavFileReader 219 reader = new ResamplingWavFileReader
215 (source, 220 (source,
216 threading ? 221 threading ?
310 return reader; 315 return reader;
311 } 316 }
312 std::cerr << "AudioFileReaderFactory: Preferred reader for " 317 std::cerr << "AudioFileReaderFactory: Preferred reader for "
313 << "url \"" << source.getLocation().toStdString() 318 << "url \"" << source.getLocation().toStdString()
314 << "\" (content type \"" 319 << "\" (content type \""
315 << source.getContentType().toStdString() << "\") failed"; 320 << source.getContentType() << "\") failed";
316 321
317 if (reader->getError() != "") { 322 if (reader->getError() != "") {
318 std::cerr << ": \"" << reader->getError().toStdString() << "\""; 323 std::cerr << ": \"" << reader->getError() << "\"";
319 } 324 }
320 std::cerr << std::endl; 325 std::cerr << std::endl;
321 delete reader; 326 delete reader;
322 reader = 0; 327 reader = 0;
323 } 328 }