Mercurial > hg > svapp
changeset 195:d9c21e7bff21
* Some debug, turn off PulseAudio autospawn
author | Chris Cannam |
---|---|
date | Thu, 15 Jul 2010 15:25:59 +0000 |
parents | 302dae1f6016 |
children | 944af6246560 |
files | audioio/AudioCallbackPlaySource.cpp audioio/AudioPortAudioTarget.cpp audioio/AudioPulseAudioTarget.cpp |
diffstat | 3 files changed, 25 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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;
--- 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 <cassert> #include <cmath> -//#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