summaryrefslogtreecommitdiff
path: root/portaudio/bindings/java/jportaudio/src
diff options
context:
space:
mode:
Diffstat (limited to 'portaudio/bindings/java/jportaudio/src')
-rw-r--r--portaudio/bindings/java/jportaudio/src/com/portaudio/BlockingStream.java208
-rw-r--r--portaudio/bindings/java/jportaudio/src/com/portaudio/DeviceInfo.java65
-rw-r--r--portaudio/bindings/java/jportaudio/src/com/portaudio/HostApiInfo.java61
-rw-r--r--portaudio/bindings/java/jportaudio/src/com/portaudio/PortAudio.java261
-rw-r--r--portaudio/bindings/java/jportaudio/src/com/portaudio/StreamInfo.java60
-rw-r--r--portaudio/bindings/java/jportaudio/src/com/portaudio/StreamParameters.java57
6 files changed, 712 insertions, 0 deletions
diff --git a/portaudio/bindings/java/jportaudio/src/com/portaudio/BlockingStream.java b/portaudio/bindings/java/jportaudio/src/com/portaudio/BlockingStream.java
new file mode 100644
index 0000000..4c249ab
--- /dev/null
+++ b/portaudio/bindings/java/jportaudio/src/com/portaudio/BlockingStream.java
@@ -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.
+ */
+
+/** @file
+ @ingroup bindings_java
+
+ @brief A blocking read/write stream.
+*/
+package com.portaudio;
+
+/**
+ * Represents a stream for blocking read/write I/O.
+ *
+ * This Java object contains the pointer to a PortAudio stream stored as a long.
+ * It is passed to PortAudio when calling stream related functions.
+ *
+ * To create one of these, call PortAudio.openStream().
+ *
+ * @see PortAudio
+ *
+ * @author Phil Burk
+ *
+ */
+public class BlockingStream
+{
+ // nativeStream is only accessed by the native code. It contains a pointer
+ // to a PaStream.
+ private long nativeStream;
+ private int inputFormat = -1;
+ private int outputFormat = -1;
+
+ protected BlockingStream()
+ {
+ }
+
+ /**
+ * @return number of frames that can be read without blocking.
+ */
+ public native int getReadAvailable();
+
+ /**
+ * @return number of frames that can be written without blocking.
+ */
+ public native int getWriteAvailable();
+
+ private native boolean readFloats( float[] buffer, int numFrames );
+
+ private native boolean writeFloats( float[] buffer, int numFrames );
+
+ /**
+ * Read 32-bit floating point data from the stream into the array.
+ *
+ * @param buffer
+ * @param numFrames
+ * number of frames to read
+ * @return true if an input overflow occurred
+ */
+ public boolean read( float[] buffer, int numFrames )
+ {
+ if( inputFormat != PortAudio.FORMAT_FLOAT_32 )
+ {
+ throw new RuntimeException(
+ "Tried to read float samples from a non float stream." );
+ }
+ return readFloats( buffer, numFrames );
+ }
+
+ /**
+ * Write 32-bit floating point data to the stream from the array. The data
+ * should be in the range -1.0 to +1.0.
+ *
+ * @param buffer
+ * @param numFrames
+ * number of frames to write
+ * @return true if an output underflow occurred
+ */
+ public boolean write( float[] buffer, int numFrames )
+ {
+ if( outputFormat != PortAudio.FORMAT_FLOAT_32 )
+ {
+ throw new RuntimeException(
+ "Tried to write float samples to a non float stream." );
+ }
+ return writeFloats( buffer, numFrames );
+ }
+
+ private native boolean readShorts( short[] buffer, int numFrames );
+
+ private native boolean writeShorts( short[] buffer, int numFrames );
+
+ /**
+ * Read 16-bit integer data to the stream from the array.
+ *
+ * @param buffer
+ * @param numFrames
+ * number of frames to write
+ * @return true if an input overflow occurred
+ */
+ public boolean read( short[] buffer, int numFrames )
+ {
+ if( inputFormat != PortAudio.FORMAT_INT_16 )
+ {
+ throw new RuntimeException(
+ "Tried to read short samples from a non short stream." );
+ }
+ return readShorts( buffer, numFrames );
+ }
+
+ /**
+ * Write 16-bit integer data to the stream from the array.
+ *
+ * @param buffer
+ * @param numFrames
+ * number of frames to write
+ * @return true if an output underflow occurred
+ */
+ public boolean write( short[] buffer, int numFrames )
+ {
+ if( outputFormat != PortAudio.FORMAT_INT_16 )
+ {
+ throw new RuntimeException(
+ "Tried to write short samples from a non short stream." );
+ }
+ return writeShorts( buffer, numFrames );
+ }
+
+ /**
+ * Atart audio I/O.
+ */
+ public native void start();
+
+ /**
+ * Wait for the stream to play all of the data that has been written then
+ * stop.
+ */
+ public native void stop();
+
+ /**
+ * Stop immediately and lose any data that was written but not played.
+ */
+ public native void abort();
+
+ /**
+ * Close the stream and zero out the pointer. Do not reference the stream
+ * after this.
+ */
+ public native void close();
+
+ public native boolean isStopped();
+
+ public native boolean isActive();
+
+ public String toString()
+ {
+ return "BlockingStream: streamPtr = " + Long.toHexString( nativeStream )
+ + ", inFormat = " + inputFormat + ", outFormat = "
+ + outputFormat;
+ }
+
+ /**
+ * Get audio time related to this stream. Note that it may not start at 0.0.
+ */
+ public native double getTime();
+
+ private native void getInfo( StreamInfo streamInfo );
+
+ public StreamInfo getInfo()
+ {
+ StreamInfo streamInfo = new StreamInfo();
+ getInfo( streamInfo );
+ return streamInfo;
+ }
+}
diff --git a/portaudio/bindings/java/jportaudio/src/com/portaudio/DeviceInfo.java b/portaudio/bindings/java/jportaudio/src/com/portaudio/DeviceInfo.java
new file mode 100644
index 0000000..1c4682e
--- /dev/null
+++ b/portaudio/bindings/java/jportaudio/src/com/portaudio/DeviceInfo.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+/** @file
+ @ingroup bindings_java
+
+ @brief Information about a JPortAudio device.
+*/
+package com.portaudio;
+
+/**
+ * Equivalent to PaDeviceInfo
+ * @see PortAudio
+ * @see HostApiInfo
+ * @author Phil Burk
+ *
+ */
+public class DeviceInfo
+{
+ public int version;
+ public String name;
+ public int hostApi;
+ public int maxInputChannels;
+ public int maxOutputChannels;
+ public double defaultLowInputLatency;
+ public double defaultHighInputLatency;
+ public double defaultLowOutputLatency;
+ public double defaultHighOutputLatency;
+ public double defaultSampleRate;
+}
diff --git a/portaudio/bindings/java/jportaudio/src/com/portaudio/HostApiInfo.java b/portaudio/bindings/java/jportaudio/src/com/portaudio/HostApiInfo.java
new file mode 100644
index 0000000..dc2cdce
--- /dev/null
+++ b/portaudio/bindings/java/jportaudio/src/com/portaudio/HostApiInfo.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/** @file
+ @ingroup bindings_java
+
+ @brief Information about a JPortAudio Host API.
+*/
+package com.portaudio;
+
+/**
+ * Equivalent to PaHostApiInfo
+ * @see PortAudio
+ * @see DeviceInfo
+ * @author Phil Burk
+ *
+ */
+public class HostApiInfo
+{
+ public int version;
+ public int type;
+ public String name;
+ public int deviceCount;
+ public int defaultInputDevice;
+ public int defaultOutputDevice;
+}
diff --git a/portaudio/bindings/java/jportaudio/src/com/portaudio/PortAudio.java b/portaudio/bindings/java/jportaudio/src/com/portaudio/PortAudio.java
new file mode 100644
index 0000000..41b3c67
--- /dev/null
+++ b/portaudio/bindings/java/jportaudio/src/com/portaudio/PortAudio.java
@@ -0,0 +1,261 @@
+/*
+ * 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.
+ */
+
+/** @file
+ @ingroup bindings_java
+
+ @brief Java wrapper for the PortAudio API.
+*/
+package com.portaudio;
+
+/**
+ * Java methods that call PortAudio via JNI. This is a portable audio I/O
+ * library that can be used as an alternative to JavaSound.
+ *
+ * Please see the PortAudio documentation for a full explanation.
+ *
+ * http://portaudio.com/docs/
+ * http://portaudio.com/docs/v19-doxydocs/portaudio_8h.html
+ *
+ * This Java binding does not support audio callbacks because an audio callback
+ * should never block. Calling into a Java virtual machine might block for
+ * garbage collection or synchronization. So only the blocking read/write mode
+ * is supported.
+ *
+ * @see BlockingStream
+ * @see DeviceInfo
+ * @see HostApiInfo
+ * @see StreamInfo
+ * @see StreamParameters
+ *
+ * @author Phil Burk
+ *
+ */
+public class PortAudio
+{
+ public final static int FLAG_CLIP_OFF = (1 << 0);
+ public final static int FLAG_DITHER_OFF = (1 << 1);
+
+ /** Sample Formats */
+ public final static int FORMAT_FLOAT_32 = (1 << 0);
+ public final static int FORMAT_INT_32 = (1 << 1); // not supported
+ public final static int FORMAT_INT_24 = (1 << 2); // not supported
+ public final static int FORMAT_INT_16 = (1 << 3);
+ public final static int FORMAT_INT_8 = (1 << 4); // not supported
+ public final static int FORMAT_UINT_8 = (1 << 5); // not supported
+
+ /** These HOST_API_TYPES will not change in the future. */
+ public final static int HOST_API_TYPE_DEV = 0;
+ public final static int HOST_API_TYPE_DIRECTSOUND = 1;
+ public final static int HOST_API_TYPE_MME = 2;
+ public final static int HOST_API_TYPE_ASIO = 3;
+ /** Apple Sound Manager. Obsolete. */
+ public final static int HOST_API_TYPE_SOUNDMANAGER = 4;
+ public final static int HOST_API_TYPE_COREAUDIO = 5;
+ public final static int HOST_API_TYPE_OSS = 7;
+ public final static int HOST_API_TYPE_ALSA = 8;
+ public final static int HOST_API_TYPE_AL = 9;
+ public final static int HOST_API_TYPE_BEOS = 10;
+ public final static int HOST_API_TYPE_WDMKS = 11;
+ public final static int HOST_API_TYPE_JACK = 12;
+ public final static int HOST_API_TYPE_WASAPI = 13;
+ public final static int HOST_API_TYPE_AUDIOSCIENCE = 14;
+ public final static int HOST_API_TYPE_COUNT = 15;
+
+ static
+ {
+ String os = System.getProperty( "os.name" ).toLowerCase();
+ // On Windows we have separate libraries for 32 and 64-bit JVMs.
+ if( os.indexOf( "win" ) >= 0 )
+ {
+ if( System.getProperty( "os.arch" ).contains( "64" ) )
+ {
+ System.loadLibrary( "jportaudio_x64" );
+ }
+ else
+ {
+ System.loadLibrary( "jportaudio_x86" );
+ }
+ }
+ else
+ {
+ System.loadLibrary( "jportaudio" );
+ }
+ System.out.println( "---- JPortAudio version " + getVersion() + ", "
+ + getVersionText() );
+ }
+
+ /**
+ * @return the release number of the currently running PortAudio build, eg
+ * 1900.
+ */
+ public native static int getVersion();
+
+ /**
+ * @return a textual description of the current PortAudio build, eg
+ * "PortAudio V19-devel 13 October 2002".
+ */
+ public native static String getVersionText();
+
+ /**
+ * Library initialization function - call this before using PortAudio. This
+ * function initializes internal data structures and prepares underlying
+ * host APIs for use. With the exception of getVersion(), getVersionText(),
+ * and getErrorText(), this function MUST be called before using any other
+ * PortAudio API functions.
+ */
+ public native static void initialize();
+
+ /**
+ * Library termination function - call this when finished using PortAudio.
+ * This function deallocates all resources allocated by PortAudio since it
+ * was initialized by a call to initialize(). In cases where Pa_Initialise()
+ * has been called multiple times, each call must be matched with a
+ * corresponding call to terminate(). The final matching call to terminate()
+ * will automatically close any PortAudio streams that are still open.
+ */
+ public native static void terminate();
+
+ /**
+ * @return the number of available devices. The number of available devices
+ * may be zero.
+ */
+ public native static int getDeviceCount();
+
+ private native static void getDeviceInfo( int index, DeviceInfo deviceInfo );
+
+ /**
+ * @param index
+ * A valid device index in the range 0 to (getDeviceCount()-1)
+ * @return An DeviceInfo structure.
+ * @throws RuntimeException
+ * if the device parameter is out of range.
+ */
+ public static DeviceInfo getDeviceInfo( int index )
+ {
+ DeviceInfo deviceInfo = new DeviceInfo();
+ getDeviceInfo( index, deviceInfo );
+ return deviceInfo;
+ }
+
+ /**
+ * @return the number of available host APIs.
+ */
+ public native static int getHostApiCount();
+
+ private native static void getHostApiInfo( int index,
+ HostApiInfo hostApiInfo );
+
+ /**
+ * @param index
+ * @return information about the Host API
+ */
+ public static HostApiInfo getHostApiInfo( int index )
+ {
+ HostApiInfo hostApiInfo = new HostApiInfo();
+ getHostApiInfo( index, hostApiInfo );
+ return hostApiInfo;
+ }
+
+ /**
+ * @param hostApiType
+ * A unique host API identifier, for example
+ * HOST_API_TYPE_COREAUDIO.
+ * @return a runtime host API index
+ */
+ public native static int hostApiTypeIdToHostApiIndex( int hostApiType );
+
+ /**
+ * @param hostApiIndex
+ * A valid host API index ranging from 0 to (getHostApiCount()-1)
+ * @param apiDeviceIndex
+ * A valid per-host device index in the range 0 to
+ * (getHostApiInfo(hostApi).deviceCount-1)
+ * @return standard PortAudio device index
+ */
+ public native static int hostApiDeviceIndexToDeviceIndex( int hostApiIndex,
+ int apiDeviceIndex );
+
+ public native static int getDefaultInputDevice();
+
+ public native static int getDefaultOutputDevice();
+
+ public native static int getDefaultHostApi();
+
+ /**
+ * @param inputStreamParameters
+ * input description, may be null
+ * @param outputStreamParameters
+ * output description, may be null
+ * @param sampleRate
+ * typically 44100 or 48000, or maybe 22050, 16000, 8000, 96000
+ * @return 0 if supported or a negative error
+ */
+ public native static int isFormatSupported(
+ StreamParameters inputStreamParameters,
+ StreamParameters outputStreamParameters, int sampleRate );
+
+ private native static void openStream( BlockingStream blockingStream,
+ StreamParameters inputStreamParameters,
+ StreamParameters outputStreamParameters, int sampleRate,
+ int framesPerBuffer, int flags );
+
+ /**
+ *
+ * @param inputStreamParameters
+ * input description, may be null
+ * @param outputStreamParameters
+ * output description, may be null
+ * @param sampleRate
+ * typically 44100 or 48000, or maybe 22050, 16000, 8000, 96000
+ * @param framesPerBuffer
+ * @param flags
+ * @return
+ */
+ public static BlockingStream openStream(
+ StreamParameters inputStreamParameters,
+ StreamParameters outputStreamParameters, int sampleRate,
+ int framesPerBuffer, int flags )
+ {
+ BlockingStream blockingStream = new BlockingStream();
+ openStream( blockingStream, inputStreamParameters,
+ outputStreamParameters, sampleRate, framesPerBuffer, flags );
+ return blockingStream;
+ }
+
+}
diff --git a/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamInfo.java b/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamInfo.java
new file mode 100644
index 0000000..685f94d
--- /dev/null
+++ b/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamInfo.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+
+/** @file
+ @ingroup bindings_java
+
+ @brief Information about a JPortAudio Stream.
+*/
+
+package com.portaudio;
+
+/**
+ * Equivalent to PaStreamInfo
+ * @see PortAudio
+ * @author Phil Burk
+ *
+ */
+public class StreamInfo
+{
+ public int structVersion;
+ public double outputLatency;
+ public double inputLatency;
+ public double sampleRate;
+}
diff --git a/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamParameters.java b/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamParameters.java
new file mode 100644
index 0000000..707dab5
--- /dev/null
+++ b/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamParameters.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+/** @file
+ @ingroup bindings_java
+
+ @brief Options to use when opening a stream.
+*/
+package com.portaudio;
+/**
+ * Equivalent to PaStreamParameters
+ * @see PortAudio
+ * @author Phil Burk
+ *
+ */
+public class StreamParameters
+{
+ public int device = 0;
+ public int channelCount = 2;
+ public int sampleFormat = PortAudio.FORMAT_FLOAT_32;
+ public double suggestedLatency = 0.050;
+}