summaryrefslogtreecommitdiff
path: root/3rdparty/portaudio/bindings/java/c/src
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/portaudio/bindings/java/c/src')
-rw-r--r--3rdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.c352
-rw-r--r--3rdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.h130
-rw-r--r--3rdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.c279
-rw-r--r--3rdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.h183
-rw-r--r--3rdparty/portaudio/bindings/java/c/src/jpa_tools.c208
-rw-r--r--3rdparty/portaudio/bindings/java/c/src/jpa_tools.h62
6 files changed, 1214 insertions, 0 deletions
diff --git a/3rdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.c b/3rdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.c
new file mode 100644
index 0000000..64d8213
--- /dev/null
+++ b/3rdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.c
@@ -0,0 +1,352 @@
+/*
+ * Portable Audio I/O Library
+ * Java Binding for PortAudio
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * Copyright (c) 2008 Ross Bencina
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+#include "com_portaudio_BlockingStream.h"
+#include "portaudio.h"
+#include "jpa_tools.h"
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+#ifndef TRUE
+#define TRUE (!FALSE)
+#endif
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: getReadAvailable
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getReadAvailable
+ (JNIEnv *env, jobject blockingStream)
+{
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( stream == NULL ) return 0;
+ return Pa_GetStreamReadAvailable( stream );
+}
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: getWriteAvailable
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getWriteAvailable
+ (JNIEnv *env, jobject blockingStream)
+{
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( stream == NULL ) return 0;
+ return Pa_GetStreamWriteAvailable( stream );
+}
+
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: writeFloats
+ * Signature: ([FI)Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeFloats
+ (JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames)
+{
+ jfloat *carr;
+ jint err;
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( buffer == NULL )
+ {
+ (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
+ "null stream buffer");
+ return FALSE;
+ }
+ carr = (*env)->GetFloatArrayElements(env, buffer, NULL);
+ if (carr == NULL)
+ {
+ (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
+ "invalid stream buffer");
+ return FALSE;
+ }
+ err = Pa_WriteStream( stream, carr, numFrames );
+ (*env)->ReleaseFloatArrayElements(env, buffer, carr, 0);
+ if( err == paOutputUnderflowed )
+ {
+ return TRUE;
+ }
+ else
+ {
+ jpa_CheckError( env, err );
+ return FALSE;
+ }
+}
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: readFloats
+ * Signature: ([FI)Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readFloats
+ (JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames)
+{
+ jfloat *carr;
+ jint err;
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( buffer == NULL )
+ {
+ (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
+ "null stream buffer");
+ return FALSE;
+ }
+ carr = (*env)->GetFloatArrayElements(env, buffer, NULL);
+ if (carr == NULL)
+ {
+ (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
+ "invalid stream buffer");
+ return FALSE;
+ }
+ err = Pa_ReadStream( stream, carr, numFrames );
+ (*env)->ReleaseFloatArrayElements(env, buffer, carr, 0);
+ if( err == paInputOverflowed )
+ {
+ return TRUE;
+ }
+ else
+ {
+ jpa_CheckError( env, err );
+ return FALSE;
+ }
+}
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: writeShorts
+ * Signature: ([SI)Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeShorts
+ (JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames)
+{
+ jshort *carr;
+ jint err;
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( buffer == NULL )
+ {
+ (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
+ "null stream buffer");
+ return FALSE;
+ }
+ carr = (*env)->GetShortArrayElements(env, buffer, NULL);
+ if (carr == NULL)
+ {
+ (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
+ "invalid stream buffer");
+ return FALSE;
+ }
+ err = Pa_WriteStream( stream, carr, numFrames );
+ (*env)->ReleaseShortArrayElements(env, buffer, carr, 0);
+ if( err == paOutputUnderflowed )
+ {
+ return TRUE;
+ }
+ else
+ {
+ jpa_CheckError( env, err );
+ return FALSE;
+ }
+}
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: readShorts
+ * Signature: ([SI)Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readShorts
+ (JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames)
+{
+ jshort *carr;
+ jint err;
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( buffer == NULL )
+ {
+ (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
+ "null stream buffer");
+ return FALSE;
+ }
+ carr = (*env)->GetShortArrayElements(env, buffer, NULL);
+ if (carr == NULL)
+ {
+ (*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
+ "invalid stream buffer");
+ return FALSE;
+ }
+ err = Pa_ReadStream( stream, carr, numFrames );
+ (*env)->ReleaseShortArrayElements(env, buffer, carr, 0);
+ if( err == paInputOverflowed )
+ {
+ return TRUE;
+ }
+ else
+ {
+ jpa_CheckError( env, err );
+ return FALSE;
+ }
+}
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: start
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_start
+ (JNIEnv *env, jobject blockingStream )
+{
+ PaStream *stream = jpa_GetStreamPointer( env, blockingStream );
+ int err = Pa_StartStream( stream );
+ jpa_CheckError( env, err );
+}
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: stop
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_stop
+ (JNIEnv *env, jobject blockingStream )
+{
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ int err = Pa_StopStream( stream );
+ jpa_CheckError( env, err );
+}
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: abort
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_abort
+ (JNIEnv *env, jobject blockingStream )
+{
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ int err = Pa_AbortStream( stream );
+ jpa_CheckError( env, err );
+}
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: close
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_close
+ (JNIEnv *env, jobject blockingStream )
+{
+ jclass cls;
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( stream != NULL )
+ {
+ int err = Pa_CloseStream( stream );
+ jpa_CheckError( env, err );
+ cls = (*env)->GetObjectClass(env, blockingStream);
+ jpa_SetLongField( env, cls, blockingStream, "nativeStream", (jlong) 0 );
+ }
+}
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: isStopped
+ * Signature: ()V
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isStopped
+ (JNIEnv *env, jobject blockingStream )
+{
+ int err;
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( stream == NULL ) return 1;
+ err = Pa_IsStreamStopped( stream );
+ return (jpa_CheckError( env, err ) > 0);
+}
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: isActive
+ * Signature: ()V
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isActive
+ (JNIEnv *env, jobject blockingStream )
+{
+ int err;
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( stream == NULL ) return 0;
+ err = Pa_IsStreamActive( stream );
+ return (jpa_CheckError( env, err ) > 0);
+}
+
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: getTime
+ * Signature: ()D
+ */
+JNIEXPORT jdouble JNICALL Java_com_portaudio_BlockingStream_getTime
+ (JNIEnv *env, jobject blockingStream )
+{
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ if( stream == NULL ) return 0.0;
+ return Pa_GetStreamTime( stream );
+}
+
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: getInfo
+ * Signature: ()Lcom/portaudio/StreamInfo;
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_getInfo
+ (JNIEnv *env, jobject blockingStream, jobject streamInfo)
+{
+
+ PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
+ const PaStreamInfo *info = Pa_GetStreamInfo( stream );
+ if( streamInfo == NULL )
+ {
+ jpa_ThrowError( env, "Invalid stream." );
+ }
+ else
+ {
+ /* Get a reference to obj's class */
+ jclass cls = (*env)->GetObjectClass(env, streamInfo);
+
+ jpa_SetIntField( env, cls, streamInfo, "structVersion", info->structVersion );
+ jpa_SetDoubleField( env, cls, streamInfo, "inputLatency", info->inputLatency );
+ jpa_SetDoubleField( env, cls, streamInfo, "outputLatency", info->outputLatency );
+ jpa_SetDoubleField( env, cls, streamInfo, "sampleRate", info->sampleRate );
+ }
+}
+
diff --git a/3rdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.h b/3rdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.h
new file mode 100644
index 0000000..e405fae
--- /dev/null
+++ b/3rdparty/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.h
@@ -0,0 +1,130 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#if defined(__APPLE__)
+#include <JavaVM/jni.h>
+#else
+#include <jni.h>
+#endif
+
+/* Header for class com_portaudio_BlockingStream */
+
+#ifndef _Included_com_portaudio_BlockingStream
+#define _Included_com_portaudio_BlockingStream
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: getReadAvailable
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getReadAvailable
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: getWriteAvailable
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getWriteAvailable
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: readFloats
+ * Signature: ([FI)Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readFloats
+ (JNIEnv *, jobject, jfloatArray, jint);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: writeFloats
+ * Signature: ([FI)Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeFloats
+ (JNIEnv *, jobject, jfloatArray, jint);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: readShorts
+ * Signature: ([SI)Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readShorts
+ (JNIEnv *, jobject, jshortArray, jint);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: writeShorts
+ * Signature: ([SI)Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeShorts
+ (JNIEnv *, jobject, jshortArray, jint);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: start
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_start
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: stop
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_stop
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: abort
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_abort
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: close
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_close
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: isStopped
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isStopped
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: isActive
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isActive
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: getTime
+ * Signature: ()D
+ */
+JNIEXPORT jdouble JNICALL Java_com_portaudio_BlockingStream_getTime
+ (JNIEnv *, jobject);
+
+/*
+ * Class: com_portaudio_BlockingStream
+ * Method: getInfo
+ * Signature: (Lcom/portaudio/StreamInfo;)V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_getInfo
+ (JNIEnv *, jobject, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/3rdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.c b/3rdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.c
new file mode 100644
index 0000000..77c42eb
--- /dev/null
+++ b/3rdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.c
@@ -0,0 +1,279 @@
+/*
+ * Portable Audio I/O Library
+ * Java Binding for PortAudio
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * Copyright (c) 2008 Ross Bencina
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+#include "com_portaudio_PortAudio.h"
+#include "portaudio.h"
+#include "jpa_tools.h"
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getVersion
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getVersion
+ (JNIEnv *env, jclass clazz)
+{
+ return Pa_GetVersion();
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getVersionText
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_portaudio_PortAudio_getVersionText
+ (JNIEnv *env, jclass clazz)
+{
+ return (*env)->NewStringUTF(env, Pa_GetVersionText() );
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: initialize
+ * Signature: ()I
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_initialize
+ (JNIEnv *env, jclass clazz)
+{
+ PaError err = Pa_Initialize();
+ jpa_CheckError( env, err );
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: terminate
+ * Signature: ()I
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_terminate
+ (JNIEnv *env, jclass clazz)
+{
+ PaError err = Pa_Terminate();
+ jpa_CheckError( env, err );
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDeviceCount
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDeviceCount
+ (JNIEnv *env, jclass clazz)
+{
+ jint count = Pa_GetDeviceCount();
+ return jpa_CheckError( env, count );
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDeviceInfo
+ * Signature: (ILcom/portaudio/DeviceInfo;)I
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_getDeviceInfo
+ (JNIEnv *env, jclass clazz, jint index, jobject deviceInfo)
+{
+ const PaDeviceInfo *info;
+ /* Get a reference to obj's class */
+ jclass cls = (*env)->GetObjectClass(env, deviceInfo);
+
+ info = Pa_GetDeviceInfo( index );
+ if( info == NULL )
+ {
+ jpa_ThrowError( env, "Pa_GetDeviceInfo returned NULL." );
+ }
+ else
+ {
+ jpa_SetStringField( env, cls, deviceInfo, "name", info->name );
+ jpa_SetIntField( env, cls, deviceInfo, "maxInputChannels", info->maxInputChannels );
+ jpa_SetIntField( env, cls, deviceInfo, "maxOutputChannels", info->maxOutputChannels );
+ jpa_SetIntField( env, cls, deviceInfo, "hostApi", info->hostApi );
+ jpa_SetDoubleField( env, cls, deviceInfo, "defaultSampleRate", info->defaultSampleRate );
+ jpa_SetDoubleField( env, cls, deviceInfo, "defaultLowInputLatency", info->defaultLowInputLatency );
+ jpa_SetDoubleField( env, cls, deviceInfo, "defaultLowInputLatency", info->defaultHighInputLatency );
+ jpa_SetDoubleField( env, cls, deviceInfo, "defaultLowOutputLatency", info->defaultLowOutputLatency );
+ jpa_SetDoubleField( env, cls, deviceInfo, "defaultHighOutputLatency", info->defaultHighOutputLatency );
+ }
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: geHostApiCount
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getHostApiCount
+ (JNIEnv *env, jclass clazz)
+{
+ jint count = Pa_GetHostApiCount();
+ return jpa_CheckError( env, count );
+}
+
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: hostApiTypeIdToHostApiIndex
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_hostApiTypeIdToHostApiIndex
+ (JNIEnv *env, jclass clazz, jint hostApiType)
+{
+ return Pa_HostApiTypeIdToHostApiIndex( (PaHostApiTypeId) hostApiType );
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: hostApiDeviceIndexToDeviceIndex
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_hostApiDeviceIndexToDeviceIndex
+ (JNIEnv *env, jclass clazz, jint hostApiIndex, jint apiDeviceIndex)
+{
+ return Pa_HostApiDeviceIndexToDeviceIndex( hostApiIndex, apiDeviceIndex );
+}
+
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getHostApiInfo
+ * Signature: (ILcom/portaudio/HostApiInfo;)I
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_getHostApiInfo
+ (JNIEnv *env, jclass clazz, jint index, jobject hostApiInfo)
+{
+ const PaHostApiInfo *info;
+ /* Get a reference to obj's class */
+ jclass cls = (*env)->GetObjectClass(env, hostApiInfo);
+
+ info = Pa_GetHostApiInfo( index );
+ if( info == NULL )
+ {
+ jpa_ThrowError( env, "Pa_GetHostApiInfo returned NULL." );
+ }
+ else
+ {
+ jpa_SetIntField( env, cls, hostApiInfo, "version", info->structVersion );
+ jpa_SetIntField( env, cls, hostApiInfo, "type", info->type );
+ jpa_SetStringField( env, cls, hostApiInfo, "name", info->name );
+ jpa_SetIntField( env, cls, hostApiInfo, "deviceCount", info->deviceCount );
+ jpa_SetIntField( env, cls, hostApiInfo, "defaultInputDevice", info->defaultInputDevice );
+ jpa_SetIntField( env, cls, hostApiInfo, "defaultOutputDevice", info->defaultOutputDevice );
+ }
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDefaultInputDevice
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultInputDevice
+ (JNIEnv *env, jclass clazz)
+{
+ jint deviceId = Pa_GetDefaultInputDevice();
+ return jpa_CheckError( env, deviceId );
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDefaultOutputDevice
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultOutputDevice
+ (JNIEnv *env, jclass clazz)
+{
+ jint deviceId = Pa_GetDefaultOutputDevice();
+ return jpa_CheckError( env, deviceId );
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDefaultHostApi
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultHostApi
+ (JNIEnv *env, jclass clazz)
+{
+ jint deviceId = Pa_GetDefaultHostApi();
+ return jpa_CheckError( env, deviceId );
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: isFormatSupported
+ * Signature: (Lcom/portaudio/StreamParameters;Lcom/portaudio/StreamParameters;I)I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_isFormatSupported
+ (JNIEnv *env, jclass clazz, jobject inParams, jobject outParams, jint sampleRate )
+{
+ PaStreamParameters myInParams, *paInParams;
+ PaStreamParameters myOutParams, *paOutParams;
+
+ paInParams = jpa_FillStreamParameters( env, inParams, &myInParams );
+ paOutParams = jpa_FillStreamParameters( env, outParams, &myOutParams );
+
+ return Pa_IsFormatSupported( paInParams, paOutParams, sampleRate );
+
+}
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: openStream
+ * Signature: (Lcom/portaudio/BlockingStream;Lcom/portaudio/StreamParameters;Lcom/portaudio/StreamParameters;III)I
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_openStream
+ (JNIEnv *env, jclass clazz, jobject blockingStream, jobject inParams, jobject outParams, jint sampleRate, jint framesPerBuffer, jint flags )
+{
+ int err;
+ PaStreamParameters myInParams, *paInParams;
+ PaStreamParameters myOutParams, *paOutParams;
+ PaStream *stream;
+
+ paInParams = jpa_FillStreamParameters( env, inParams, &myInParams );
+ paOutParams = jpa_FillStreamParameters( env, outParams, &myOutParams );
+ err = Pa_OpenStream( &stream, paInParams, paOutParams, sampleRate, framesPerBuffer, flags, NULL, NULL );
+ if( jpa_CheckError( env, err ) == 0 )
+ {
+ jclass cls = (*env)->GetObjectClass(env, blockingStream);
+ jpa_SetLongField( env, cls, blockingStream, "nativeStream", (jlong) stream );
+ if( paInParams != NULL )
+ {
+ jpa_SetIntField( env, cls, blockingStream, "inputFormat", paInParams->sampleFormat );
+ }
+ if( paOutParams != NULL )
+ {
+ jpa_SetIntField( env, cls, blockingStream, "outputFormat", paOutParams->sampleFormat );
+ }
+ }
+}
diff --git a/3rdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.h b/3rdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.h
new file mode 100644
index 0000000..ed806ac
--- /dev/null
+++ b/3rdparty/portaudio/bindings/java/c/src/com_portaudio_PortAudio.h
@@ -0,0 +1,183 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#if defined(__APPLE__)
+#include <JavaVM/jni.h>
+#else
+#include <jni.h>
+#endif
+/* Header for class com_portaudio_PortAudio */
+
+#ifndef _Included_com_portaudio_PortAudio
+#define _Included_com_portaudio_PortAudio
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef com_portaudio_PortAudio_FLAG_CLIP_OFF
+#define com_portaudio_PortAudio_FLAG_CLIP_OFF 1L
+#undef com_portaudio_PortAudio_FLAG_DITHER_OFF
+#define com_portaudio_PortAudio_FLAG_DITHER_OFF 2L
+#undef com_portaudio_PortAudio_FORMAT_FLOAT_32
+#define com_portaudio_PortAudio_FORMAT_FLOAT_32 1L
+#undef com_portaudio_PortAudio_FORMAT_INT_32
+#define com_portaudio_PortAudio_FORMAT_INT_32 2L
+#undef com_portaudio_PortAudio_FORMAT_INT_24
+#define com_portaudio_PortAudio_FORMAT_INT_24 4L
+#undef com_portaudio_PortAudio_FORMAT_INT_16
+#define com_portaudio_PortAudio_FORMAT_INT_16 8L
+#undef com_portaudio_PortAudio_FORMAT_INT_8
+#define com_portaudio_PortAudio_FORMAT_INT_8 16L
+#undef com_portaudio_PortAudio_FORMAT_UINT_8
+#define com_portaudio_PortAudio_FORMAT_UINT_8 32L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_DEV
+#define com_portaudio_PortAudio_HOST_API_TYPE_DEV 0L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_DIRECTSOUND
+#define com_portaudio_PortAudio_HOST_API_TYPE_DIRECTSOUND 1L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_MME
+#define com_portaudio_PortAudio_HOST_API_TYPE_MME 2L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_ASIO
+#define com_portaudio_PortAudio_HOST_API_TYPE_ASIO 3L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_SOUNDMANAGER
+#define com_portaudio_PortAudio_HOST_API_TYPE_SOUNDMANAGER 4L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_COREAUDIO
+#define com_portaudio_PortAudio_HOST_API_TYPE_COREAUDIO 5L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_OSS
+#define com_portaudio_PortAudio_HOST_API_TYPE_OSS 7L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_ALSA
+#define com_portaudio_PortAudio_HOST_API_TYPE_ALSA 8L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_AL
+#define com_portaudio_PortAudio_HOST_API_TYPE_AL 9L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_BEOS
+#define com_portaudio_PortAudio_HOST_API_TYPE_BEOS 10L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_WDMKS
+#define com_portaudio_PortAudio_HOST_API_TYPE_WDMKS 11L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_JACK
+#define com_portaudio_PortAudio_HOST_API_TYPE_JACK 12L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_WASAPI
+#define com_portaudio_PortAudio_HOST_API_TYPE_WASAPI 13L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_AUDIOSCIENCE
+#define com_portaudio_PortAudio_HOST_API_TYPE_AUDIOSCIENCE 14L
+#undef com_portaudio_PortAudio_HOST_API_TYPE_COUNT
+#define com_portaudio_PortAudio_HOST_API_TYPE_COUNT 15L
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getVersion
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getVersion
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getVersionText
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_portaudio_PortAudio_getVersionText
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: initialize
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_initialize
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: terminate
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_terminate
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDeviceCount
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDeviceCount
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDeviceInfo
+ * Signature: (ILcom/portaudio/DeviceInfo;)V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_getDeviceInfo
+ (JNIEnv *, jclass, jint, jobject);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getHostApiCount
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getHostApiCount
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getHostApiInfo
+ * Signature: (ILcom/portaudio/HostApiInfo;)V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_getHostApiInfo
+ (JNIEnv *, jclass, jint, jobject);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: hostApiTypeIdToHostApiIndex
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_hostApiTypeIdToHostApiIndex
+ (JNIEnv *, jclass, jint);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: hostApiDeviceIndexToDeviceIndex
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_hostApiDeviceIndexToDeviceIndex
+ (JNIEnv *, jclass, jint, jint);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDefaultInputDevice
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultInputDevice
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDefaultOutputDevice
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultOutputDevice
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: getDefaultHostApi
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_getDefaultHostApi
+ (JNIEnv *, jclass);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: isFormatSupported
+ * Signature: (Lcom/portaudio/StreamParameters;Lcom/portaudio/StreamParameters;I)I
+ */
+JNIEXPORT jint JNICALL Java_com_portaudio_PortAudio_isFormatSupported
+ (JNIEnv *, jclass, jobject, jobject, jint);
+
+/*
+ * Class: com_portaudio_PortAudio
+ * Method: openStream
+ * Signature: (Lcom/portaudio/BlockingStream;Lcom/portaudio/StreamParameters;Lcom/portaudio/StreamParameters;III)V
+ */
+JNIEXPORT void JNICALL Java_com_portaudio_PortAudio_openStream
+ (JNIEnv *, jclass, jobject, jobject, jobject, jint, jint, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/3rdparty/portaudio/bindings/java/c/src/jpa_tools.c b/3rdparty/portaudio/bindings/java/c/src/jpa_tools.c
new file mode 100644
index 0000000..e3f903a
--- /dev/null
+++ b/3rdparty/portaudio/bindings/java/c/src/jpa_tools.c
@@ -0,0 +1,208 @@
+/*
+ * Portable Audio I/O Library
+ * Java Binding for PortAudio
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * Copyright (c) 2008 Ross Bencina
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+#include "com_portaudio_PortAudio.h"
+#include "portaudio.h"
+#include "jpa_tools.h"
+
+jint jpa_GetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName )
+{
+ /* Look for the instance field maxInputChannels in cls */
+ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "I");
+ if (fid == NULL)
+ {
+ jpa_ThrowError( env, "Cannot find integer JNI field." );
+ return 0;
+ }
+ else
+ {
+ return (*env)->GetIntField(env, obj, fid );
+ }
+}
+
+void jpa_SetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jint value )
+{
+ /* Look for the instance field maxInputChannels in cls */
+ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "I");
+ if (fid == NULL)
+ {
+ jpa_ThrowError( env, "Cannot find integer JNI field." );
+ }
+ else
+ {
+ (*env)->SetIntField(env, obj, fid, value );
+ }
+}
+
+jlong jpa_GetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName )
+{
+ /* Look for the instance field maxInputChannels in cls */
+ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "J");
+ if (fid == NULL)
+ {
+ jpa_ThrowError( env, "Cannot find long JNI field." );
+ return 0L;
+ }
+ else
+ {
+ return (*env)->GetLongField(env, obj, fid );
+ }
+}
+
+void jpa_SetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jlong value )
+{
+ /* Look for the instance field maxInputChannels in cls */
+ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "J");
+ if (fid == NULL)
+ {
+ jpa_ThrowError( env, "Cannot find long JNI field." );
+ }
+ else
+ {
+ (*env)->SetLongField(env, obj, fid, value );
+ }
+}
+
+
+void jpa_SetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jdouble value )
+{
+ /* Look for the instance field maxInputChannels in cls */
+ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "D");
+ if (fid == NULL)
+ {
+ jpa_ThrowError( env, "Cannot find double JNI field." );
+ }
+ else
+ {
+ (*env)->SetDoubleField(env, obj, fid, value );
+ }
+}
+
+
+jdouble jpa_GetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName )
+{
+ /* Look for the instance field maxInputChannels in cls */
+ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "D");
+ if (fid == NULL)
+ {
+ jpa_ThrowError( env, "Cannot find double JNI field." );
+ return 0;
+ }
+ else
+ {
+ return (*env)->GetDoubleField(env, obj, fid );
+ }
+}
+
+void jpa_SetStringField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, const char *value )
+{
+ /* Look for the instance field maxInputChannels in cls */
+ jfieldID fid = (*env)->GetFieldID(env, cls, fieldName, "Ljava/lang/String;");
+ if (fid == NULL)
+ {
+ jpa_ThrowError( env, "Cannot find String JNI field." );
+ }
+ else
+ {
+ jstring jstr = (*env)->NewStringUTF(env, value);
+ if (jstr == NULL)
+ {
+ jpa_ThrowError( env, "Cannot create new String." );
+ }
+ else
+ {
+ (*env)->SetObjectField(env, obj, fid, jstr );
+ }
+ }
+}
+
+PaStreamParameters *jpa_FillStreamParameters( JNIEnv *env, jobject jstreamParam, PaStreamParameters *myParams )
+{
+ jclass cls;
+
+ if( jstreamParam == NULL ) return NULL; // OK, not an error
+
+ cls = (*env)->GetObjectClass(env, jstreamParam);
+
+ myParams->channelCount = jpa_GetIntField( env, cls, jstreamParam, "channelCount" );
+ myParams->device = jpa_GetIntField( env, cls, jstreamParam, "device" );
+ myParams->sampleFormat = jpa_GetIntField( env, cls, jstreamParam, "sampleFormat" );
+ myParams->suggestedLatency = jpa_GetDoubleField( env, cls, jstreamParam, "suggestedLatency" );
+ myParams->hostApiSpecificStreamInfo = NULL;
+
+ return myParams;
+}
+
+// Create an exception that will be thrown when we return from the JNI call.
+jint jpa_ThrowError( JNIEnv *env, const char *message )
+{
+ return (*env)->ThrowNew(env, (*env)->FindClass( env, "java/lang/RuntimeException"),
+ message );
+}
+
+// Throw an exception on error.
+jint jpa_CheckError( JNIEnv *env, PaError err )
+{
+ 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();
+ return jpa_ThrowError( env, hostErrorInfo->errorText );
+ }
+ else
+ {
+ return jpa_ThrowError( env, Pa_GetErrorText( err ) );
+ }
+ }
+ else
+ {
+ return err;
+ }
+}
+
+// Get the stream pointer from a BlockingStream long field.
+PaStream *jpa_GetStreamPointer( JNIEnv *env, jobject blockingStream )
+{
+ jclass cls = (*env)->GetObjectClass(env, blockingStream);
+ return (PaStream *) jpa_GetLongField( env, cls, blockingStream, "nativeStream" );
+}
diff --git a/3rdparty/portaudio/bindings/java/c/src/jpa_tools.h b/3rdparty/portaudio/bindings/java/c/src/jpa_tools.h
new file mode 100644
index 0000000..11e724c
--- /dev/null
+++ b/3rdparty/portaudio/bindings/java/c/src/jpa_tools.h
@@ -0,0 +1,62 @@
+/*
+ * Portable Audio I/O Library
+ * Java Binding for PortAudio
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * Copyright (c) 2008 Ross Bencina
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+#include "com_portaudio_PortAudio.h"
+#include "portaudio.h"
+
+#ifndef JPA_TOOLS_H
+#define JPA_TOOLS_H
+
+jint jpa_GetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName );
+void jpa_SetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jint value );
+
+jlong jpa_GetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName );
+void jpa_SetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jlong value );
+
+jdouble jpa_GetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName );
+void jpa_SetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jdouble value );
+
+void jpa_SetStringField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, const char *value );
+PaStreamParameters *jpa_FillStreamParameters( JNIEnv *env, jobject jstreamParam, PaStreamParameters *myParams );
+
+jint jpa_CheckError( JNIEnv *env, PaError err );
+jint jpa_ThrowError( JNIEnv *env, const char *message );
+
+PaStream *jpa_GetStreamPointer( JNIEnv *env, jobject blockingStream );
+
+#endif /* JPA_TOOLS_H */