# HG changeset patch # User Chris Cannam # Date 1202917766 0 # Node ID e177e6ee7c12d493a514c8d25e95caa4422c2c22 # Parent dd6d0bc05030b9c86092f4eca30037c02ddbe5e1 * PortAudio playback fixes diff -r dd6d0bc05030 -r e177e6ee7c12 audioio/AudioCallbackPlaySource.cpp --- a/audioio/AudioCallbackPlaySource.cpp Tue Feb 12 14:48:00 2008 +0000 +++ b/audioio/AudioCallbackPlaySource.cpp Wed Feb 13 15:49:26 2008 +0000 @@ -709,6 +709,7 @@ if (!looping) { if (inRange == m_rangeStarts.size()-1 && playing_t >= m_rangeStarts[inRange] + m_rangeDurations[inRange]) { +std::cerr << "Not looping, inRange " << inRange << " == rangeStarts.size()-1, playing_t " << playing_t << " >= m_rangeStarts[inRange] " << m_rangeStarts[inRange] << " + m_rangeDurations[inRange] " << m_rangeDurations[inRange] << " -- stopping" << std::endl; stop(); } } diff -r dd6d0bc05030 -r e177e6ee7c12 audioio/AudioPortAudioTarget.cpp --- a/audioio/AudioPortAudioTarget.cpp Tue Feb 12 14:48:00 2008 +0000 +++ b/audioio/AudioPortAudioTarget.cpp Wed Feb 13 15:49:26 2008 +0000 @@ -64,7 +64,7 @@ processStatic, this); #else PaStreamParameters op; - op.device = 0; + op.device = Pa_GetDefaultOutputDevice(); op.channelCount = 2; op.sampleFormat = paFloat32; op.suggestedLatency = 0.2; @@ -82,6 +82,7 @@ err = Pa_OpenStream(&m_stream, 0, &op, m_sampleRate, 1024, paNoFlag, processStatic, this); + m_bufferSize = 1024; } #endif @@ -95,7 +96,7 @@ #ifndef HAVE_PORTAUDIO_V18 const PaStreamInfo *info = Pa_GetStreamInfo(m_stream); m_latency = int(info->outputLatency * m_sampleRate + 0.001); - m_bufferSize = m_latency; + if (m_bufferSize < m_latency) m_bufferSize = m_latency; #endif std::cerr << "PortAudio latency = " << m_latency << " frames" << std::endl;