changeset 95:dd6d0bc05030

* If the "default frame count" PA stream fails, try one with an explicit frame count
author Chris Cannam
date Tue, 12 Feb 2008 14:48:00 +0000
parents 9cc9862333bd
children e177e6ee7c12
files audioio/AudioPortAudioTarget.cpp
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioPortAudioTarget.cpp	Mon Feb 11 17:08:59 2008 +0000
+++ b/audioio/AudioPortAudioTarget.cpp	Tue Feb 12 14:48:00 2008 +0000
@@ -74,6 +74,17 @@
                         paNoFlag, processStatic, this);
 #endif    
 
+#ifndef HAVE_PORTAUDIO_V18
+    if (err != paNoError) {
+
+        std::cerr << "WARNING: AudioPortAudioTarget: Failed to open PortAudio stream with default frames per buffer, trying again with fixed frames per buffer..." << std::endl;
+        
+        err = Pa_OpenStream(&m_stream, 0, &op, m_sampleRate,
+                            1024,
+                            paNoFlag, processStatic, this);
+    }
+#endif
+
     if (err != paNoError) {
 	std::cerr << "ERROR: AudioPortAudioTarget: Failed to open PortAudio stream: " << Pa_GetErrorText(err) << std::endl;
 	m_stream = 0;