Mercurial > hg > svcore
comparison data/fileio/AudioFileReaderFactory.cpp @ 1206:659372323b45 tony-2.0-integration
Merge latest SV 3.0 branch code
author | Chris Cannam |
---|---|
date | Fri, 19 Aug 2016 15:58:57 +0100 |
parents | 6877f4200912 |
children | 13701ab9d2c7 |
comparison
equal
deleted
inserted
replaced
1136:e94719f941ba | 1206:659372323b45 |
---|---|
27 | 27 |
28 #include <QString> | 28 #include <QString> |
29 #include <QFileInfo> | 29 #include <QFileInfo> |
30 #include <iostream> | 30 #include <iostream> |
31 | 31 |
32 //#define DEBUG_AUDIO_FILE_READER_FACTORY 1 | |
33 | |
32 QString | 34 QString |
33 AudioFileReaderFactory::getKnownExtensions() | 35 AudioFileReaderFactory::getKnownExtensions() |
34 { | 36 { |
35 std::set<QString> extensions; | 37 std::set<QString> extensions; |
36 | 38 |
85 bool threading, | 87 bool threading, |
86 ProgressReporter *reporter) | 88 ProgressReporter *reporter) |
87 { | 89 { |
88 QString err; | 90 QString err; |
89 | 91 |
90 SVDEBUG << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\"): Requested rate: " << targetRate << endl; | 92 #ifdef DEBUG_AUDIO_FILE_READER_FACTORY |
93 cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\"): Requested rate: " << targetRate << endl; | |
94 #endif | |
91 | 95 |
92 if (!source.isOK()) { | 96 if (!source.isOK()) { |
93 cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Failed to retrieve source (transmission error?): " << source.getErrorString() << endl; | 97 cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Failed to retrieve source (transmission error?): " << source.getErrorString() << endl; |
94 return 0; | 98 return 0; |
95 } | 99 } |
96 | 100 |
97 if (!source.isAvailable()) { | 101 if (!source.isAvailable()) { |
98 SVDEBUG << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Source not found" << endl; | 102 cerr << "AudioFileReaderFactory::createReader(\"" << source.getLocation() << "\": Source not found" << endl; |
99 return 0; | 103 return 0; |
100 } | 104 } |
101 | 105 |
102 AudioFileReader *reader = 0; | 106 AudioFileReader *reader = 0; |
103 | 107 |
137 (!reader->isQuicklySeekable() || | 141 (!reader->isQuicklySeekable() || |
138 normalised || | 142 normalised || |
139 (cacheMode == CodedAudioFileReader::CacheInMemory) || | 143 (cacheMode == CodedAudioFileReader::CacheInMemory) || |
140 (targetRate != 0 && fileRate != targetRate))) { | 144 (targetRate != 0 && fileRate != targetRate))) { |
141 | 145 |
142 SVDEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", normalised " << normalised << ", seekable " << reader->isQuicklySeekable() << ", in memory " << (cacheMode == CodedAudioFileReader::CacheInMemory) << ", creating decoding reader" << endl; | 146 #ifdef DEBUG_AUDIO_FILE_READER_FACTORY |
143 | 147 cerr << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", normalised " << normalised << ", seekable " << reader->isQuicklySeekable() << ", in memory " << (cacheMode == CodedAudioFileReader::CacheInMemory) << ", creating decoding reader" << endl; |
148 #endif | |
149 | |
144 delete reader; | 150 delete reader; |
145 reader = new DecodingWavFileReader | 151 reader = new DecodingWavFileReader |
146 (source, | 152 (source, |
147 decodeMode, cacheMode, | 153 decodeMode, cacheMode, |
148 targetRate ? targetRate : fileRate, | 154 targetRate ? targetRate : fileRate, |
206 (!reader->isQuicklySeekable() || | 212 (!reader->isQuicklySeekable() || |
207 normalised || | 213 normalised || |
208 (cacheMode == CodedAudioFileReader::CacheInMemory) || | 214 (cacheMode == CodedAudioFileReader::CacheInMemory) || |
209 (targetRate != 0 && fileRate != targetRate))) { | 215 (targetRate != 0 && fileRate != targetRate))) { |
210 | 216 |
211 SVDEBUG << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", normalised " << normalised << ", seekable " << reader->isQuicklySeekable() << ", in memory " << (cacheMode == CodedAudioFileReader::CacheInMemory) << ", creating decoding reader" << endl; | 217 #ifdef DEBUG_AUDIO_FILE_READER_FACTORY |
218 cerr << "AudioFileReaderFactory::createReader: WAV file rate: " << reader->getSampleRate() << ", normalised " << normalised << ", seekable " << reader->isQuicklySeekable() << ", in memory " << (cacheMode == CodedAudioFileReader::CacheInMemory) << ", creating decoding reader" << endl; | |
219 #endif | |
212 | 220 |
213 delete reader; | 221 delete reader; |
214 reader = new DecodingWavFileReader | 222 reader = new DecodingWavFileReader |
215 (source, | 223 (source, |
216 decodeMode, cacheMode, | 224 decodeMode, cacheMode, |