changeset 96:e177e6ee7c12 sv1-v1.2pre5

* PortAudio playback fixes
author Chris Cannam
date Wed, 13 Feb 2008 15:49:26 +0000
parents dd6d0bc05030
children 9c5c1989d0f8
files audioio/AudioCallbackPlaySource.cpp audioio/AudioPortAudioTarget.cpp
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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();
         }
     }
--- 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;