comparison data/fileio/CodedAudioFileReader.cpp @ 690:1424aa29ae95

Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author Chris Cannam
date Tue, 14 Jun 2011 15:26:52 +0100
parents 06f13a3b9e9e
children 21d39720d5da
comparison
equal deleted inserted replaced
689:573d45e9487b 690:1424aa29ae95
38 m_cacheWriteBufferIndex(0), 38 m_cacheWriteBufferIndex(0),
39 m_cacheWriteBufferSize(16384), 39 m_cacheWriteBufferSize(16384),
40 m_resampler(0), 40 m_resampler(0),
41 m_resampleBuffer(0) 41 m_resampleBuffer(0)
42 { 42 {
43 // DEBUG << "CodedAudioFileReader::CodedAudioFileReader: rate " << targetRate << endl; 43 // SVDEBUG << "CodedAudioFileReader::CodedAudioFileReader: rate " << targetRate << endl;
44 44
45 m_frameCount = 0; 45 m_frameCount = 0;
46 m_sampleRate = targetRate; 46 m_sampleRate = targetRate;
47 } 47 }
48 48
52 52
53 endSerialised(); 53 endSerialised();
54 54
55 if (m_cacheFileWritePtr) sf_close(m_cacheFileWritePtr); 55 if (m_cacheFileWritePtr) sf_close(m_cacheFileWritePtr);
56 56
57 // DEBUG << "CodedAudioFileReader::~CodedAudioFileReader: deleting cache file reader" << endl; 57 // SVDEBUG << "CodedAudioFileReader::~CodedAudioFileReader: deleting cache file reader" << endl;
58 58
59 delete m_cacheFileReader; 59 delete m_cacheFileReader;
60 delete[] m_cacheWriteBuffer; 60 delete[] m_cacheWriteBuffer;
61 61
62 if (m_cacheFileName != "") { 62 if (m_cacheFileName != "") {
70 } 70 }
71 71
72 void 72 void
73 CodedAudioFileReader::startSerialised(QString id) 73 CodedAudioFileReader::startSerialised(QString id)
74 { 74 {
75 // DEBUG << "CodedAudioFileReader::startSerialised(" << id << ")" << endl; 75 // SVDEBUG << "CodedAudioFileReader::startSerialised(" << id << ")" << endl;
76 76
77 delete m_serialiser; 77 delete m_serialiser;
78 m_serialiser = new Serialiser(id); 78 m_serialiser = new Serialiser(id);
79 } 79 }
80 80
90 void 90 void
91 CodedAudioFileReader::initialiseDecodeCache() 91 CodedAudioFileReader::initialiseDecodeCache()
92 { 92 {
93 QMutexLocker locker(&m_cacheMutex); 93 QMutexLocker locker(&m_cacheMutex);
94 94
95 // DEBUG << "CodedAudioFileReader::initialiseDecodeCache: file rate = " << m_fileRate << endl; 95 // SVDEBUG << "CodedAudioFileReader::initialiseDecodeCache: file rate = " << m_fileRate << endl;
96 96
97 if (m_fileRate == 0) { 97 if (m_fileRate == 0) {
98 DEBUG << "CodedAudioFileReader::initialiseDecodeCache: ERROR: File sample rate unknown (bug in subclass implementation?)" << endl; 98 SVDEBUG << "CodedAudioFileReader::initialiseDecodeCache: ERROR: File sample rate unknown (bug in subclass implementation?)" << endl;
99 m_fileRate = 48000; // got to have something 99 m_fileRate = 48000; // got to have something
100 } 100 }
101 if (m_sampleRate == 0) { 101 if (m_sampleRate == 0) {
102 m_sampleRate = m_fileRate; 102 m_sampleRate = m_fileRate;
103 DEBUG << "CodedAudioFileReader::initialiseDecodeCache: rate (from file) = " << m_fileRate << endl; 103 SVDEBUG << "CodedAudioFileReader::initialiseDecodeCache: rate (from file) = " << m_fileRate << endl;
104 } 104 }
105 if (m_fileRate != m_sampleRate) { 105 if (m_fileRate != m_sampleRate) {
106 std::cerr << "CodedAudioFileReader: resampling " << m_fileRate << " -> " << m_sampleRate << std::endl; 106 std::cerr << "CodedAudioFileReader: resampling " << m_fileRate << " -> " << m_sampleRate << std::endl;
107 m_resampler = new Resampler(Resampler::FastestTolerable, 107 m_resampler = new Resampler(Resampler::FastestTolerable,
108 m_channelCount, 108 m_channelCount,
352 // Lock is only required in CacheInMemory mode (the cache file 352 // Lock is only required in CacheInMemory mode (the cache file
353 // reader is expected to be thread safe and manage its own 353 // reader is expected to be thread safe and manage its own
354 // locking) 354 // locking)
355 355
356 if (!m_initialised) { 356 if (!m_initialised) {
357 DEBUG << "CodedAudioFileReader::getInterleavedFrames: not initialised" << endl; 357 SVDEBUG << "CodedAudioFileReader::getInterleavedFrames: not initialised" << endl;
358 return; 358 return;
359 } 359 }
360 360
361 switch (m_cacheMode) { 361 switch (m_cacheMode) {
362 362