/[pcsx2_0.9.7]/trunk/3rdparty/portaudio/src/hostapi/jack/pa_jack.c
ViewVC logotype

Diff of /trunk/3rdparty/portaudio/src/hostapi/jack/pa_jack.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/3rdparty/portaudio/src/hostapi/jack/pa_jack.c	2010/11/12 00:35:47	272
+++ trunk/3rdparty/portaudio/src/hostapi/jack/pa_jack.c	2010/11/12 01:10:22	273
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_jack.c 1346 2008-02-20 10:09:20Z rossb $
+ * $Id: pa_jack.c 1541 2010-09-22 06:33:47Z dmitrykos $
  * PortAudio Portable Real-Time Audio Library
  * Latest Version at: http://www.portaudio.com
  * JACK Implementation by Joshua Haberman
@@ -71,8 +71,6 @@
 #include "pa_ringbuffer.h"
 #include "pa_debugprint.h"
 
-static int aErr_;
-static PaError paErr_;     /* For use with ENSURE_PA */
 static pthread_t mainThread_;
 static char *jackErr_ = NULL;
 static const char* clientName_ = "PortAudio";
@@ -83,15 +81,17 @@
 /* Check PaError */
 #define ENSURE_PA(expr) \
     do { \
-        if( (paErr_ = (expr)) < paNoError ) \
+        PaError paErr; \
+        if( (paErr = (expr)) < paNoError ) \
         { \
-            if( (paErr_) == paUnanticipatedHostError && pthread_self() == mainThread_ ) \
+            if( (paErr) == paUnanticipatedHostError && pthread_self() == mainThread_ ) \
             { \
-                if (! jackErr_ ) jackErr_ = "unknown error";\
-                PaUtil_SetLastHostErrorInfo( paJACK, -1, jackErr_ ); \
+                const char *err = jackErr_; \
+                if (! err ) err = "unknown error"; \
+                PaUtil_SetLastHostErrorInfo( paJACK, -1, err ); \
             } \
             PaUtil_DebugPrint(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
-            result = paErr_; \
+            result = paErr; \
             goto error; \
         } \
     } while( 0 )
@@ -102,8 +102,9 @@
         { \
             if( (code) == paUnanticipatedHostError && pthread_self() == mainThread_ ) \
             { \
-                if (!jackErr_) jackErr_ = "unknown error";\
-                PaUtil_SetLastHostErrorInfo( paJACK, -1, jackErr_ ); \
+                const char *err = jackErr_; \
+                if (!err) err = "unknown error"; \
+                PaUtil_SetLastHostErrorInfo( paJACK, -1, err ); \
             } \
             PaUtil_DebugPrint(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
             result = (code); \
@@ -112,8 +113,10 @@
     } while( 0 )
 
 #define ASSERT_CALL(expr, success) \
-    aErr_ = (expr); \
-    assert( aErr_ == success );
+    do { \
+        int err = (expr); \
+        assert( err == success ); \
+    } while( 0 )
 
 /*
  * Functions that directly map to the PortAudio stream interface
@@ -826,6 +829,7 @@
     PaUtil_FreeMemory( jackHostApi );
 
     free( jackErr_ );
+    jackErr_ = NULL;
 }
 
 static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
@@ -1000,7 +1004,7 @@
     PaTime pt = PaUtil_GetTime();
     struct timespec ts;
 
-    ts.tv_sec = (time_t) floor( pt + 1 );
+    ts.tv_sec = (time_t) floor( pt + 10 * 60 /* 10 minutes */ );
     ts.tv_nsec = (long) ((pt - floor( pt )) * 1000000000);
     /* XXX: Best enclose in loop, in case of spurious wakeups? */
     err = pthread_cond_timedwait( &hostApi->cond, &hostApi->mtx, &ts );
@@ -1177,7 +1181,7 @@
             minimum_buffer_frames = jackHostApi->jack_buffer_size * 3;
 
         /* setup blocking API data structures (FIXME: can fail) */
-	BlockingBegin( stream, minimum_buffer_frames );
+        BlockingBegin( stream, minimum_buffer_frames );
 
         /* install our own callback for the blocking API */
         streamCallback = BlockingCallback;
@@ -1276,10 +1280,10 @@
                   &stream->bufferProcessor,
                   inputChannelCount,
                   inputSampleFormat,
-                  paFloat32,            /* hostInputSampleFormat */
+                  paFloat32 | paNonInterleaved, /* hostInputSampleFormat */
                   outputChannelCount,
                   outputSampleFormat,
-                  paFloat32,            /* hostOutputSampleFormat */
+                  paFloat32 | paNonInterleaved, /* hostOutputSampleFormat */
                   jackSr,
                   streamFlags,
                   framesPerBuffer,

 

  ViewVC Help
Powered by ViewVC 1.1.22