From ac4bb571cb95b570e6d85f616173ead17d68c6c3 Mon Sep 17 00:00:00 2001 From: philburk Date: Sun, 2 Sep 2012 01:43:30 +0000 Subject: [PATCH] Modified to JPortAudio to support builds on Macintosh. --- .../java/c/src/com_portaudio_BlockingStream.h | 5 ++++ bindings/java/c/src/com_portaudio_PortAudio.h | 2 +- bindings/java/c/src/jpa_tools.c | 6 ++++- bindings/java/jportaudio.dox | 26 ++++++++++++++++++- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/bindings/java/c/src/com_portaudio_BlockingStream.h b/bindings/java/c/src/com_portaudio_BlockingStream.h index c42421c..b1621b4 100644 --- a/bindings/java/c/src/com_portaudio_BlockingStream.h +++ b/bindings/java/c/src/com_portaudio_BlockingStream.h @@ -1,5 +1,10 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ +#if defined(__APPLE__) +#include +#else #include +#endif + /* Header for class com_portaudio_BlockingStream */ #ifndef _Included_com_portaudio_BlockingStream diff --git a/bindings/java/c/src/com_portaudio_PortAudio.h b/bindings/java/c/src/com_portaudio_PortAudio.h index 67c13a0..cf565c8 100644 --- a/bindings/java/c/src/com_portaudio_PortAudio.h +++ b/bindings/java/c/src/com_portaudio_PortAudio.h @@ -1,5 +1,5 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ -#include +#include /* Header for class com_portaudio_PortAudio */ #ifndef _Included_com_portaudio_PortAudio diff --git a/bindings/java/c/src/jpa_tools.c b/bindings/java/c/src/jpa_tools.c index 9754470..e3f903a 100644 --- a/bindings/java/c/src/jpa_tools.c +++ b/bindings/java/c/src/jpa_tools.c @@ -178,8 +178,12 @@ jint jpa_ThrowError( JNIEnv *env, const char *message ) // Throw an exception on error. jint jpa_CheckError( JNIEnv *env, PaError err ) { - if( err < 0 ) + if( err == -1 ) { + return jpa_ThrowError( env, "-1, possibly no available default device" ); + } + else if( err < 0 ) + { if( err == paUnanticipatedHostError ) { const PaHostErrorInfo *hostErrorInfo = Pa_GetLastHostErrorInfo(); diff --git a/bindings/java/jportaudio.dox b/bindings/java/jportaudio.dox index d0f4639..4d88d2a 100644 --- a/bindings/java/jportaudio.dox +++ b/bindings/java/jportaudio.dox @@ -34,4 +34,28 @@ Place the following libraries where they can be found, typically in the same fol - jportaudio_x86.dll - jportaudio_x64.dll -*/ \ No newline at end of file +@section java_comp_max Building JPortAudio on Mac + +These are notes from building JPortAudio on a Mac with 10.6.8 and XCode 4. + +I created a target of type 'C' library. + +I added the regular PortAudio frameworks plus the JavaVM framework. + +I modified com_portaudio_PortAudio.h and com_portaudio_BlockingStream.h so that jni.h could found. + +@code +#if defined(__APPLE__) +#include +#else +#include +#endif +@endcode + +This is bad because those header files are autogenerated and will be overwritten. +We need a better solution for this. + +I had trouble finding the "libjportaudio.jnilib". So I added a Build Phase that copied the library to "/Users/phil/Library/Java/Extensions". + +On the Mac we can create a universal library for both 32 and 64-bit JVMs. So in the JAR file I will open "jportaudio" on Apple. ON WIndows I will continue to open "jportaudio_x64" and "jportaudio_x86". +*/ -- 2.43.0