diff audioio/AudioPortAudioTarget.cpp @ 96:e177e6ee7c12 sv1-v1.2pre5

* PortAudio playback fixes
author Chris Cannam
date Wed, 13 Feb 2008 15:49:26 +0000
parents dd6d0bc05030
children ccdc5b30e54c
line wrap: on
line diff
--- 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;