comparison audioio/AudioPortAudioTarget.cpp @ 229:8c13e8219903 debug-output

Convert many cerrs to DEBUGs
author Chris Cannam
date Mon, 16 May 2011 17:19:40 +0100
parents d9c21e7bff21
children 8aace2d9f1c2
comparison
equal deleted inserted replaced
228:67cea66bd588 229:8c13e8219903
111 #endif 111 #endif
112 } 112 }
113 113
114 AudioPortAudioTarget::~AudioPortAudioTarget() 114 AudioPortAudioTarget::~AudioPortAudioTarget()
115 { 115 {
116 std::cerr << "AudioPortAudioTarget::~AudioPortAudioTarget()" << std::endl; 116 DEBUG << "AudioPortAudioTarget::~AudioPortAudioTarget()" << endl;
117 117
118 if (m_source) { 118 if (m_source) {
119 m_source->setTarget(0, m_bufferSize); 119 m_source->setTarget(0, m_bufferSize);
120 } 120 }
121 121
122 shutdown(); 122 shutdown();
123 123
124 if (m_stream) { 124 if (m_stream) {
125 125
126 std::cerr << "closing stream" << std::endl; 126 DEBUG << "closing stream" << endl;
127 127
128 PaError err; 128 PaError err;
129 err = Pa_CloseStream(m_stream); 129 err = Pa_CloseStream(m_stream);
130 if (err != paNoError) { 130 if (err != paNoError) {
131 std::cerr << "ERROR: AudioPortAudioTarget: Failed to close PortAudio stream: " << Pa_GetErrorText(err) << std::endl; 131 std::cerr << "ERROR: AudioPortAudioTarget: Failed to close PortAudio stream: " << Pa_GetErrorText(err) << std::endl;
139 } 139 }
140 } 140 }
141 141
142 m_stream = 0; 142 m_stream = 0;
143 143
144 std::cerr << "AudioPortAudioTarget::~AudioPortAudioTarget() done" << std::endl; 144 DEBUG << "AudioPortAudioTarget::~AudioPortAudioTarget() done" << endl;
145 } 145 }
146 146
147 void 147 void
148 AudioPortAudioTarget::shutdown() 148 AudioPortAudioTarget::shutdown()
149 { 149 {
150 #ifdef DEBUG_PORT_AUDIO_TARGET 150 #ifdef DEBUG_PORT_AUDIO_TARGET
151 std::cerr << "AudioPortAudioTarget::shutdown" << std::endl; 151 DEBUG << "AudioPortAudioTarget::shutdown" << endl;
152 #endif 152 #endif
153 m_done = true; 153 m_done = true;
154 } 154 }
155 155
156 bool 156 bool
188 unsigned long nframes, 188 unsigned long nframes,
189 const PaStreamCallbackTimeInfo *, 189 const PaStreamCallbackTimeInfo *,
190 PaStreamCallbackFlags) 190 PaStreamCallbackFlags)
191 { 191 {
192 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET 192 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET
193 std::cerr << "AudioPortAudioTarget::process(" << nframes << ")" << std::endl; 193 DEBUG << "AudioPortAudioTarget::process(" << nframes << ")" << endl;
194 #endif 194 #endif
195 195
196 if (!m_source || m_done) { 196 if (!m_source || m_done) {
197 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET 197 #ifdef DEBUG_AUDIO_PORT_AUDIO_TARGET
198 std::cerr << "AudioPortAudioTarget::process: Doing nothing, no source or application done" << std::endl; 198 DEBUG << "AudioPortAudioTarget::process: Doing nothing, no source or application done" << endl;
199 #endif 199 #endif
200 return 0; 200 return 0;
201 } 201 }
202 202
203 if (!m_prioritySet) { 203 if (!m_prioritySet) {
204 #ifndef _WIN32 204 #ifndef _WIN32
205 sched_param param; 205 sched_param param;
206 param.sched_priority = 20; 206 param.sched_priority = 20;
207 if (pthread_setschedparam(pthread_self(), SCHED_RR, &param)) { 207 if (pthread_setschedparam(pthread_self(), SCHED_RR, &param)) {
208 std::cerr << "AudioPortAudioTarget: NOTE: couldn't set RT scheduling class" << std::endl; 208 DEBUG << "AudioPortAudioTarget: NOTE: couldn't set RT scheduling class" << endl;
209 } else { 209 } else {
210 std::cerr << "AudioPortAudioTarget: NOTE: successfully set RT scheduling class" << std::endl; 210 DEBUG << "AudioPortAudioTarget: NOTE: successfully set RT scheduling class" << endl;
211 } 211 }
212 #endif 212 #endif
213 m_prioritySet = true; 213 m_prioritySet = true;
214 } 214 }
215 215