# HG changeset patch # User Chris Cannam # Date 1279207559 0 # Node ID d9c21e7bff2155c85d3cd1a735f83f4d22f04170 # Parent 302dae1f601666bee2a6e0b423ae04e0a4e27cd3 * Some debug, turn off PulseAudio autospawn diff -r 302dae1f6016 -r d9c21e7bff21 audioio/AudioCallbackPlaySource.cpp --- a/audioio/AudioCallbackPlaySource.cpp Thu Jul 08 14:22:28 2010 +0000 +++ b/audioio/AudioCallbackPlaySource.cpp Thu Jul 15 15:25:59 2010 +0000 @@ -1456,10 +1456,12 @@ } else { // space must be a multiple of generatorBlockSize - space = (space / generatorBlockSize) * generatorBlockSize; + size_t reqSpace = space; + space = (reqSpace / generatorBlockSize) * generatorBlockSize; if (space == 0) { #ifdef DEBUG_AUDIO_PLAY_SOURCE - std::cout << "requested fill is less than generator block size of " + std::cout << "requested fill of " << reqSpace + << " is less than generator block size of " << generatorBlockSize << ", leaving it" << std::endl; #endif return false; diff -r 302dae1f6016 -r d9c21e7bff21 audioio/AudioPortAudioTarget.cpp --- a/audioio/AudioPortAudioTarget.cpp Thu Jul 08 14:22:28 2010 +0000 +++ b/audioio/AudioPortAudioTarget.cpp Thu Jul 15 15:25:59 2010 +0000 @@ -77,6 +77,7 @@ if (err != paNoError) { std::cerr << "ERROR: AudioPortAudioTarget: Failed to open PortAudio stream: " << Pa_GetErrorText(err) << std::endl; + std::cerr << "Note: device ID was " << op.device << std::endl; m_stream = 0; Pa_Terminate(); return; diff -r 302dae1f6016 -r d9c21e7bff21 audioio/AudioPulseAudioTarget.cpp --- a/audioio/AudioPulseAudioTarget.cpp Thu Jul 08 14:22:28 2010 +0000 +++ b/audioio/AudioPulseAudioTarget.cpp Thu Jul 15 15:25:59 2010 +0000 @@ -24,7 +24,8 @@ #include #include -//#define DEBUG_AUDIO_PULSE_AUDIO_TARGET 1 +#define DEBUG_AUDIO_PULSE_AUDIO_TARGET 1 +//#define DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY 1 AudioPulseAudioTarget::AudioPulseAudioTarget(AudioCallbackPlaySource *source) : AudioCallbackPlayTarget(source), @@ -62,6 +63,10 @@ m_spec.channels = 2; m_spec.format = PA_SAMPLE_FLOAT32NE; +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET + std::cerr << "AudioPulseAudioTarget: Creating context" << std::endl; +#endif + m_context = pa_context_new(m_api, source->getClientName().toLocal8Bit().data()); if (!m_context) { std::cerr << "ERROR: AudioPulseAudioTarget: Failed to create context object" << std::endl; @@ -70,7 +75,16 @@ pa_context_set_state_callback(m_context, contextStateChangedStatic, this); - pa_context_connect(m_context, 0, (pa_context_flags_t)0, 0); // default server +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET + std::cerr << "AudioPulseAudioTarget: Connecting to default server..." << std::endl; +#endif + + pa_context_connect(m_context, 0, // default server + (pa_context_flags_t)PA_CONTEXT_NOAUTOSPAWN, 0); + +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET + std::cerr << "AudioPulseAudioTarget: Starting main loop" << std::endl; +#endif m_loopThread = new MainLoopThread(m_loop); m_loopThread->start(); @@ -151,7 +165,7 @@ void AudioPulseAudioTarget::streamWrite(size_t requested) { -#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY std::cout << "AudioPulseAudioTarget::streamWrite(" << requested << ")" << std::endl; #endif if (m_done) return; @@ -181,7 +195,7 @@ std::cerr << "WARNING: AudioPulseAudioTarget::streamWrite: nframes " << nframes << " > m_bufferSize " << m_bufferSize << std::endl; } -#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY std::cout << "AudioPulseAudioTarget::streamWrite: nframes = " << nframes << std::endl; #endif @@ -211,7 +225,7 @@ size_t received = m_source->getSourceSamples(nframes, tmpbuf); -#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY std::cerr << "requested " << nframes << ", received " << received << std::endl; if (received < nframes) { @@ -260,7 +274,7 @@ if (ch > 0 || sourceChannels == 1) peakRight = peak; } -#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET +#ifdef DEBUG_AUDIO_PULSE_AUDIO_TARGET_PLAY std::cerr << "calling pa_stream_write with " << nframes * tmpbufch * sizeof(float) << " bytes" << std::endl; #endif