comparison data/fileio/CodedAudioFileReader.cpp @ 665:029dd9e5cc29 coreaudio_tests

tests for using coreaudio to read files in 64-bit mac osx
author luisf
date Thu, 18 Nov 2010 11:40:38 +0000
parents 939ffbc32d50
children c10cb8782576
comparison
equal deleted inserted replaced
623:f19437971e17 665:029dd9e5cc29
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 // std::cerr << "CodedAudioFileReader::CodedAudioFileReader: rate " << targetRate << std::endl; 43 std::cerr << "CodedAudioFileReader::CodedAudioFileReader: rate " << targetRate << std::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 // std::cerr << "CodedAudioFileReader::~CodedAudioFileReader: deleting cache file reader" << std::endl; 57 std::cerr << "CodedAudioFileReader::~CodedAudioFileReader: deleting cache file reader" << std::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 // std::cerr << "CodedAudioFileReader::startSerialised(" << id.toStdString() << ")" << std::endl; 75 std::cerr << "CodedAudioFileReader::startSerialised(" << id.toStdString() << ")" << std::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
81 void 81 void
82 CodedAudioFileReader::endSerialised() 82 CodedAudioFileReader::endSerialised()
83 { 83 {
84 // std::cerr << "CodedAudioFileReader(" << this << ")::endSerialised: id = " << (m_serialiser ? m_serialiser->getId().toStdString() : "(none)") << std::endl; 84 std::cerr << "CodedAudioFileReader(" << this << ")::endSerialised: id = " << (m_serialiser ? m_serialiser->getId().toStdString() : "(none)") << std::endl;
85 85
86 delete m_serialiser; 86 delete m_serialiser;
87 m_serialiser = 0; 87 m_serialiser = 0;
88 } 88 }
89 89
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 // std::cerr << "CodedAudioFileReader::initialiseDecodeCache: file rate = " << m_fileRate << std::endl; 95 std::cerr << "CodedAudioFileReader::initialiseDecodeCache: file rate = " << m_fileRate << std::endl;
96 96
97 if (m_fileRate == 0) { 97 if (m_fileRate == 0) {
98 std::cerr << "CodedAudioFileReader::initialiseDecodeCache: ERROR: File sample rate unknown (bug in subclass implementation?)" << std::endl; 98 std::cerr << "CodedAudioFileReader::initialiseDecodeCache: ERROR: File sample rate unknown (bug in subclass implementation?)" << std::endl;
99 m_fileRate = 48000; // got to have something 99 m_fileRate = 48000; // got to have something
100 } 100 }