From 2ee9100a0992bbebe041fd71c5c33e794848e20f Mon Sep 17 00:00:00 2001
From: Stephen Sinclair <radarsat1@gmail.com>
Date: Tue, 19 Aug 2008 01:09:14 -0400
Subject: [PATCH] RtAudio workaround: don't use snd_pcm_link() on 64-bit platforms

Don't know why it causes problems, but it seems that snd_pcm_readn()
always returns -EPIPE when this is used, but without setting the XRUN
state.
---
 v2/rtaudio.cpp |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/v2/rtaudio.cpp b/v2/rtaudio.cpp
index 592b4c1..34c5569 100755
--- a/v2/rtaudio.cpp
+++ b/v2/rtaudio.cpp
@@ -4120,12 +4120,14 @@ bool RtApiAlsa :: probeDeviceOpen( int device, StreamMode mode, int channels,
     stream_.mode = DUPLEX;
     // Link the streams if possible.
     apiInfo->synchronized = false;
-    if (snd_pcm_link( apiInfo->handles[0], apiInfo->handles[1] ) == 0)
-      apiInfo->synchronized = true;
-    else {
-      sprintf(message_, "RtApiAlsa: unable to synchronize input and output streams (%s).",
-              devices_[device].name.c_str());
+    if (sizeof(long)==4){ // TODO: why snd_pcm_link causes problems on 64-bit?
+      if (snd_pcm_link( apiInfo->handles[0], apiInfo->handles[1] ) == 0)
+        apiInfo->synchronized = true;
+      else {
+        sprintf(message_, "RtApiAlsa: unable to synchronize input and output streams (%s).",
+                devices_[device].name.c_str());
       error(RtError::DEBUG_WARNING);
+      }
     }
   }
   else
-- 
1.5.6.GIT

