comparison data/fileio/CodedAudioFileReader.cpp @ 747:523e97d0f6eb

Merge from branch "coreaudio_tests"
author Chris Cannam
date Mon, 03 Sep 2012 11:06:50 +0100
parents c10cb8782576
children 26636c46bcdf
comparison
equal deleted inserted replaced
746:f5aeda36d5bd 747:523e97d0f6eb
39 m_cacheWriteBufferIndex(0), 39 m_cacheWriteBufferIndex(0),
40 m_cacheWriteBufferSize(16384), 40 m_cacheWriteBufferSize(16384),
41 m_resampler(0), 41 m_resampler(0),
42 m_resampleBuffer(0) 42 m_resampleBuffer(0)
43 { 43 {
44 // SVDEBUG << "CodedAudioFileReader::CodedAudioFileReader: rate " << targetRate << endl; 44 SVDEBUG << "CodedAudioFileReader::CodedAudioFileReader: rate " << targetRate << endl;
45 45
46 m_frameCount = 0; 46 m_frameCount = 0;
47 m_sampleRate = targetRate; 47 m_sampleRate = targetRate;
48 } 48 }
49 49
53 53
54 endSerialised(); 54 endSerialised();
55 55
56 if (m_cacheFileWritePtr) sf_close(m_cacheFileWritePtr); 56 if (m_cacheFileWritePtr) sf_close(m_cacheFileWritePtr);
57 57
58 // SVDEBUG << "CodedAudioFileReader::~CodedAudioFileReader: deleting cache file reader" << endl; 58 SVDEBUG << "CodedAudioFileReader::~CodedAudioFileReader: deleting cache file reader" << endl;
59 59
60 delete m_cacheFileReader; 60 delete m_cacheFileReader;
61 delete[] m_cacheWriteBuffer; 61 delete[] m_cacheWriteBuffer;
62 62
63 if (m_cacheFileName != "") { 63 if (m_cacheFileName != "") {
71 } 71 }
72 72
73 void 73 void
74 CodedAudioFileReader::startSerialised(QString id) 74 CodedAudioFileReader::startSerialised(QString id)
75 { 75 {
76 // SVDEBUG << "CodedAudioFileReader::startSerialised(" << id << ")" << endl; 76 SVDEBUG << "CodedAudioFileReader::startSerialised(" << id << ")" << endl;
77 77
78 delete m_serialiser; 78 delete m_serialiser;
79 m_serialiser = new Serialiser(id); 79 m_serialiser = new Serialiser(id);
80 } 80 }
81 81
82 void 82 void
83 CodedAudioFileReader::endSerialised() 83 CodedAudioFileReader::endSerialised()
84 { 84 {
85 // std::cerr << "CodedAudioFileReader(" << this << ")::endSerialised: id = " << (m_serialiser ? m_serialiser->getId().toStdString() : "(none)") << std::endl; 85 std::cerr << "CodedAudioFileReader(" << this << ")::endSerialised: id = " << (m_serialiser ? m_serialiser->getId().toStdString() : "(none)") << std::endl;
86 86
87 delete m_serialiser; 87 delete m_serialiser;
88 m_serialiser = 0; 88 m_serialiser = 0;
89 } 89 }
90 90
91 void 91 void
92 CodedAudioFileReader::initialiseDecodeCache() 92 CodedAudioFileReader::initialiseDecodeCache()
93 { 93 {
94 QMutexLocker locker(&m_cacheMutex); 94 QMutexLocker locker(&m_cacheMutex);
95 95
96 // SVDEBUG << "CodedAudioFileReader::initialiseDecodeCache: file rate = " << m_fileRate << endl; 96 SVDEBUG << "CodedAudioFileReader::initialiseDecodeCache: file rate = " << m_fileRate << endl;
97 97
98 if (m_fileRate == 0) { 98 if (m_fileRate == 0) {
99 SVDEBUG << "CodedAudioFileReader::initialiseDecodeCache: ERROR: File sample rate unknown (bug in subclass implementation?)" << endl; 99 SVDEBUG << "CodedAudioFileReader::initialiseDecodeCache: ERROR: File sample rate unknown (bug in subclass implementation?)" << endl;
100 m_fileRate = 48000; // got to have something 100 m_fileRate = 48000; // got to have something
101 } 101 }