Mercurial > hg > svapp
comparison audioio/AudioPortAudioTarget.cpp @ 233:8aace2d9f1c2
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:27:12 +0100 |
parents | 8c13e8219903 |
children | a9f1850b873d 7f08a7e35b3c |
comparison
equal
deleted
inserted
replaced
232:025065fd5b49 | 233:8aace2d9f1c2 |
---|---|
111 #endif | 111 #endif |
112 } | 112 } |
113 | 113 |
114 AudioPortAudioTarget::~AudioPortAudioTarget() | 114 AudioPortAudioTarget::~AudioPortAudioTarget() |
115 { | 115 { |
116 DEBUG << "AudioPortAudioTarget::~AudioPortAudioTarget()" << endl; | 116 SVDEBUG << "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 DEBUG << "closing stream" << endl; | 126 SVDEBUG << "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 DEBUG << "AudioPortAudioTarget::~AudioPortAudioTarget() done" << endl; | 144 SVDEBUG << "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 DEBUG << "AudioPortAudioTarget::shutdown" << endl; | 151 SVDEBUG << "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 DEBUG << "AudioPortAudioTarget::process(" << nframes << ")" << endl; | 193 SVDEBUG << "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 DEBUG << "AudioPortAudioTarget::process: Doing nothing, no source or application done" << endl; | 198 SVDEBUG << "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, ¶m)) { | 207 if (pthread_setschedparam(pthread_self(), SCHED_RR, ¶m)) { |
208 DEBUG << "AudioPortAudioTarget: NOTE: couldn't set RT scheduling class" << endl; | 208 SVDEBUG << "AudioPortAudioTarget: NOTE: couldn't set RT scheduling class" << endl; |
209 } else { | 209 } else { |
210 DEBUG << "AudioPortAudioTarget: NOTE: successfully set RT scheduling class" << endl; | 210 SVDEBUG << "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 |