summaryrefslogtreecommitdiffstats
path: root/src/java/net
diff options
context:
space:
mode:
authorathomas <[email protected]>2003-06-07 00:24:00 +0000
committerathomas <[email protected]>2003-06-07 00:24:00 +0000
commit5f9e58c5b1a23119a63dfb1e76e73349858439db (patch)
tree15dd6447e3a3d51aa527a75d2640a20537c1adde /src/java/net
parent52acaea03c9dd7512fcc17f4ce16d1e86f4512eb (diff)
Initial check-in of project files
git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@21 03bf7f67-59de-4072-a415-9a990d468a3f
Diffstat (limited to 'src/java/net')
-rw-r--r--src/java/net/java/games/joal/AL.java1260
-rw-r--r--src/java/net/java/games/joal/ALC.java259
-rw-r--r--src/java/net/java/games/joal/ALCConstants.java95
-rw-r--r--src/java/net/java/games/joal/ALCImpl.java177
-rw-r--r--src/java/net/java/games/joal/ALConstants.java348
-rw-r--r--src/java/net/java/games/joal/ALFactory.java105
-rw-r--r--src/java/net/java/games/joal/ALImpl.java905
-rw-r--r--src/java/net/java/games/joal/eax/EAX.java140
-rw-r--r--src/java/net/java/games/joal/eax/EAXConstants.java350
-rw-r--r--src/java/net/java/games/joal/eax/EAXFactory.java59
-rw-r--r--src/java/net/java/games/joal/util/BufferUtils.java166
-rw-r--r--src/java/net/java/games/joal/util/WAVData.java57
-rw-r--r--src/java/net/java/games/joal/util/WAVLoader.java87
-rw-r--r--src/java/net/java/games/sound3d/AudioSystem3D.java215
-rw-r--r--src/java/net/java/games/sound3d/Buffer.java140
-rw-r--r--src/java/net/java/games/sound3d/Context.java64
-rw-r--r--src/java/net/java/games/sound3d/Device.java54
-rw-r--r--src/java/net/java/games/sound3d/Listener.java95
-rw-r--r--src/java/net/java/games/sound3d/Source.java286
-rw-r--r--src/java/net/java/games/sound3d/Vec3f.java52
20 files changed, 4914 insertions, 0 deletions
diff --git a/src/java/net/java/games/joal/AL.java b/src/java/net/java/games/joal/AL.java
new file mode 100644
index 0000000..e5c155d
--- /dev/null
+++ b/src/java/net/java/games/joal/AL.java
@@ -0,0 +1,1260 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal;
+
+import java.nio.ByteBuffer;
+
+
+/**
+ * This class contains the core OpenAL functions
+ *
+ * @author Athomas Goldberg
+ */
+public interface AL extends ALConstants {
+ // AL_BUFFER RELATED METHODS
+
+ /**
+ * This method generates one or more buffers. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGenBuffers(ALsizei n, ALuint *buffers);</pre>
+ *
+ * @param n the number of buffers to be generated
+ * @param buffers an IntBuffer to contain the ids of the new buffers.
+ * IntBuffer must be a direct, non-null buffer, and buffer capacity
+ * must be equal to or greater than the number of buffers to be
+ * generated. Use BufferUtils.newIntBuffer(int capacity) to create
+ * an appropriate buffer.
+ */
+// public void alGenBuffers(int n, IntBuffer buffers);
+
+ /**
+ * This method generates one or more buffers. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGenBuffers(ALsizei n, ALuint *buffers);</pre>
+ *
+ * @param n the number of buffers to be generated
+ * @param buffers an int array to hold the IDs of the new buffers. Array
+ * must be non-null, and length must be equal to or greater than
+ * the number of buffers to be generated.
+ */
+ public void alGenBuffers(int n, int[] buffers);
+
+ /**
+ * This method deletes one or more buffers. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alDeleteBuffers(ALsizei n, ALuint *buffers);</pre>
+ *
+ * @param n number of buffers to be deleted.
+ * @param buffers a direct, non-null IntBuffer containing buffer names to
+ * be deleted.
+ */
+// public void alDeleteBuffers(int n, IntBuffer buffers);
+
+ /**
+ * This method deletes one or more buffers. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alDeleteBuffers(ALsizei n, ALuint *buffers);</pre>
+ *
+ * @param n number of buffers to be deleted.
+ * @param buffers a direct, non-null IntBuffer containing buffer names to
+ * be deleted.
+ */
+ public void alDeleteBuffers(int n, int[] buffers);
+
+ /**
+ * This method tests if a buffer id is valid. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALboolean alIsBuffer(ALuint buffer);</pre>
+ *
+ * @param bufferID the name of the buffer.
+ *
+ * @return true if the buffer ID is valid
+ */
+ public boolean alIsBuffer(int bufferID);
+
+ /**
+ * This method fills a buffer with audio data. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alBufferData(ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq);</pre>
+ *
+ * @param bufferID name of buffer to be filled with data
+ * @param format the format type from among the following: AL_MONO8, AL_MONO16,
+ * AL_STEREO8, AL_STEREO16.
+ * @param data the audio data, must be non-null array
+ * @param frequency the frequency of the audio data
+ */
+ public void alBufferData(
+ int bufferID,
+ int format,
+ byte[] data,
+ int size,
+ int frequency
+ );
+
+ /**
+ * This method fills a buffer with audio data. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alBufferData(ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq);</pre>
+ *
+ * @param bufferID name of buffer to be filled with data
+ * @param format the format type from among the following: AL_MONO8, AL_MONO16,
+ * AL_STEREO8, AL_STEREO16.
+ * @param data the audio data Must be non-null, direct ByteBuffer
+ * @param frequency the frequency of the audio data
+ */
+ public void alBufferData(
+ int bufferID,
+ int format,
+ ByteBuffer data,
+ int size,
+ int frequency
+ );
+
+ /**
+ * This method retrieves a floating point property of a buffer. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGetBufferf(ALuint buffer, ALuint pname, float value);</pre>
+ * <br><br>
+ *
+ * @param bufferID Buffer ID whose attribute is being retrieved
+ * @param pname the name of the attribute to be retrieved
+ * @param retValue a single-element array to hold the retrieved value.
+ */
+ public void alGetBufferf(int bufferID, int pname, float[] retValue);
+
+ /**
+ * This method retrieves a floating point property of a buffer. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGetBufferf(ALuint buffer, ALuint pname, ALfloat *value);</pre>
+ *
+ * @param bufferID Buffer ID whose attribute is being retrieved
+ * @param pname the name of the attribute to be retrieved
+ * @param retValue a single-element buffer to hold the retrieved value.
+ */
+// public void alGetBufferf(int bufferID, int pname, FloatBuffer retValue);
+
+ /**
+ * This method retrieves a floating point property of a buffer. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGetBufferf(ALuint buffer, ALuint pname, ALfloat *value);</pre>
+ *
+ * @param bufferID Buffer ID whose attribute is being retrieved
+ * @param pname the name of the attribute to be retrieved
+ *
+ * @return retValue the retrieved value.
+ */
+ public float alGetBufferf(int bufferID, int pname);
+
+ /**
+ * This method retrieves a integer property of a buffer. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGetBufferi(ALuint buffer, ALuint pname, ALint *value);</pre>
+ *
+ * @param bufferID Buffer ID whose attribute is being retrieved
+ * @param pname the name of the attribute to be retrieved
+ * @param retValue a single-element array to hold the retrieved value.
+ */
+ public void alGetBufferi(int bufferID, int pname, int[] retValue);
+
+ /**
+ * This method retrieves a integer property of a buffer. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGetBufferi(ALuint buffer, ALuint pname, ALint value);</pre>
+ *
+ * @param bufferID Buffer ID whose attribute is being retrieved
+ * @param pname the name of the attribute to be retrieved
+ * @param retValue a single-element IntBuffer to hold the retrieved value.
+ */
+// public void alGetBufferi(int bufferID, int pname, IntBuffer retValue);
+
+ /**
+ * This method retrieves a integer property of a buffer. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGetBufferi(ALuint buffer, ALuint pname, ALint *value);</pre>
+ *
+ * @param bufferID Buffer ID whose attribute is being retrieved
+ * @param pname the name of the attribute to be retrieved
+ *
+ * @return retValue the retrieved value.
+ */
+ public int alGetBufferi(int bufferID, int pname);
+
+ // SOURCE RELATED METHODS
+
+ /**
+ * This method generates one or more sources. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGenSources(ALsizei n, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be generated
+ * @param sources an integer array to hold the ids of the new sources
+ */
+ public void alGenSources(int numSources, int[] sources);
+
+ /**
+ * This method generates one or more sources. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alGenSources(ALsizei n, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be generated
+ * @param sources an IntBuffer to hold the IDs of the new sources
+ */
+// public void alGenSources(int numSources, IntBuffer sources);
+
+ /**
+ * This method deletes one or more sources. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alDeleteSources(ALsizei n, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be generated
+ * @param sources an int array containing the IDs of the sources to be
+ * deleted
+ */
+ public void alDeleteSources(int numSources, int[] sources);
+
+ /**
+ * This method deletes one or more sources. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alDeleteSources(ALsizei n, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be generated
+ * @param sources an IntBuffer containing the IDs of the sources to be
+ * deleted
+ */
+// public void alDeleteSources(int numSources, IntBuffer sources);
+
+ /**
+ * This method tests if a source ID is valid. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alDeleteSources(ALsizei n, ALuint *sources);</pre>
+ *
+ * @param sourceID a source ID to be tested for validity
+ *
+ * @return true if the source ID is valid, or false if the source ID is not
+ * valid
+ */
+ public boolean alIsSource(int sourceID);
+
+ /**
+ * This method sets a floating point property of a source. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid alSourcei(ALuint sourceID, ALuint pname, ALfloat value);</pre>
+ *
+ * @param sourceID source ID whose attribute is being set
+ * @param pname the name of the attribute to set:
+ * <pre>
+ * AL_PITCH
+ * AL_GAIN
+ * AL_MAX_DISTANCE
+ * AL_ROLLOFF_FACTOR
+ * AL_REFERENCE_DISTANCE
+ * AL_MIN_GAIN
+ * AL_MAX_GAIN
+ * AL_CONE_OUTER_GAIN
+ * </pre>
+ * @param value the value to set the attribute to
+ */
+ public void alSourcef(int sourceID, int pname, float value);
+
+ /**
+ * This method sets a floating-point vector property of a source. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid aSourcefv(ALuint source, ALenum pname, ALfloat *values)</pre>
+ *
+ * @param sourceID source ID whose attribute is being set
+ * @param pname the nameof the attribute to set:
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_DIRECTION
+ * </pre>
+ * @param value a float array containing the vector to set the attribute to.
+ */
+ public void alSourcefv(int sourceID, int pname, float[] value);
+
+ /**
+ * This method sets a floating-point vector property of a source. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid aSourcefv(ALuint source, ALenum pname, ALfloat *values)</pre>
+ *
+ * @param sourceID source ID whose attribute is being set
+ * @param pname the nameof the attribute to set:
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_DIRECTION
+ * </pre>
+ * @param value direct FloatBuffer containing the vector to set the attribute to.
+ */
+// public void alSourcefv(int sourceID, int pname, FloatBuffer value);
+
+
+ /**
+ * This method sets a source property requiring three floating point values. <br>
+ * <br>
+ * <b>Interface to C lanuage function:</b>
+ * <pre>ALvoid alSource3f (ALuint source, ALenum pname, ALfloat v1, ALfloat v2, ALfloat v3);</pre>
+ *
+ * @param sourceID the id of the source whose atribute is being set.
+ * @param pname the name of the attribute being set.
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_DIRECTION
+ * </pre>
+ * @param v1 the first float value which the attribute will be set to
+ * @param v2 the second float value which the attribute will be set to
+ * @param v3 the third float value which the attribute will be set to
+ */
+ public void alSource3f(
+ int sourceID,
+ int pname,
+ float v1,
+ float v2,
+ float v3
+ );
+
+ /**
+ * This method sets a integer property of a source. <br>
+ * <br>
+ * <b>Interface to C language function:</b>
+ * <pre>ALvoid aSourcei(ALuint source, ALenum pname, ALint value)</pre>
+ *
+ * @param sourceID source ID whose attribute is being set
+ * @param pname the nameof the attribute to set:
+ * <pre>
+ * AL_SOURCE_RELATIVE
+ * AL_LOOPING
+ * AL_BUFFER
+ * AL_SOURCE_STATE
+ * </pre>
+ * @param value the int value to set the attribute to.
+ */
+ public void alSourcei(int sourceID, int pname, int value);
+
+ /**
+ * This methof retrieves a floating point property of a source. <br>
+ * <br>
+ * <b>Interface to C language unction:</b>
+ * <pre>ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);</pre>
+ *
+ * @param sourceID the id of the source whose attribute is being retrieved.
+ * @param pname he name of the attribute to retrieve
+ * <pre>
+ * AL_PITCH
+ * AL_GAIN
+ * AL_MIN_GAIN
+ * AL_MAX_GAIN
+ * AL_MAX_DISTANCE
+ * AL_ROLLOFF_DISTANCE
+ * AL_CONE_OUTER_GAIN
+ * AL_CONE_INNER_ANGLE
+ * AL_CONE_OUTER_ANGLE
+ * AL_REFERENCE_DISTANCE
+ * </pre>
+ * @param retValue a single-element float array to hold the value being retrieved.
+ */
+ public void alGetSourcef(int sourceID, int pname, float[] retValue);
+
+ /**
+ * This methof retrieves a floating point property of a source. <br>
+ * <br>
+ * <b>Interface to C language unction:</b>
+ * <pre>ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);</pre>
+ *
+ * @param sourceID the id of the source whose attribute is being retrieved.
+ * @param pname he name of the attribute to retrieve
+ * <pre>
+ * AL_PITCH
+ * AL_GAIN
+ * AL_MIN_GAIN
+ * AL_MAX_GAIN
+ * AL_MAX_DISTANCE
+ * AL_ROLLOFF_DISTANCE
+ * AL_CONE_OUTER_GAIN
+ * AL_CONE_INNER_ANGLE
+ * AL_CONE_OUTER_ANGLE
+ * AL_REFERENCE_DISTANCE
+ * </pre>
+ * @param buffer a direct FloatBuffer to hold the value being retrieved.
+ */
+// public void alGetSourcef(int sourceID, int pname, FloatBuffer buffer);
+
+ /**
+ * This methof retrieves a floating point property of a source. <br>
+ * <br>
+ * <b>Interface to C language unction:</b>
+ * <pre>ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);</pre>
+ *
+ * @param sourceID the id of the source whose attribute is being retrieved.
+ * @param pname he name of the attribute to retrieve
+ * <pre>
+ * AL_PITCH
+ * AL_GAIN
+ * AL_MIN_GAIN
+ * AL_MAX_GAIN
+ * AL_MAX_DISTANCE
+ * AL_ROLLOFF_DISTANCE
+ * AL_CONE_OUTER_GAIN
+ * AL_CONE_INNER_ANGLE
+ * AL_CONE_OUTER_ANGLE
+ * AL_REFERENCE_DISTANCE
+ * </pre>
+ * @return the floating point value being retrieved.
+ */
+ public float alGetSourcef(int sourceID, int pname);
+
+ /**
+ * This method retrieves a floating point vector property of a source. <br>
+ * <br>
+ * <b>Interface to C language unction:</b>
+ * <pre>ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);</pre>
+ *
+ *
+ * @param sourceID the id of the source whose attribute is being retrieved.
+ * @param pname the name of the attribute to retrieve
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_DIRECTION
+ * </pre>
+ * @param value a direct FloatBuffer to hold the value being retrieved
+ */
+// public void alGetSourcefv(int sourceID, int pname, FloatBuffer value);
+
+ /**
+ * This method retrieves a floating point vector property of a source. <br>
+ * <br>
+ * <b>Interface to C language unction:</b>
+ * <pre>ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);</pre>
+ *
+ *
+ * @param sourceID the id of the source whose attribute is being retrieved.
+ * @param pname the name of the attribute to retrieve
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_DIRECTION
+ * </pre>
+ * @param retValue a float array to hold the value being retrieved
+ */
+ public void alGetSourcefv(int sourceID, int pname, float[] retValue);
+
+ /**
+ * This method retrieves an integer property of a source. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetSourcei(ALuint source, Alenum pname, ALint *value);</pre>
+ *
+ * @param sourceID source id whose attribute is being retrieved.
+ * @param pname the name of the attribute being retrieved.
+ * <pre>
+ * AL_SOURCE_RELATIVE
+ * AL_BUFFER
+ * AL_LOOPING
+ * AL_SOURCE_STATE
+ * AL_BUFFERS_QUEUED
+ * AL_BUFFERS_PROCESSED
+ * </pre>
+ * @param retValue an int array to hold the value being retrieved
+ */
+ public void alGetSourcei(int sourceID, int pname, int[] retValue);
+
+ /**
+ * This method retrieves an integer property of a source. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetSourcei(ALuint source, Alenum pname, ALint *value);</pre>
+ *
+ * @param sourceID source id whose attribute is being retrieved.
+ * @param pname the name of the attribute being retrieved.
+ * <pre>
+ * AL_SOURCE_RELATIVE
+ * AL_BUFFER
+ * AL_LOOPING
+ * AL_SOURCE_STATE
+ * AL_BUFFERS_QUEUED
+ * AL_BUFFERS_PROCESSED
+ * </pre>
+ * @param retValue a direct IntBuffer to hold the value being retrieved
+ */
+// public void alGetSourcei(int sourceID, int pname, IntBuffer retValue);
+
+ /**
+ * This method retrieves an integer property of a source. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetSourcei(ALuint source, Alenum pname, ALint *value);</pre>
+ *
+ * @param sourceID source id whose attribute is being retrieved.
+ * @param pname the name of the attribute being retrieved.
+ * <pre>
+ * AL_SOURCE_RELATIVE
+ * AL_BUFFER
+ * AL_LOOPING
+ * AL_SOURCE_STATE
+ * AL_BUFFERS_QUEUED
+ * AL_BUFFERS_PROCESSED
+ * </pre>
+ * @return the value being retrieved
+ */
+ public int alGetSourcei(int sourceID, int pname);
+
+ /**
+ * This method plays a source. <br>
+ * <br>
+ *<b>Interface to C Language function:</b>
+ *<pre>ALvoid alSourcePlay(ALuint source);</pre>
+ *
+ * @param sourceID the id of the source to be played
+ */
+ public void alSourcePlay(int sourceID);
+
+ /**
+ * This method plays a set of sources. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alSourcePlayv(Alsizei, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be plaed
+ * @param sourceIDs a direct IntBuffer containing the ids of the sources to be played.
+ */
+// public void alSourcePlayv(int numSources, IntBuffer sourceIDs);
+
+ /**
+ * This method plays a set of sources. <br>
+ * <br>
+ * <pre>ALvoid alSourcePlayv(Alsizei, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be plaed
+ * @param sourceIDs an array containing the ids of the sources to be played.
+ */
+ public void alSourcePlayv(int numSources, int[] sourceIDs);
+
+ /**
+ * This method pauses a source. <br>
+ * <br>
+ *<b>Interface to C Language function:</b>
+ *<pre>ALvoid alSourcePause(ALuint source);</pre>
+ *
+ * @param sourceID the id of the source to be paused
+ */
+ public void alSourcePause(int sourceID);
+
+ /**
+ * This method pauses a set of sources. <br>
+ * <br>
+ * <pre>ALvoid alSourcePausev(Alsizei, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be paused
+ * @param sourceIDs an array containing the ids of the sources to be paused.
+ */
+ public void alSourcePausev(int numSources, int[] sourceIDs);
+
+ /**
+ * This method pauses a set of sources. <br>
+ * <br>
+ * <pre>ALvoid alSourcePausev(Alsizei, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be paused
+ * @param sourceIDs an IntBuffer containing the ids of the sources to be paused.
+ */
+// public void alSourcePausev(int numSources, IntBuffer sourceIDs);
+
+ /**
+ * This method stops a source. <br>
+ * <br>
+ *<b>Interface to C Language function:</b>
+ *<pre>ALvoid alSourceStop(ALuint source);</pre>
+ *
+ * @param sourceID the id of the source to be stopped
+ */
+ public void alSourceStop(int sourceID);
+
+ /**
+ * This method stops a set of sources. <br>
+ * <br>
+ * <pre>ALvoid alSourceStopv(Alsizei, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be stopped
+ * @param sourceIDs an array containing the ids of the sources to be stopped.
+ */
+ public void alSourceStopv(int numSources, int[] sourceIDs);
+
+ /**
+ * This method stops a set of sources. <br>
+ * <br>
+ * <pre>ALvoid alSourceStopv(Alsizei, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be stopped
+ * @param sourceIDs a direct IntBuffer containing the ids of the sources to be stopped.
+ */
+// public void alSourceStopv(int numSources, IntBuffer sourceIDs);
+
+ /**
+ * This method rewinds a source. <br>
+ * <br>
+ *<b>Interface to C Language function:</b>
+ *<pre>ALvoid alSourceRewind(ALuint source);</pre>
+ *
+ * @param sourceID the id of the source to be rewound
+ */
+ public void alSourceRewind(int sourceID);
+
+ /**
+ * This method rewinds a set of sources. <br>
+ * <br>
+ *<b>Interface to C Language function:</b>
+ * <pre>ALvoid alSourceRewindv(Alsizei, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be rewound
+ * @param sourceIDs an array containing the ids of the sources to be rewound.
+ */
+ public void alSourceRewindv(int numSources, int[] sourceIDs);
+
+ /**
+ * This method rewinds a set of sources. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alSourceRewindv(Alsizei, ALuint *sources);</pre>
+ *
+ * @param numSources the number of sources to be rewound
+ * @param sourceIDs a direct IntBuffercontaining the ids of the sources to be rewound.
+ */
+// public void alSourceRewindv(int numSources, IntBuffer sourceIDs);
+
+ /**
+ * This method queues a set of buffers on a source. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>alSourceQueueBuffers(ALuint source, ALsizei n, ALuint *buffers);</pre>
+ *
+ * @param sourceID the id of the source to queue buffers onto
+ * @param numBuffers the number of buffers to be queued
+ * @param bufferIDs an array containing the list of buffer ids to be queued
+ */
+ public void alSourceQueueBuffers(
+ int sourceID,
+ int numBuffers,
+ int[] bufferIDs
+ );
+
+ /**
+ * This method queues a set of buffers on a source. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>alSourceQueueBuffers(ALuint source, ALsizei n, ALuint *buffers);</pre>
+ *
+ * @param sourceID the id of the source to queue buffers onto
+ * @param numBuffers the number of buffers to be queued
+ * @param bufferIDs a direct IntBuffer containing the list of buffer ids to be queued
+ *//*
+ public void alSourceQueueBuffers(
+ int sourceID,
+ int numBuffers,
+ IntBuffer bufferIDs
+ );*/
+
+ /**
+ * This method unqueues a set of buffers attached to a source.
+ * The unqueue operation will only take place if all <i>n</i> buffers
+ * can be removed from the queue<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alSourceUnqueueBuffers(ALuint source, ALsizei n, ALuint *buffers);</pre>
+ *
+ * @param source the id of the source to unqueue buffers from
+ * @param numBuffers the number of buffers to be unqueued
+ * @param bufferIDs an array of buffer ids to be unqueued
+ */
+ public void alSourceUnqueueBuffers(
+ int source,
+ int numBuffers,
+ int[] bufferIDs
+ );
+
+ /**
+ * This method unqueues a set of buffers attached to a source.
+ * The unqueue operation will only take place if all <i>n</i> buffers
+ * can be removed from the queue<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alSourceUnqueueBuffers(ALuint source, ALsizei n, ALuint *buffers);</pre>
+ *
+ * @param source the id of the source to unqueue buffers from
+ * @param numBuffers the number of buffers to be unqueued
+ * @param bufferIDs a direct IntBuffer of buffer ids to be unqueued
+ *//*
+ public void alSourceUnqueueBuffers(
+ int source,
+ int numBuffers,
+ IntBuffer bufferIDs
+ );*/
+
+ // LISTENER RELATED METHODS
+
+
+ /**
+ * This method sets a floating point property for the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alListenerf(ALenum pname, ALfloat value);</pre>
+ *
+ * @param pname the name of the attribute to be set
+ * @param value the value to set the attribute to.
+ */
+ public void alListenerf(int pname, float value);
+
+ /**
+ * This method sets a listener property requireing 3 floating point values. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alListener3f(ALenum pname, ALfloat v1, ALfloat v2, ALfloat v3);</pre>
+ *
+ * @param pname the name of the attribute to be set:
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_ORIENTATION
+ * </pre>
+ * @param v1 the first value to set the attribute to
+ * @param v2 the second value to set the attribute to
+ * @param v3 the third value to set the attribute to
+ */
+ public void alListener3f(int pname, float v1, float v2, float v3);
+
+ /**
+ * This method sets a floating point vector property of the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alListenerfv(ALenum pname, ALfloat *values);</pre>
+ *
+ * @param pname the name of the attribute to be set:
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_ORIENTATION
+ * </pre>
+ * @param values a float array containng the value to set the attribute to
+ */
+ public void alListenerfv(int pname, float[] values);
+
+ /**
+ * This method sets a floating point vector property of the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alListenerfv(ALenum pname, ALfloat *values);</pre>
+ *
+ * @param pname the name of the attribute to be set:
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_ORIENTATION
+ * </pre>
+ * @param values a direct FloatBuffer containng the value to set the attribute to
+ */
+// public void alListenerfv(int pname, FloatBuffer values);
+
+ /**
+ * This method sets an integer property on the listener.
+ * Note: there are no integer listener attributes at this time.<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alListeneri(ALenum pname, ALint value);</pre>
+ *
+ * @param pname the name of the attribute to set
+ * @param value the value to set the attribute to.
+ */
+ public void alListeneri(int pname, int value);
+
+ /**
+ * This method retrieves a floating point property of the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetListenerf(ALenum pname, ALfloat *value);</pre>
+ *
+ * @param pname the name of the attribute to be retrieved:
+ * <pre>
+ * AL_GAIN
+ * </pre>
+ * @param retValue a single-element array to hold the retrieved value
+ */
+ public void alGetListenerf(int pname, float[] retValue);
+
+ /**
+ * This method retrieves a floating point property of the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetListenerf(ALenum pname, ALfloat *value);</pre>
+ *
+ * @param pname the name of the attribute to be retrieved:
+ * <pre>
+ * AL_GAIN
+ * </pre>
+ * @param retValue a direct FloatBuffer to hold the retrieved value
+ */
+// public void alGetListenerf(int pname, FloatBuffer retValue);
+
+ /**
+ * This method retrieves a floating point property of the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alListeneri(ALenum pname, ALfloat *value);</pre>
+ *
+ * @param pname the name of the attribute to be retrieved:
+ * <pre>
+ * AL_GAIN
+ * </pre>
+ * @return the retrieved value
+ */
+ public float alGetListenerf(int pname);
+
+ /**
+ * This method retrieves a 3-element floating point property of the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetListener3f(ALenum pname, ALfloat *v1, ALfloat *v2, ALfloat *v3);</pre>
+ *
+ * @param pname the name of the attribute to be retrieved:
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * </pre>
+ *
+ * @param v1 a FloatBuffer to hold the first value
+ * @param v2 a FloatBuffer to hold the second value
+ * @param v3 a FloatBuffer to hold the third value
+ */
+/* public void alGetListener3f(
+ int pname,
+ FloatBuffer v1,
+ FloatBuffer v2,
+ FloatBuffer v3
+ );
+*/
+ /**
+ * This method retrieves a 3-element floating point property of the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetListener3f(ALenum pname, ALfloat *v1, ALfloat *v2, ALfloat *v3);</pre>
+ *
+ * @param pname the name of the attribute to be retrieved:
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * </pre>
+ *
+ * @param v1 a single element array to hold the first value
+ * @param v2 a single element array to hold the second value
+ * @param v3 a single element array to hold the third value
+ */
+ public void alGetListener3f(int pname, float[] v1, float[] v2, float[] v3);
+
+ /**
+ * This method retrieves a floating point-vector property of the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetListenerfv(ALenum pname, ALint *value);</pre>
+ *
+ * @param pname the nameof the atribute to be retrieved:
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_ORIENTATION
+ * </pre>
+ * @param retValue an array to hold the retrieved value
+ */
+ public void alGetListenerfv(int pname, float[] retValue);
+
+ /**
+ * This method retrieves a floating point-vector property of the listener. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetListenerfv(ALenum pname, ALint *value);</pre>
+ *
+ * @param pname the nameof the atribute to be retrieved:
+ * <pre>
+ * AL_POSITION
+ * AL_VELOCITY
+ * AL_ORIENTATION
+ * </pre>
+ * @param retValue a FloatBuffer to hold the retrieved value
+ */
+// public void alGetListenerfv(int pname, FloatBuffer retValue);
+
+ /**
+ * This method retrieves an integer property of the listener.
+ * Note: there are no integer listener properties at this time.<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetListeneri(ALenum pname, ALint *value);</pre>
+ *
+ * @param pname the nameof the attribute to be retrieved
+ * @param retValue an int array to hold the retrieved value.
+ */
+ public void alGetListeneri(int pname, int[] retValue);
+
+ /**
+ * This method retrieves an integer property of the listener. <br>
+ * Note: there are no integer listener properties at this time.<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetListeneri(ALenum pname, ALint *value);</pre>
+ *
+ * @param pname the nameof the attribute to be retrieved
+ * @param retValue an IntBuffer to hold the retrieved value.
+ */
+// public void alGetListeneri(int pname, IntBuffer retValue);
+
+ /**
+ * This method retrieves an integer property of the listener. <br>
+ * Note: there are no integer listener properties at this time.<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetListeneri(ALenum pname, ALint *value);</pre>
+ *
+ * @param pname the nameof the attribute to be retrieved
+ *
+ * @return the retrieved value
+ */
+ public int alGetListeneri(int pname);
+
+ // STATE RELATED METHODS
+
+ /**
+ * This method enables a feature of the OpenAL driver. Note: at this time
+ * there are no features to be enabled with this feature.<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alDisable(ALenum cpability);</pre>
+ *
+ * @param capability the name of the capbility to be enabled.
+ */
+
+ public void alEnable(int capability);
+
+ /**
+ * This method disables a feature of the OpenAL driver. Note: at this time
+ * there are no features to be disabled with this feature.<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alDisable(ALenum cpability);</pre>
+ *
+ * @param capability the name of the capbility to be disabled.
+ */
+ public void alDisable(int capability);
+
+ /**
+ * This method returns a bolean indicating if a specific feature is enabled
+ * in the OpenAL driver. Note: At this time this function always returns
+ * false, as there are no capabilities to be enabled<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALboolean alIsEnabled(ALenum cpability);</pre>
+ *
+ * @param capability the name of the capability to check
+ *
+ * @return true, if the capability is enabled,
+ * false if the capability is disabled.
+ */
+ public boolean alIsEnabled(int capability);
+
+ /**
+ * This method returs a boolean OpenAL state. Note: there are no
+ * boolean state values at this time.<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALboolean alGetBoolean(ALenum pname);</pre>
+ *
+ * @param pname the state to be queried
+ *
+ * @return the state described by pname
+ */
+ public boolean alGetBoolean(int pname);
+
+ /**
+ * This method returns a double precision loating point OpenAL state.
+ * Note at the time there are no double stat values.<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALdouble alGetDouble(ALEnum pname);</pre>
+ *
+ * @param pname the state to be queried
+ *
+ * @return the sate described by pname
+ */
+ public double alGetDouble(int pname);
+
+ /**
+ * This method returns a floating point OpenAL state. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALfoat alGetFloat(ALenum pname);</pre>
+ *
+ * @param pname the sateto be queried:
+ * <pre>
+ * AL_DOPPLER_FACTOR
+ * AL_DOPPLER_VELOCITY
+ * </pre>
+ *
+ * @return the state described by pname
+ */
+ public float alGetFloat(int pname);
+
+ /**
+ * This method returns an integer OpenAL state. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALint alGetInteger(ALenum pname);</pre>
+ *
+ * @param pname the name of the state to be queried:
+ * <pre>
+ * AL_DISTANCE_MODEL
+ * </pre>
+ * @return the state described by pname
+ */
+ public int alGetInteger(int pname);
+
+ // No Boolean Array states at the moment
+ // public void getBooleanv(int pname, ByteBuffer value);
+
+ /**
+ * This function retrieves a boolean OpenAL state. Note: at this time
+ * there are no boolean state variables<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetBooleanv(ALenum pname, ALboolean *value);</pre>
+ *
+ * @param pname the name of the state to be retrieved
+ * @param value a single element array to hold the retrieved state
+ */
+ public void alGetBooleanv(int pname, boolean[] value);
+
+ /**
+ * This method retrieves a double precision floating point OpenAL state.
+ * Note: there are no double precision floating point states at this time.
+ * <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetDoublev(ALenum, ALdouble *value);</pre>
+ *
+ * @param pname the state to be retrieved
+ * @param value a DoubleBuffer to hold the retrieved state
+ */
+// public void alGetDoublev(int pname, DoubleBuffer value);
+
+ /**
+ * This method retrieves a double precision floating point OpenAL state.
+ * Note: there are no double precision floating point states at this time.
+ * <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetDoublev(ALenum, ALdouble *value);</pre>
+ *
+ * @param pname the state to be retrieved
+ * @param value a single element array to hold the retrieved state
+ */
+ public void alGetDoublev(int pname, double[] value);
+
+ /**
+ * This method returns a floating point OpenAL state. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetFloatv(ALenum pname, ALfloat *value);</pre>
+ *
+ * @param pname the state to be retrieved
+ * <pre>
+ * AL_DOPPLER_FACTOR
+ * AL_DOPPLER_VELOCITY
+ * </pre>
+ * @param value a single element FloatBuffer to hold the retrieved value.
+ */
+// public void alGetFloatv(int pname, FloatBuffer value);
+
+ /**
+ * This method returns a floating point OpenAL state. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetFloatv(ALenum pname, ALfloat *value);</pre>
+ *
+ * @param pname the state to be retrieved
+ * <pre>
+ * AL_DOPPLER_FACTOR
+ * AL_DOPPLER_VELOCITY
+ * </pre>
+ * @param value a single element float array to hold the retrieved value.
+ */
+ public void alGetFloatv(int pname, float[] value);
+
+ /**
+ * This method returns an integer OpenAL state. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetIntegerv(ALenum pname, ALint *data);</pre>
+ *
+ * @param pname the state to be returned:
+ * <pre>
+ * AL_DISTANCE_MODEL
+ * </pre>
+ * @param value a single-element IntBuffer to hold the retrieved value
+ */
+ //public void alGetIntegerv(int pname, IntBuffer value);
+
+ /**
+ * This method returns an integer OpenAL state. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alGetIntegerv(ALenum pname, ALint *data);</pre>
+ *
+ * @param pname the state to be returned:
+ * <pre>
+ * AL_DISTANCE_MODEL
+ * </pre>
+ * @param value a single-element array to hold the retrieved value
+ */
+ public void alGetIntegerv(int pname, int[] value);
+
+ /**
+ * This method retrieves an OpenAL string property. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALubyte* alGetString(int pname);</pre>
+ *
+ * @param pname the name of the state to be retrieved
+ *
+ * @return the retrieved state
+ */
+ public String alGetString(int pname);
+
+ /**
+ * This method selects the OpenAL distance model.
+ * The default distance model is AL_INVERSE_DISTANCE<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alDistanceModel(ALenum value);</pre>
+ *
+ * @param model the distance model to set:
+ * <pre>
+ * AL_NONE
+ * AL_INVERSE_DISTANCE
+ * AL_INVERSE_DISTANCE_CLAMPED
+ * </pre>
+ */
+ public void alDistanceModel(int model);
+
+ /**
+ * This method selects the OpenAL Doppler factor value.
+ * The default value is 1.0<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alDopplerFactor(ALfloat value);</pre>
+ *
+ * @param value the Doppler scale value to set
+ */
+ public void alDopplerFactor(float value);
+
+ /**
+ * This method selects the OpenAL Doppler velocity value.
+ * The default Doppler velocity value is 343.0<b>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alDopplerVelocity(ALfloat value);</pre>
+ *
+ * @param value The Doppler velocity value to set.
+ */
+ public void alDopplerVelocity(float value);
+
+ // ERROR RELATED METHODS
+
+ /**
+ * This method returns the current error state and then clears the
+ * error state. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALenum alGetError(ALvoid);</pre>
+ *
+ * @return the current error state
+ */
+ public int alGetError();
+
+ // EXTENSION RELATED METHODS
+ /**
+ * This ehod tests is a specific extension is available
+ * for the OpenAL driver. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALboolean alIsExtensionPresent(ALubyte *extName);</pre>
+ *
+ * @param extName a string describing the desired extension
+ *
+ * @return true if the extension is available,
+ * false if the extension is not available.
+ */
+ public boolean alIsExtensionPresent(String extName);
+
+ // public Method getProcAddress(String methodName);
+ /**
+ * This method returns the enumeration value of an OpenAL enum
+ * described by a string. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALenum alGetEnumValue(ALubyte *enumName);</pre>
+ *
+ * @param enumName a string describing an OpenAL constant
+ *
+ * @return the actual constant for the described constant.
+ */
+ public int alGetEnumValue(String enumName);
+}
diff --git a/src/java/net/java/games/joal/ALC.java b/src/java/net/java/games/joal/ALC.java
new file mode 100644
index 0000000..bb53bc5
--- /dev/null
+++ b/src/java/net/java/games/joal/ALC.java
@@ -0,0 +1,259 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal;
+
+/**
+ * This class contains the context-related OpenAL functions.
+ *
+ * @author Athomas Goldberg
+ */
+public interface ALC extends ALCConstants {
+ /**
+ * This method opens a device by name. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALCdevice* alcOpenDevice(const ALubyte *token);</pre>
+ *
+ * @param deviceName a string describing the device
+ *
+ * @return an ALC.Device object for the opened device
+ */
+ public Device alcOpenDevice(String deviceName);
+
+ /**
+ * This method closes a device by name. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>void alcCloseDevice ALCDevice *dev);</pre>
+ *
+ * @param device the opened device to close
+ */
+ public void alcCloseDevice(Device device);
+
+ /**
+ * This method creates a context using a specified device. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>void alcCreateContext(ALCdevice *dev, ALint* attrList);</pre>
+ *
+ * @param device an opened device
+ * @param attrs a set of attributes:
+ * <pre>
+ * ALC_FREQUENCY
+ * ALC_REFRESH
+ * ALC_SYNC
+ * </pre>
+ *
+ * @return a context for the specified device.
+ */
+ public Context alcCreateContext(Device device, int[] attrs);
+
+ /**
+ * This method makes the specified context the current context.<br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALCEnum alcMakeContextCurrent(ALvoid *alcHandle);</pre>
+ *
+ * @param context the new context
+ *
+ * @return an error code on failure
+ */
+ public int alcMakeContextCurrent(Context context);
+
+ /**
+ * This method tells a context to begin processing. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>void alcProcessContext(ALvoid *alHandle);</pre>
+ *
+ * @param context the context to be processed
+ */
+ public void alcProcessContext(Context context);
+
+ /**
+ * This method suspends processing on the current context. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>void alcSusendContext(ALvoid *alcHandle);</pre>
+ *
+ * @param context the context to be suspended.
+ */
+ public void alcSuspendContext(Context context);
+
+ /**
+ * This method destroys a context. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALCEnum alcDestroyContext(ALvoid *alcHandle);</pre>
+ *
+ * @param context the context to be destroyed
+ */
+ public void alcDestroyContext(Context context);
+
+ /**
+ * This method retrieves the current context error state. <br>
+ * <br>
+ *<b>Interface to C Language function:</b>
+ * <pre>ALCEnum alcGetError(ALvoid);</pre>
+ * @return the current context error state
+ */
+ public int alcGetError();
+
+ /**
+ * This method retrieves the current context. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>void* alcGetCurrentContext(ALvoid);</pre>
+ *
+ * @return the current context
+ */
+ public Context alcGetCurrentContext();
+
+ /**
+ * This method returns the Device associated with the given context. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALCdevice* alcGetContextDevice(ALvoid *alcHandle);</pre>
+ *
+ * @param context the context whose device is being queried
+ *
+ * @return the device associated with the specified context.
+ */
+ public Device alcGetContextsDevice(Context context);
+
+ /**
+ * This method queries if a specified context extension is available. <br>
+ * <br>
+ *<b>Interface to C Language function:</b>
+ * <pre>ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName);</pre>
+ *
+ * @param device the device to be queried for an extension
+ * @param extName a string describing the extension
+ *
+ * @return true is the extension is available,
+ * false if the extension is not available
+ */
+ public boolean alcIsExtensionPresent(Device device, String extName);
+
+ // public Method getProcAddress(Device device, String funcName);
+ /**
+ * This method retrieves the constant value for a specified constant name. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName);</pre>
+ *
+ * @param device the device to be queried for the constant (?)
+ * @param enumName a string representation of the constant name
+ *
+ * @return the constant value associated with the string representation
+ * of the name
+ */
+ public int alcGetEnumValue(Device device, String enumName);
+
+ /**
+ * This method returns Strings related to the context. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALubyte* alcGetString(ALCDevice *device, ALenum pname);</pre>
+ *
+ * @param device the device to be queried
+ * @param attribute the attribute to be retrieved:
+ * <pre>
+ * ALC_DEFAULT_DEVICE_SPECIFIER
+ * ALC_DEVICE_SPECIFIER
+ * ALC_EXTENSIONS
+ * </pre>
+ *
+ * @return the string value of the attribute
+ */
+ public String alcGetString(Device device, int attribute);
+
+ /**
+ * This method retrieves integer properties related to the context. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALvoid alcGetIntegerv(ALCdevice *device, ALenum token, ALsizei n, ALint *data);</pre>
+ *
+ * @param device the device to be queried
+ * @param attribute the attribute to be retrieved
+ * @param size the size of the destination array provided
+ * @param retValue an array to hold the data to be returned.
+ *
+ */
+ public void alcGetIntegerv(
+ Device device,
+ int attribute,
+ int size,
+ int[] retValue);
+
+ /**
+ * This class provides a reference to an OpenAL device
+ *
+ */
+ public class Device {
+ final int pointer;
+
+ Device(int pointer) {
+ this.pointer = pointer;
+ }
+
+ public int hashCode() {
+ return (int) pointer;
+ }
+
+ public boolean equals(Object obj) {
+ boolean result = false;
+
+ if (obj instanceof Device && (obj.hashCode() == pointer)) {
+ result = true;
+ }
+
+ return result;
+ }
+ }
+
+ /**
+ * This class provides a reference to an OpenAL context
+ *
+ */
+ public static class Context {
+ final ALC alcContext;
+ final int pointer;
+
+ Context(ALC impl, int pointer) {
+ this.pointer = pointer;
+ this.alcContext = impl;
+ }
+ }
+}
diff --git a/src/java/net/java/games/joal/ALCConstants.java b/src/java/net/java/games/joal/ALCConstants.java
new file mode 100644
index 0000000..47d0754
--- /dev/null
+++ b/src/java/net/java/games/joal/ALCConstants.java
@@ -0,0 +1,95 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*
+* Created on Jun 6, 2003
+*/
+
+package net.java.games.joal;
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public interface ALCConstants {
+ /* Boolean False. */
+ public final static int ALC_FALSE = 0;
+
+ /* Boolean True. */
+ public final static int ALC_TRUE = 1;
+
+ /** Errors: No Error. */
+ public final static int ALC_NO_ERROR = ALC_FALSE;
+
+ public final static int ALC_MAJOR_VERSION = 0x1000;
+ public final static int ALC_MINOR_VERSION = 0x1001;
+ public final static int ALC_ATTRIBUTES_SIZE = 0x1002;
+ public final static int ALC_ALL_ATTRIBUTES = 0x1003;
+
+ public final static int ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004;
+ public final static int ALC_DEVICE_SPECIFIER = 0x1005;
+ public final static int ALC_EXTENSIONS = 0x1006;
+
+ public final static int ALC_FREQUENCY = 0x1007;
+ public final static int ALC_REFRESH = 0x1008;
+ public final static int ALC_SYNC = 0x1009;
+
+ /**
+ * The device argument does not name a valid dvice.
+ */
+ public final static int ALC_INVALID_DEVICE = 0xA001;
+
+ /**
+ * The context argument does not name a valid context.
+ */
+ public final static int ALC_INVALID_CONTEXT = 0xA002;
+
+ /**
+ * A function was called at inappropriate time,
+ * or in an inappropriate way, causing an illegal state.
+ * This can be an incompatible ALenum, object ID,
+ * and/or function.
+ */
+ public final static int ALC_INVALID_ENUM = 0xA003;
+
+ /**
+ * Illegal value passed as an argument to an AL call.
+ * Applies to parameter values, but not to enumerations.
+ */
+ public final static int ALC_INVALID_VALUE = 0xA004;
+
+ /**
+ * A function could not be completed,
+ * because there is not enough memory available.
+ */
+ public final static int ALC_OUT_OF_MEMORY = 0xA005;
+
+}
diff --git a/src/java/net/java/games/joal/ALCImpl.java b/src/java/net/java/games/joal/ALCImpl.java
new file mode 100644
index 0000000..ca180ef
--- /dev/null
+++ b/src/java/net/java/games/joal/ALCImpl.java
@@ -0,0 +1,177 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal;
+
+import java.util.HashMap;
+
+final class ALCImpl implements ALC {
+ private final HashMap contextMap = new HashMap();
+
+ ALCImpl() {
+ System.loadLibrary("joal");
+ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+ public void run() {
+ exit();
+ }
+ }));
+ }
+
+ public Device alcOpenDevice(String deviceName) {
+ Device result = null;
+ result = new Device(openDeviceNative(deviceName));
+
+ return result;
+ }
+
+ private native int openDeviceNative(String deviceName);
+
+ public void alcCloseDevice(Device device) {
+ closeDeviceNative(device.pointer);
+ }
+
+ private native void closeDeviceNative(int pointer);
+
+ public Context alcCreateContext(Device device, int[] attrs) {
+ Context result = null;
+ int pointer = createContextNative(device.pointer, attrs);
+ if (pointer != 0) {
+ result = new Context(this, pointer);
+ contextMap.put(new Integer(pointer), result);
+ }
+ return result;
+ }
+
+ private native int createContextNative(int pointer, int[] attrs);
+
+ public int alcMakeContextCurrent(Context context) {
+ int result = 0;
+ int pointer = 0;
+
+ if (context != null) {
+ pointer = context.pointer;
+ }
+
+ result = makeContextCurrentNative(pointer);
+
+ return result;
+ }
+
+ private native int makeContextCurrentNative(int pointer);
+
+ public void alcProcessContext(Context context) {
+ processContextNative(context.pointer);
+ }
+
+ private native void processContextNative(int pointer);
+
+ public void alcSuspendContext(Context context) {
+ suspendContextNative(context.pointer);
+ }
+
+ private native void suspendContextNative(int pointer);
+
+ public void alcDestroyContext(Context context) {
+ destroyContextNative(context.pointer);
+ }
+
+ private native void destroyContextNative(int pointer);
+
+ public native int alcGetError();
+
+ public Context alcGetCurrentContext() {
+ Context result = null;
+ int pointer = getCurrentContextNative();
+ result = (Context) contextMap.get(new Integer(pointer));
+ return result;
+ }
+
+ private native int getCurrentContextNative();
+
+ public boolean alcIsExtensionPresent(Device device, String extName) {
+ boolean result = false;
+
+ return result;
+ }
+
+ // public Method getProcAddress(Device device, String funcName);
+ public int alcGetEnumValue(Device device, String enumName) {
+ return getEnumValueNative(device.pointer, enumName);
+ }
+
+ private native int getEnumValueNative(int pointer, String enumValue);
+
+ public String alcGetString(Device device, int attribute) {
+ String result = null;
+ result = alcGetStringNative(device.pointer, attribute);
+ return result;
+ }
+
+ private native String alcGetStringNative(int pointer, int attribute);
+
+ public void alcGetIntegerv(
+ Device device,
+ int attribute,
+ int size,
+ int[] array) {
+ alcGetIntegervNative(device.pointer, attribute, size, array);
+ }
+
+ private native void alcGetIntegervNative(
+ int pointer,
+ int attr,
+ int size,
+ int[] arr);
+
+ public Device alcGetContextsDevice(Context context) {
+ Device result = null;
+ int devicePtr = getContextDeviceNative(context.pointer);
+ Device device = new ALC.Device(devicePtr);
+
+ return result;
+ }
+
+ private native int getContextDeviceNative(int context);
+
+ private void exit() {
+
+ Context alcContext = alcGetCurrentContext();
+
+ if (alcContext != null) {
+ Device alcDevice = alcGetContextsDevice(alcContext);
+ alcMakeContextCurrent(null);
+ alcDestroyContext(alcContext);
+ alcCloseDevice(alcDevice);
+ }
+ }
+}
diff --git a/src/java/net/java/games/joal/ALConstants.java b/src/java/net/java/games/joal/ALConstants.java
new file mode 100644
index 0000000..4ee8e3f
--- /dev/null
+++ b/src/java/net/java/games/joal/ALConstants.java
@@ -0,0 +1,348 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal;
+
+/**
+ * This interface contains the standard constants used by OpenAL
+ * @author Athomas Goldberg
+ */
+public interface ALConstants {
+
+ /** Bad value */
+ public static final int AL_INVALID = -1;
+
+ /** Disable value */
+ public static final int AL_NONE = 0;
+
+ /** Boolean False */
+ public static final int AL_FALSE = 0;
+
+ /** Boolean True */
+ public static final int AL_TRUE = 1;
+
+ /**
+ * Indicate the type of SOURCE.
+ * Sources can be spatialized
+ */
+ public static final int AL_SOURCE_TYPE = 0x200;
+
+ /** Indicate source has absolute coordinates */
+ public static final int AL_SOURCE_ABSOLUTE = 0x201;
+
+ /** Indicate Source has listener relative coordinates */
+ public static final int AL_SOURCE_RELATIVE = 0x202;
+
+ /**
+ * Directional source, inner cone angle, in degrees
+ * Range: [0-360]
+ * Default: 360
+ */
+ public static final int AL_CONE_INNER_ANGLE = 0x1001;
+
+ /**
+ * Directional source, outer cone angle, in degrees.
+ * Range: [0-360]
+ * Default: 360
+ */
+ public static final int AL_CONE_OUTER_ANGLE = 0x1002;
+
+ /**
+ * Specify the pitch to be applied, either at source,
+ * or on mixer results, at listener.
+ * Range: [0.5-2.0]
+ * Default: 1.0
+ */
+ public static final int AL_PITCH = 0x1003;
+
+ /**
+ * Specify the current location in three dimensional space.
+ * OpenAL, like OpenGL, uses a right handed coordinate system,
+ * where in a frontal default view X (thumb) points right,
+ * Y points up (index finger), and Z points towards the
+ * viewer/camera (middle finger).
+ * To switch from a left handed coordinate system, flip the
+ * sign on the Z coordinate.
+ * Listener position is always in the world coordinate system.
+ */
+ public static final int AL_POSITION = 0x1004;
+
+ /** Specify the current direction as forward vector. */
+ public static final int AL_DIRECTION = 0x1005;
+
+ /** Specify the current velocity in three dimensional space. */
+ public static final int AL_VELOCITY = 0x1006;
+
+ /**
+ * Indicate whether source has to loop infinite.
+ * Type: ALboolean
+ * Range: [AL_TRUE, AL_FALSE]
+ * Default: AL_FALSE
+ */
+ public static final int AL_LOOPING = 0x1007;
+
+ /**
+ * Indicate the buffer to provide sound samples.
+ * Type: ALuint.
+ * Range: any valid Buffer id.
+ */
+ public static final int AL_BUFFER = 0x1009;
+
+ /**
+ * Indicate the gain (volume amplification) applied.
+ * Type: ALfloat.
+ * Range: ]0.0- ]
+ * A value of 1.0 means un-attenuated/unchanged.
+ * Each division by 2 equals an attenuation of -6dB.
+ * Each multiplicaton with 2 equals an amplification of +6dB.
+ * A value of 0.0 is meaningless with respect to a logarithmic
+ * scale; it is interpreted as zero volume - the channel
+ * is effectively disabled.
+ */
+ public static final int AL_GAIN = 0x100A;
+
+ /**
+ * Indicate minimum source attenuation.
+ * Type: ALfloat
+ * Range: [0.0 - 1.0]
+ */
+ public static final int AL_MIN_GAIN = 0x100D;
+
+ /**
+ * Indicate maximum source attenuation.
+ * Type: ALfloat
+ * Range: [0.0 - 1.0]
+ */
+ public static final int AL_MAX_GAIN = 0x100E;
+
+ /**
+ * Specify the current orientation.
+ * Type: ALfv6 (at/up)
+ * Range: N/A
+ */
+ public static final int AL_ORIENTATION = 0x100F;
+
+ /* byte offset into source (in canon format). -1 if source
+ * is not playing. Don't set this, get this.
+ *
+ * Type: ALfloat
+ * Range: [0.0 - ]
+ * Default: 1.0
+ */
+ public static final int AL_REFERENCE_DISTANCE = 0x1020;
+
+ /**
+ * Indicate the rolloff factor for the source.
+ * Type: ALfloat
+ * Range: [0.0 - ]
+ * Default: 1.0
+ */
+ public static final int AL_ROLLOFF_FACTOR = 0x1021;
+
+ /**
+ * Indicate the gain (volume amplification) applied.
+ * Type: ALfloat.
+ * Range: ]0.0- ]
+ * A value of 1.0 means un-attenuated/unchanged.
+ * Each division by 2 equals an attenuation of -6dB.
+ * Each multiplicaton with 2 equals an amplification of +6dB.
+ * A value of 0.0 is meaningless with respect to a logarithmic
+ * scale; it is interpreted as zero volume - the channel
+ * is effectively disabled.
+ */
+ public static final int AL_CONE_OUTER_GAIN = 0x1022;
+
+ /**
+ * Specify the maximum distance.
+ * Type: ALfloat
+ * Range: [0.0 - ]
+ */
+ public static final int AL_MAX_DISTANCE = 0x1023;
+
+ /**
+ * Specify the channel mask. (Creative)
+ * Type: ALuint
+ * Range: [0 - 255]
+ */
+ public static final int AL_CHANNEL_MASK = 0x3000;
+
+ /** Source state information */
+ public static final int AL_SOURCE_STATE = 0x1010;
+
+ /** Source state information */
+ public static final int AL_INITIAL = 0x1011;
+
+ /** Source state information */
+ public static final int AL_PLAYING = 0x1012;
+
+ /** Source state information */
+ public static final int AL_PAUSED = 0x1013;
+
+ /** Source state information */
+ public static final int AL_STOPPED = 0x1014;
+
+ /** Buffer Queue params */
+ public static final int AL_BUFFERS_QUEUED = 0x1015;
+
+ /** Buffer Queue params */
+ public static final int AL_BUFFERS_PROCESSED = 0x1016;
+
+ /** Sound buffers: format specifier. */
+ public static final int AL_FORMAT_MONO8 = 0x1100;
+
+ /** Sound buffers: format specifier. */
+ public static final int AL_FORMAT_MONO16 = 0x1101;
+
+ /** Sound buffers: format specifier. */
+ public static final int AL_FORMAT_STEREO8 = 0x1102;
+
+ /** Sound buffers: format specifier. */
+ public static final int AL_FORMAT_STEREO16 = 0x1103;
+
+ /**
+ * Sound buffers: frequency, in units of Hertz [Hz].
+ * This is the number of samples per second. Half of the
+ * sample frequency marks the maximum significant
+ * frequency component.
+ */
+ public static final int AL_FREQUENCY = 0x2001;
+
+ /**
+ * Sound buffers: frequency, in units of Hertz [Hz].
+ * This is the number of samples per second. Half of the
+ * sample frequency marks the maximum significant
+ * frequency component.
+ */
+ public static final int AL_BITS = 0x2002;
+
+ /**
+ * Sound buffers: frequency, in units of Hertz [Hz].
+ * This is the number of samples per second. Half of the
+ * sample frequency marks the maximum significant
+ * frequency component.
+ */
+ public static final int AL_CHANNELS = 0x2003;
+
+ /**
+ * Sound buffers: frequency, in units of Hertz [Hz].
+ * This is the number of samples per second. Half of the
+ * sample frequency marks the maximum significant
+ * frequency component.
+ */
+ public static final int AL_SIZE = 0x2004;
+
+ /**
+ * Sound buffers: frequency, in units of Hertz [Hz].
+ * This is the number of samples per second. Half of the
+ * sample frequency marks the maximum significant
+ * frequency component.
+ */
+ public static final int AL_DATA = 0x2005;
+
+ /**
+ * Buffer state.
+ *
+ * Not supported for public use (yet).
+ */
+ public static final int AL_UNUSED = 0x2010;
+
+ /**
+ * Buffer state.
+ *
+ * Not supported for public use (yet).
+ */
+ public static final int AL_PENDING = 0x2011;
+
+ /**
+ * Buffer state.
+ *
+ * Not supported for public use (yet).
+ */
+ public static final int AL_PROCESSED = 0x2012;
+
+ /** Errors: No Error. */
+ public static final int AL_NO_ERROR = AL_FALSE;
+
+ /** Illegal name passed as an argument to an AL call. */
+ public static final int AL_INVALID_NAME = 0xA001;
+
+ /** Illegal enum passed as an argument to an AL call. */
+ public static final int AL_INVALID_ENUM = 0xA002;
+
+ /**
+ * Illegal value passed as an argument to an AL call.
+ * Applies to parameter values, but not to enumerations.
+ */
+ public static final int AL_INVALID_VALUE = 0xA003;
+
+ /**
+ * A function was called at inappropriate time,
+ * or in an inappropriate way, causing an illegal state.
+ * This can be an incompatible ALenum, object ID,
+ * and/or function.
+ */
+ public static final int AL_INVALID_OPERATION = 0xA004;
+
+ /**
+ * A function could not be completed,
+ * because there is not enough memory available.
+ */
+ public static final int AL_OUT_OF_MEMORY = 0xA005;
+
+ /** Context strings: Vendor */
+ public static final int AL_VENDOR = 0xB001;
+
+ /** Context strings: Version */
+ public static final int AL_VERSION = 0xB002;
+
+ /** Context strings: Renderer */
+ public static final int AL_RENDERER = 0xB003;
+
+ /** Context strings: Extensions */
+ public static final int AL_EXTENSIONS = 0xB004;
+
+ /** Doppler scale. Default 1.0 */
+ public static final int AL_DOPPLER_FACTOR = 0xC000;
+
+ /** Doppler velocity. Default 1.0 */
+ public static final int AL_DOPPLER_VELOCITY = 0xC001;
+
+ /** Distance model. Default AL_INVERSE_DISTANCE_CLAMPED */
+ public static final int AL_DISTANCE_MODEL = 0xD000;
+
+ /** Distance model */
+ public static final int AL_INVERSE_DISTANCE = 0xD001;
+
+ /** Distance model */
+ public static final int AL_INVERSE_DISTANCE_CLAMPED = 0xD002;
+} \ No newline at end of file
diff --git a/src/java/net/java/games/joal/ALFactory.java b/src/java/net/java/games/joal/ALFactory.java
new file mode 100644
index 0000000..70b6fd8
--- /dev/null
+++ b/src/java/net/java/games/joal/ALFactory.java
@@ -0,0 +1,105 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal;
+
+/**
+ * This class provides factory methods for generating AL and ALC objects. The
+ * class must be initialized before use, and should be deinitialized when OpenAL
+ * functionality is no longer needed to free up native resources.
+ *
+ * @author Athomas Goldberg
+ */
+public class ALFactory {
+ static {
+ System.loadLibrary("joal");
+ }
+
+ private static boolean isInitialized;
+ private static ALImpl al;
+ private static ALC alc;
+
+ /**
+ * Initialize the OpenAL environment
+ *
+ * @return true is OpenAL was able to initialize,
+ * false if OpenAL was not able to intialize
+ */
+ public static boolean initialize() {
+ String osProperty = System.getProperty("os.name");
+ if(osProperty.startsWith("Win")) {
+ isInitialized = init(new String[] { "OpenAL32.dll" });
+ } else {
+ // Linux & OSX
+ }
+ return isInitialized;
+ }
+
+ private static native boolean init(String[] oalPaths);
+
+ /**
+ * Deinitialize the OpenAL environment
+ *
+ * @return true if OpenAL was able to be deinitialized,
+ * false if OpenAL uas unable to be deinitialized
+ */
+ public static native boolean deinitialize();
+
+ /**
+ * Get the default AL object. This object is used to access most of the
+ * OpenAL functionality.
+ *
+ * @return the AL object
+ */
+ public static AL getAL() {
+ if (al == null) {
+ al = new ALImpl();
+ }
+
+ return al;
+ }
+
+ /**
+ * Get the default ALC object. This object is used to access most of the
+ * OpenAL context functionality.
+ *
+ * @return the ALC object
+ */
+ public static ALC getALC() {
+ if (alc == null) {
+ alc = new ALCImpl();
+ }
+
+ return alc;
+ }
+}
diff --git a/src/java/net/java/games/joal/ALImpl.java b/src/java/net/java/games/joal/ALImpl.java
new file mode 100644
index 0000000..9ac8301
--- /dev/null
+++ b/src/java/net/java/games/joal/ALImpl.java
@@ -0,0 +1,905 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal;
+
+import java.nio.ByteBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+
+
+final class ALImpl implements AL {
+ ALImpl() {
+ System.loadLibrary("joal");
+ }
+
+ // AL_BUFFER RELATED METHODS
+
+ public void alGenBuffers(int n, IntBuffer buffers) {
+ if (
+ (buffers == null) ||
+ !buffers.isDirect() ||
+ (n > buffers.capacity())
+ ) {
+ throw new IllegalArgumentException(
+ "buffers must be direct, can not be null" +
+ " and buffer capacity must be greater than requested number of " +
+ "buffers."
+ );
+ } else {
+ alGenBuffersNative(n, buffers);
+ }
+ }
+
+ private native void alGenBuffersNative(int n, IntBuffer buffers);
+
+ public void alGenBuffers(int n, int[] buffers) {
+ if ((buffers == null) || (n > buffers.length)) {
+ throw new IllegalArgumentException(
+ "buffers can not be null" +
+ " and array length must be greater than requested number of " +
+ "buffers."
+ );
+ } else {
+ alGenBuffersNative(n, buffers);
+ }
+ }
+
+ private native void alGenBuffersNative(int n, int[] buffers);
+
+ public void alDeleteBuffers(int n, IntBuffer buffers) {
+ if (
+ (buffers == null) ||
+ !buffers.isDirect() ||
+ (n > buffers.capacity())
+ ) {
+ throw new IllegalArgumentException(
+ "buffers must be direct, can not be null" +
+ " and buffer capacity must be greater than requested number of " +
+ "buffers."
+ );
+ } else {
+ alDeleteBuffersNative(n, buffers);
+ }
+ }
+
+ private native void alDeleteBuffersNative(int n, IntBuffer buffers);
+
+ public void alDeleteBuffers(int n, int[] buffers) {
+ if ((buffers == null) || (n > buffers.length)) {
+ throw new IllegalArgumentException(
+ "buffers can not be null" +
+ " and array length must be greater than requested number of " +
+ "buffers."
+ );
+ } else {
+ alDeleteBuffersNative(n, buffers);
+ }
+ }
+
+ private native void alDeleteBuffersNative(int n, int[] buffers);
+
+ public native boolean alIsBuffer(int bufferName);
+
+ public void alBufferData(
+ int buffername,
+ int format,
+ byte[] data,
+ int size,
+ int frequency
+ ) {
+ if (data == null) {
+ throw new IllegalArgumentException("data must not be null");
+ } else {
+ alBufferDataNative(buffername, format, data, size, frequency);
+ }
+ }
+
+ private native void alBufferDataNative(
+ int buffername,
+ int format,
+ byte[] data,
+ int size,
+ int frequency
+ );
+
+ public void alBufferData(
+ int buffername,
+ int format,
+ ByteBuffer data,
+ int size,
+ int frequency
+ ) {
+ if ((data == null) || !data.isDirect()) {
+ throw new IllegalArgumentException(
+ "data must be a direct, non-null buffer"
+ );
+ } else {
+ alBufferDataNative(buffername, format, data, size, frequency);
+ }
+ }
+
+ private native void alBufferDataNative(
+ int buffername,
+ int format,
+ ByteBuffer data,
+ int size,
+ int frequency
+ );
+
+ public void alGetBufferf(int bufferName, int pname, float[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException(
+ "Return Value argument must not be null."
+ );
+ } else {
+ alGetBufferfNative(bufferName, pname, retValue);
+ }
+ }
+
+ private native void alGetBufferfNative(
+ int bufferName,
+ int pname,
+ float[] retValue
+ );
+
+ public void alGetBufferf(int bufferName, int pname, FloatBuffer retValue) {
+ if ((retValue == null) || !retValue.isDirect()) {
+ throw new IllegalArgumentException(
+ "Return Value argument must be a direct, non-null buffer"
+ );
+ } else {
+ alGetBufferfNative(bufferName, pname, retValue);
+ }
+ }
+
+ private native void alGetBufferfNative(
+ int bufferName,
+ int pname,
+ FloatBuffer retValue
+ );
+
+ public native float alGetBufferf(int bufferName, int pname);
+
+ public void alGetBufferi(int bufferName, int pname, int[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException(
+ "Return Value argument must not be null"
+ );
+ } else {
+ alGetBufferiNative(bufferName, pname, retValue);
+ }
+ }
+
+ private native void alGetBufferiNative(
+ int bufferName,
+ int pname,
+ int[] retValue
+ );
+
+ public void alGetBufferi(int bufferName, int pname, IntBuffer retValue) {
+ if ((retValue == null) || !retValue.isDirect()) {
+ throw new IllegalArgumentException(
+ "Return Value argument must be a direct, non-null IntBuffer"
+ );
+ } else {
+ alGetBufferiNative(bufferName, pname, retValue);
+ }
+ }
+
+ private native void alGetBufferiNative(
+ int bufferName,
+ int pname,
+ IntBuffer retValue
+ );
+
+ public native int alGetBufferi(int bufferName, int pname);
+
+ // SOURCE RELATED METHODS
+ public void alGenSources(int numSources, int[] sources) {
+ if ((sources == null) || (numSources > sources.length)) {
+ throw new IllegalArgumentException(
+ "sources can not be null" +
+ " and array length must be greater than requested number of " +
+ "sources."
+ );
+ } else {
+ alGenSourcesNative(numSources, sources);
+ }
+ }
+
+ private native void alGenSourcesNative(int numSources, int[] sources);
+
+ public void alGenSources(int numSources, IntBuffer sources) {
+ if (
+ (sources == null) ||
+ !sources.isDirect() ||
+ (numSources > sources.capacity())
+ ) {
+ throw new IllegalArgumentException(
+ "sources buffer must be direct, can not be null" +
+ " and capacity must be greater than requested number of " +
+ "sources."
+ );
+ } else {
+ alGenSourcesNative(numSources, sources);
+ }
+ }
+
+ private native void alGenSourcesNative(int numSources, IntBuffer sources);
+
+ public void alDeleteSources(int numSources, int[] sources) {
+ if ((sources == null) || (numSources > sources.length)) {
+ throw new IllegalArgumentException(
+ "sources can not be null" +
+ " and array length must be greater than requested number of " +
+ "sources."
+ );
+ } else {
+ alDeleteSourcesNative(numSources, sources);
+ }
+ }
+
+ private native void alDeleteSourcesNative(int numSources, int[] sources);
+
+ public void alDeleteSources(int numSources, IntBuffer sources) {
+ if (
+ (sources == null) ||
+ !sources.isDirect() ||
+ (numSources > sources.capacity())
+ ) {
+ throw new IllegalArgumentException(
+ "sources buffer must be direct, can not be null" +
+ " and capacity must be greater than requested number of " +
+ "sources."
+ );
+ } else {
+ alDeleteSourcesNative(numSources, sources);
+ }
+ }
+
+ private native void alDeleteSourcesNative(
+ int numSources,
+ IntBuffer sources
+ );
+
+ public native boolean alIsSource(int sourceName);
+
+ public native void alSourcei(int sourcename, int pname, int value);
+
+ public native void alSourcef(int sourcename, int pname, float value);
+
+ public native void alSourcefv(int sourcename, int pname, float[] value);
+
+ public void alSourcefv(int sourcename, int pname, FloatBuffer value) {
+ if ((value != null) && !value.isDirect()) {
+ throw new IllegalArgumentException("buffer must be direct");
+ } else {
+ alSourcefvNative(sourcename, pname, value);
+ }
+ }
+
+ private native void alSourcefvNative(
+ int sourcename,
+ int pname,
+ FloatBuffer value
+ );
+
+ public native void alSource3f(
+ int sourcename,
+ int pname,
+ float v1,
+ float v2,
+ float v3
+ );
+
+ public void alGetSourcef(int sourcename, int pname, float[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException("retValue must not be null");
+ } else {
+ alGetSourcefNative(sourcename, pname, retValue);
+ }
+ }
+
+ private native void alGetSourcefNative(
+ int sourcename,
+ int pname,
+ float[] retValue
+ );
+
+ public void alGetSourcef(int sourceName, int pname, FloatBuffer buffer) {
+ if ((buffer == null) || !buffer.isDirect()) {
+ throw new IllegalArgumentException(
+ "Buffer must be direct and non-null"
+ );
+ } else {
+ alGetSourcefNative(sourceName, pname, buffer);
+ }
+ }
+
+ private native void alGetSourcefNative(
+ int sourceName,
+ int pname,
+ FloatBuffer buffer
+ );
+
+ public native float alGetSourcef(int sourceName, int pname);
+
+ public void alGetSourcefv(int sourcename, int pname, FloatBuffer value) {
+ if ((value == null) || !value.isDirect()) {
+ throw new IllegalArgumentException(
+ "Buffer must be direct and non-null"
+ );
+ } else {
+ alGetSourcefvNative(sourcename, pname, value);
+ }
+ }
+
+ private native void alGetSourcefvNative(
+ int sourcename,
+ int pname,
+ FloatBuffer value
+ );
+
+
+ public void alGetSourcefv(int sourcename, int pname, float[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException(
+ "retValue arg array must not be null"
+ );
+ } else {
+ alGetSourcefvNative(sourcename, pname, retValue);
+ }
+ }
+
+ private native void alGetSourcefvNative(
+ int sourcename,
+ int pname,
+ float[] retValue
+ );
+
+
+ public void alGetSourcei(int sourcename, int pname, int[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException(
+ "retValue arg array must not be null"
+ );
+ } else {
+ alGetSourceiNative(sourcename, pname, retValue);
+ }
+ }
+
+ private native void alGetSourceiNative(
+ int sourcename,
+ int pname,
+ int[] retValue
+ );
+
+ public void alGetSourcei(int sourcename, int pname, IntBuffer value) {
+ if ((value == null) || !value.isDirect()) {
+ throw new IllegalArgumentException(
+ "Buffer must be direct and non-null"
+ );
+ } else {
+ alGetSourceiNative(sourcename, pname, value);
+ }
+ }
+
+ private native void alGetSourceiNative(
+ int sourcename,
+ int pname,
+ IntBuffer retValue
+ );
+
+ public native int alGetSourcei(int sourcename, int pname);
+
+
+ public native void alSourcePlay(int sourcename);
+
+ public void alSourcePlayv(int numSources, int[] sourcenames) {
+ if ((sourcenames == null) || (numSources > sourcenames.length)) {
+ throw new IllegalArgumentException(
+ "sourcenames must be non-null" +
+ " and at least as large as the number of sources requested"
+ );
+ } else {
+ alSourcePlayvNative(numSources, sourcenames);
+ }
+ }
+
+ private native void alSourcePlayvNative(int numSources, int[] sourcenames);
+
+ public void alSourcePlayv(int numSources, IntBuffer sourcenames) {
+ if (
+ (sourcenames == null) ||
+ (numSources > sourcenames.capacity()) ||
+ !sourcenames.isDirect()
+ ) {
+ throw new IllegalArgumentException(
+ "sourcenames buffer must be direct, non-null and have a" +
+ " equals or greater capacity than the number of sources" +
+ " requested"
+ );
+ } else {
+ alSourcePlayvNative(numSources, sourcenames);
+ }
+ }
+
+ private native void alSourcePlayvNative(
+ int numSources,
+ IntBuffer sourcenames
+ );
+
+ public native void alSourcePause(int sourcename);
+
+ public void alSourcePausev(int numSources, int[] sourcenames) {
+ if ((sourcenames == null) || (numSources > sourcenames.length)) {
+ throw new IllegalArgumentException(
+ "sourcenames must be non-null" +
+ " and at least as large as the number of sources requested"
+ );
+ } else {
+ alSourcePausevNative(numSources, sourcenames);
+ }
+ }
+
+ private native void alSourcePausevNative(int numSources, int[] sourcenames);
+
+ public void alSourcePausev(int numSources, IntBuffer sourcenames) {
+ if (
+ (sourcenames == null) ||
+ (numSources > sourcenames.capacity()) ||
+ !sourcenames.isDirect()
+ ) {
+ throw new IllegalArgumentException(
+ "sourcenames buffer must be direct, non-null and have a" +
+ " equals or greater capacity than the number of sources" +
+ " requested"
+ );
+ } else {
+ alSourcePausevNative(numSources, sourcenames);
+ }
+ }
+
+ private native void alSourcePausevNative(
+ int numSources,
+ IntBuffer sourcenames
+ );
+
+ public native void alSourceStop(int sourcename);
+
+ public void alSourceStopv(int numSources, int[] sourcenames) {
+ if ((sourcenames == null) || (numSources > sourcenames.length)) {
+ throw new IllegalArgumentException(
+ "sourcenames must be non-null" +
+ " and at least as large as the number of sources requested"
+ );
+ } else {
+ alSourceStopvNative(numSources, sourcenames);
+ }
+ }
+
+ private native void alSourceStopvNative(int numSources, int[] sourcenames);
+
+ public void alSourceStopv(int numSources, IntBuffer sourcenames) {
+ if (
+ (sourcenames == null) ||
+ (numSources > sourcenames.capacity()) ||
+ !sourcenames.isDirect()
+ ) {
+ throw new IllegalArgumentException(
+ "sourcenames buffer must be direct, non-null and have a" +
+ " equals or greater capacity than the number of sources" +
+ " requested"
+ );
+ } else {
+ alSourcePlayvNative(numSources, sourcenames);
+ }
+ }
+
+ private native void alSourceStopvNative(
+ int numSources,
+ IntBuffer sourcenames
+ );
+
+ public native void alSourceRewind(int sourcename);
+
+ public void alSourceRewindv(int numSources, int[] sourcenames) {
+ if ((sourcenames == null) || (numSources > sourcenames.length)) {
+ throw new IllegalArgumentException(
+ "sourcenames must be non-null" +
+ " and at least as large as the number of sources requested"
+ );
+ } else {
+ alSourceRewindvNative(numSources, sourcenames);
+ }
+ }
+
+ private native void alSourceRewindvNative(
+ int numSources,
+ int[] sourcenames
+ );
+
+ public void alSourceRewindv(int numSources, IntBuffer sourcenames) {
+ if (
+ (sourcenames == null) ||
+ (numSources > sourcenames.capacity()) ||
+ !sourcenames.isDirect()
+ ) {
+ throw new IllegalArgumentException(
+ "sourcenames buffer must be direct, non-null and have a" +
+ " equals or greater capacity than the number of sources" +
+ " requested"
+ );
+ } else {
+ alSourceRewindvNative(numSources, sourcenames);
+ }
+ }
+
+ private native void alSourceRewindvNative(
+ int numSources,
+ IntBuffer sourcenames
+ );
+
+ public void alSourceQueueBuffers(
+ int sourcename,
+ int numBuffers,
+ int[] buffernames
+ ) {
+ if ((buffernames == null) || (numBuffers > buffernames.length)) {
+ throw new IllegalArgumentException(
+ "buffernames must be non-null and equal or greater " +
+ "than the numBuffers specified"
+ );
+ } else {
+ alSourceQueueBuffersNative(sourcename, numBuffers, buffernames);
+ }
+ }
+
+ private native void alSourceQueueBuffersNative(
+ int sourcename,
+ int numBuffers,
+ int[] buffernames
+ );
+
+ public void alSourceQueueBuffers(
+ int sourcename,
+ int numBuffers,
+ IntBuffer buffernames
+ ) {
+ if (
+ (buffernames == null) ||
+ !buffernames.isDirect() ||
+ (numBuffers > buffernames.capacity())
+ ) {
+ throw new IllegalArgumentException(
+ "only non-null, direct buffers of numBuffers capacity" +
+ " or greater may be used."
+ );
+ } else {
+ alSourceQueueBuffersNative(sourcename, numBuffers, buffernames);
+ }
+ }
+
+ private native void alSourceQueueBuffersNative(
+ int sourcename,
+ int numBuffers,
+ IntBuffer buffernames
+ );
+
+ public void alSourceUnqueueBuffers(
+ int sourcename,
+ int numBuffers,
+ int[] buffernames
+ ) {
+ if ((buffernames == null) || (numBuffers > buffernames.length)) {
+ throw new IllegalArgumentException(
+ "buffernames must be non-null and equal or greater " +
+ "than the numBuffers specified"
+ );
+ } else {
+ alSourceUnqueueBuffersNative(sourcename, numBuffers, buffernames);
+ }
+ }
+
+ private native void alSourceUnqueueBuffersNative(
+ int sourcename,
+ int numBuffers,
+ int[] buffernames
+ );
+
+ public void alSourceUnqueueBuffers(
+ int sourcename,
+ int numBuffers,
+ IntBuffer buffernames
+ ) {
+ if (
+ (buffernames == null) ||
+ !buffernames.isDirect() ||
+ (numBuffers > buffernames.capacity())
+ ) {
+ throw new IllegalArgumentException(
+ "only non-null, direct buffers of numBuffers capacity" +
+ " or greater may be used."
+ );
+ } else {
+ alSourceUnqueueBuffersNative(sourcename, numBuffers, buffernames);
+ }
+ }
+
+ private native void alSourceUnqueueBuffersNative(
+ int sourcename,
+ int numBuffers,
+ IntBuffer buffernames
+ );
+
+ // LISTENER RELATED METHODS
+ public native void alListenerf(int pname, float value);
+
+ public native void alListener3f(int pname, float v1, float v2, float v3);
+
+ public native void alListenerfv(int pname, float[] values);
+
+ public native void alListenerfv(int pname, FloatBuffer values);
+
+ public native void alListeneri(int pname, int value);
+
+ public void alGetListenerf(int pname, float[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException(
+ "retValue must be non-null array"
+ );
+ }
+ }
+
+ private native void alGetListenerfNative(int pname, float[] retValue);
+
+ public void alGetListenerf(int pname, FloatBuffer retValue) {
+ if ((retValue == null) || !retValue.isDirect()) {
+ throw new IllegalArgumentException(
+ "retValue must be a non-null direct buffer"
+ );
+ } else {
+ alGetListenerfNative(pname, retValue);
+ }
+ }
+
+ private native void alGetListenerfNative(int pname, FloatBuffer retValue);
+
+ public native float alGetListenerf(int pname);
+
+ public void alGetListener3f(
+ int pname,
+ FloatBuffer v1,
+ FloatBuffer v2,
+ FloatBuffer v3
+ ) {
+ if (
+ ((v1 == null) || !v1.isDirect()) ||
+ ((v2 == null) || !v2.isDirect()) ||
+ ((v3 == null) || !v3.isDirect())
+ ) {
+ throw new IllegalArgumentException(
+ "buffers must be non-null and direct"
+ );
+ } else {
+ alGetListener3fNative(pname, v1, v2, v3);
+ }
+ }
+
+ private native void alGetListener3fNative(
+ int pname,
+ FloatBuffer v1,
+ FloatBuffer v2,
+ FloatBuffer v3
+ );
+
+ public void alGetListener3f(int pname, float[] v1, float[] v2, float[] v3) {
+ if ((v1 == null) || (v2 == null) || (v3 == null)) {
+ throw new IllegalArgumentException("Arrays must be non-null");
+ } else {
+ alGetListener3fNative(pname, v1, v2, v3);
+ }
+ }
+
+ private native void alGetListener3fNative(
+ int pname,
+ float[] v1,
+ float[] v2,
+ float[] v3
+ );
+
+ public void alGetListenerfv(int pname, float[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException("Array must be non-null");
+ } else {
+ alGetListenerfvNative(pname, retValue);
+ }
+ }
+
+ private native void alGetListenerfvNative(int pname, float[] retValue);
+
+ public void alGetListenerfv(int pname, FloatBuffer retValue) {
+ if ((retValue == null) || !retValue.isDirect()) {
+ throw new IllegalArgumentException(
+ "Buffer must be non-null and direct"
+ );
+ } else {
+ alGetListenerfvNative(pname, retValue);
+ }
+ }
+
+ private native void alGetListenerfvNative(int pname, FloatBuffer retValue);
+
+ public void alGetListeneri(int pname, int[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException("Array must be non-null");
+ } else {
+ alGetListeneriNative(pname, retValue);
+ }
+ }
+
+ private native void alGetListeneriNative(int pname, int[] retValue);
+
+ public void alGetListeneri(int pname, IntBuffer retValue) {
+ if ((retValue == null) || !retValue.isDirect()) {
+ throw new IllegalArgumentException(
+ "Buffer must be non-null and direct"
+ );
+ } else {
+ alGetListeneriNative(pname, retValue);
+ }
+ }
+
+ private native void alGetListeneriNative(int pname, IntBuffer retValue);
+
+ public native int alGetListeneri(int pname);
+
+ // STATE RELATED METHODS
+ public native void alEnable(int capability);
+
+ public native void alDisable(int capability);
+
+ public native boolean alIsEnabled(int capability);
+
+ public native boolean alGetBoolean(int pname);
+
+ public native double alGetDouble(int pname);
+
+ public native float alGetFloat(int pname);
+
+ public native int alGetInteger(int pname);
+
+ // No Boolean Array states at the moment
+ // public native void getBooleanv(int pname, ByteBuffer value);
+
+ public void alGetBooleanv(int pname, boolean[] value) {
+ if (value == null) {
+ throw new IllegalArgumentException("Array must be non-null");
+ } else {
+ value[0] = false;
+ // do nothing for now, there are no boolean vector props
+ // alGetBooleanvNative(pname, value);
+ }
+ }
+
+ private native void alGetBooleanvNative(int pname, boolean[] value);
+
+ public void alGetDoublev(int pname, double[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException("Array must be non-null");
+ } else {
+ alGetDoublevNative(pname, retValue);
+ }
+ }
+
+ private native void alGetDoublevNative(int pname, double[] retValue);
+
+ public void alGetDoublev(int pname, DoubleBuffer value) {
+ if ((value == null) || !value.isDirect()) {
+ throw new IllegalArgumentException(
+ "Buffer must be non-null and direct"
+ );
+ } else {
+ alGetDoublevNative(pname, value);
+ }
+ }
+
+ private native void alGetDoublevNative(int pname, DoubleBuffer value);
+
+ public void alGetFloatv(int pname, float[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException("Array must be non-null");
+ } else {
+ alGetFloatvNative(pname, retValue);
+ }
+ }
+
+ private native void alGetFloatvNative(int pname, float[] retValue);
+
+ public void alGetFloatv(int pname, FloatBuffer value) {
+ if ((value == null) || !value.isDirect()) {
+ throw new IllegalArgumentException(
+ "Buffer must be non-null and direct"
+ );
+ } else {
+ alGetFloatvNative(pname, value);
+ }
+ }
+
+ private native void alGetFloatvNative(int pname, FloatBuffer value);
+
+ public void alGetIntegerv(int pname, int[] retValue) {
+ if (retValue == null) {
+ throw new IllegalArgumentException("Array must be non-null");
+ } else {
+ alGetIntegervNative(pname, retValue);
+ }
+ }
+
+ private native void alGetIntegervNative(int pname, int[] retValue);
+
+ public void alGetIntegerv(int pname, IntBuffer value) {
+ if ((value == null) || !value.isDirect()) {
+ throw new IllegalArgumentException(
+ "Buffer must be non-null and direct"
+ );
+ } else {
+ alGetIntegervNative(pname, value);
+ }
+ }
+
+ private native void alGetIntegervNative(int pname, IntBuffer value);
+
+ public native String alGetString(int pname);
+
+ public native void alDistanceModel(int model);
+
+ public native void alDopplerFactor(float value);
+
+ public native void alDopplerVelocity(float value);
+
+ // ERROR RELATED METHODS
+ public native int alGetError();
+
+ // EXTENSION RELATED METHODS
+ public native boolean alIsExtensionPresent(String extName);
+
+ // public native Method getProcAddress(String methodName);
+ public native int alGetEnumValue(String enumName);
+ /* (non-Javadoc)
+ * @see net.java.games.joal.AL#alGetBooleanv(int, boolean[])
+ */
+
+}
diff --git a/src/java/net/java/games/joal/eax/EAX.java b/src/java/net/java/games/joal/eax/EAX.java
new file mode 100644
index 0000000..5ce2a9b
--- /dev/null
+++ b/src/java/net/java/games/joal/eax/EAX.java
@@ -0,0 +1,140 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal.eax;
+
+import java.nio.Buffer;
+
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public class EAX implements EAXConstants {
+ static {
+ System.loadLibrary("joal");
+ }
+
+ public static final int SOURCE = 0;
+ public static final int LISTENER = 1;
+
+ private final int sourceGUID = SOURCE;
+ private final int listenerGUID = LISTENER;
+
+ /**
+ * @param sourceGUID
+ * @param listenerGUID
+ */
+ EAX(int sourceGUID, int listenerGUID) {
+ // this.sourceGUID = sourceGUID;
+ // this.listenerGUID = listenerGUID;
+ }
+
+ /**
+ * This method sets an EAX property value. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALenum EAXSet(const struct _GUID *propertySetID, ALuint property, ALuint source, ALvoid *value, ALuint size)</pre>
+ *
+ * @param objectFlag a flag indicating a LISTENER or a SOURCE
+ * @param pname the property being set
+ * @param source the ID of the source, or 0 for Listener properties
+ * @param value a direct Buffer to hold the value retrieved
+ * @param size the size of the Buffer
+ */
+ public native void EAXSet(
+ int objectFlag,
+ int pname,
+ int source,
+ Buffer value,
+ int size
+ );
+
+ /**
+ * This method retrieves an EAX property value. <br>
+ * <br>
+ * <b>Interface to C Language function:</b>
+ * <pre>ALenum EAXGet(const struct _GUID *propertySetID, ALuint property, ALuint source, ALvoid *value, ALuint size)</pre>
+ *
+ * @param objectFlag a flag indicating a LISTENER or a SOURCE
+ * @param pname the property being queried
+ * @param source the ID of the source, or 0 for Listener properties
+ * @param value a direct Buffer to hold the value retrieved
+ * @param size the size of the Buffer
+ */
+ public native void EAXGet(
+ int objectFlag,
+ int pname,
+ int source,
+ Buffer value,
+ int size
+ );
+
+ /**
+ * This method sets a source property.
+ * @param sourceID the ID of the source whose property is being set.
+ * @param pname the name of the property being set
+ * @param value a direct Buffer containing the value to be set
+ */
+ public void setSourceProperty(int sourceID, int pname, Buffer value) {
+ EAXSet(sourceGUID, pname, sourceID, value, value.capacity());
+ }
+
+ /**
+ * This method retrieves a source property.
+ * @param sourceID the ID of the source whose property is being retrieved.
+ * @param pname the name of the property being retrieved
+ * @param value a direct Buffer to hold the value to be retrieved
+ */
+ public void getSourceProperty(int pname, int sourceID, Buffer value) {
+ EAXGet(sourceGUID, pname, sourceID, value, value.capacity());
+ }
+
+ /**
+ * This method sets a Listener property.
+ * @param pname the name of the property being set
+ * @param value a direct Buffer containing the value to be set
+ */
+ public void setListenerProperty(int pname, Buffer value) {
+ EAXSet(listenerGUID, pname, 0, value, value.capacity());
+ }
+
+ /**
+ * This method retrieves a Listener property.
+ * @param pname the name of the property being retrieved
+ * @param value a direct Buffer to hold the value to be retrieved
+ */
+ public void getListenerProperty(int pname, Buffer value) {
+ EAXGet(listenerGUID, pname, 0, value, value.capacity());
+ }
+}
diff --git a/src/java/net/java/games/joal/eax/EAXConstants.java b/src/java/net/java/games/joal/eax/EAXConstants.java
new file mode 100644
index 0000000..23c3400
--- /dev/null
+++ b/src/java/net/java/games/joal/eax/EAXConstants.java
@@ -0,0 +1,350 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal.eax;
+/**
+ *
+ * This class implements the basic EAX extension constants.
+ *
+ * @author Athomas Goldberg
+ */
+public interface EAXConstants {
+
+ public final static int DSPROPERTY_EAXLISTENER_NONE = 0;
+ public final static int DSPROPERTY_EAXLISTENER_ALLPARAMETERS = 1;
+ public final static int DSPROPERTY_EAXLISTENER_ROOM = 2;
+ public final static int DSPROPERTY_EAXLISTENER_ROOMHF = 3;
+ public final static int DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR = 4;
+ public final static int DSPROPERTY_EAXLISTENER_DECAYTIME = 5;
+ public final static int DSPROPERTY_EAXLISTENER_DECAYHFRATIO = 6;
+ public final static int DSPROPERTY_EAXLISTENER_REFLECTIONS = 7;
+ public final static int DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY = 8;
+ public final static int DSPROPERTY_EAXLISTENER_REVERB = 9;
+ public final static int DSPROPERTY_EAXLISTENER_REVERBDELAY = 10;
+ public final static int DSPROPERTY_EAXLISTENER_ENVIRONMENT = 11;
+ public final static int DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE = 12;
+ public final static int DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION = 13;
+ public final static int DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF = 14;
+ public final static int DSPROPERTY_EAXLISTENER_FLAGS = 15;
+
+// OR these flags with property id //
+ /** changes take effect immediately */
+ public static final int DSPROPERTY_EAXLISTENER_IMMEDIATE = 0x00000000;
+
+ /** changes take effect later */
+ public static final int DSPROPERTY_EAXLISTENER_DEFERRED = 0x80000000;
+
+ public static final int DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS =
+ DSPROPERTY_EAXLISTENER_NONE |
+ DSPROPERTY_EAXLISTENER_IMMEDIATE;
+
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_GENERIC = 0;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_PADDEDCELL = 1;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_ROOM = 2;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_BATHROOM = 3;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_LIVINGROOM = 4;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_STONEROOM = 5;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_AUDITORIUM = 6;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_CONCERTHALL = 7;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_CAVE = 8;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_ARENA = 9;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_HANGAR = 10;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_CARPETEDHALLWAY = 11;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_HALLWAY = 12;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_STONECORRIDOR = 13;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_ALLEY = 14;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_FOREST = 15;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_CITY = 16;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_MOUNTAINS = 17;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_QUARRY = 18;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_PLAIN = 19;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_PARKINGLOT = 20;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_SEWERPIPE = 21;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_UNDERWATER = 22;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_DRUGGED = 23;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_DIZZY = 24;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_PSYCHOTIC = 25;
+ /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */
+ public final static int EAX_ENVIRONMENT_COUNT = 26;
+
+// These flags determine what properties are affected by environment size.
+ /** reverberation decay time */
+ public final static int EAXLISTENERFLAGS_DECAYTIMESCALE = 0x00000001;
+ /** reflection level */
+ public final static int EAXLISTENERFLAGS_REFLECTIONSSCALE = 0x00000002;
+ /** initial reflection delay time */
+ public final static int EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE = 0x00000004;
+ /** reflections level */
+ public final static int EAXLISTENERFLAGS_REVERBSCALE = 0x00000008;
+ /** late reverberation delay time */
+ public final static int EAXLISTENERFLAGS_REVERBDELAYSCALE = 0x00000010;
+
+ /** This flag limits high-frequency decay time according to air absorption.*/
+ public final static int EAXLISTENERFLAGS_DECAYHFLIMIT = 0x00000020;
+ /** reserved future use */
+ public final static int EAXLISTENERFLAGS_RESERVED = 0xFFFFFFC0;
+
+// property ranges and defaults:
+
+ public final static int EAXLISTENER_MINROOM = -10000;
+ public final static int EAXLISTENER_MAXROOM = 0;
+ public final static int EAXLISTENER_DEFAULTROOM = -1000;
+
+ public final static int EAXLISTENER_MINROOMHF = -10000;
+ public final static int EAXLISTENER_MAXROOMHF = 0;
+ public final static int EAXLISTENER_DEFAULTROOMHF = -100;
+
+ public final static float EAXLISTENER_MINROOMROLLOFFFACTOR = 0.0f;
+ public final static float EAXLISTENER_MAXROOMROLLOFFFACTOR = 10.0f;
+ public final static float EAXLISTENER_DEFAULTROOMROLLOFFFACTOR = 0.0f;
+
+ public final static float EAXLISTENER_MINDECAYTIME = 0.1f;
+ public final static float EAXLISTENER_MAXDECAYTIME = 20.0f;
+ public final static float EAXLISTENER_DEFAULTDECAYTIME = 1.49f;
+
+ public final static float EAXLISTENER_MINDECAYHFRATIO = 0.1f;
+ public final static float EAXLISTENER_MAXDECAYHFRATIO = 2.0f;
+ public final static float EAXLISTENER_DEFAULTDECAYHFRATIO = 0.83f;
+
+ public final static int EAXLISTENER_MINREFLECTIONS = -10000;
+ public final static int EAXLISTENER_MAXREFLECTIONS = 1000;
+ public final static int EAXLISTENER_DEFAULTREFLECTIONS = -2602;
+
+ public final static float EAXLISTENER_MINREFLECTIONSDELAY = 0.0f;
+ public final static float EAXLISTENER_MAXREFLECTIONSDELAY = 0.3f;
+ public final static float EAXLISTENER_DEFAULTREFLECTIONSDELAY = 0.007f;
+
+ public final static int EAXLISTENER_MINREVERB = -10000;
+ public final static int EAXLISTENER_MAXREVERB = 2000;
+ public final static int EAXLISTENER_DEFAULTREVERB = 200;
+
+ public final static float EAXLISTENER_MINREVERBDELAY = 0.0f;
+ public final static float EAXLISTENER_MAXREVERBDELAY = 0.1f;
+ public final static float EAXLISTENER_DEFAULTREVERBDELAY = 0.011f;
+
+ public final static int EAXLISTENER_MINENVIRONMENT = 0;
+ public final static int EAXLISTENER_MAXENVIRONMENT = EAX_ENVIRONMENT_COUNT-1;
+ public final static int EAXLISTENER_DEFAULTENVIRONMENT = EAX_ENVIRONMENT_GENERIC;
+
+ public final static float EAXLISTENER_MINENVIRONMENTSIZE = 1.0f;
+ public final static float EAXLISTENER_MAXENVIRONMENTSIZE = 100.0f;
+ public final static float EAXLISTENER_DEFAULTENVIRONMENTSIZE = 7.5f;
+
+ public final static float EAXLISTENER_MINENVIRONMENTDIFFUSION = 0.0f;
+ public final static float EAXLISTENER_MAXENVIRONMENTDIFFUSION = 1.0f;
+ public final static float EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION = 1.0f;
+
+ public final static float EAXLISTENER_MINAIRABSORPTIONHF = -100.0f;
+ public final static float EAXLISTENER_MAXAIRABSORPTIONHF = 0.0f;
+ public final static float EAXLISTENER_DEFAULTAIRABSORPTIONHF = -5.0f;
+
+ public final static int EAXLISTENER_DEFAULTFLAGS =
+ EAXLISTENERFLAGS_DECAYTIMESCALE |
+ EAXLISTENERFLAGS_REFLECTIONSSCALE |
+ EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE |
+ EAXLISTENERFLAGS_REVERBSCALE |
+ EAXLISTENERFLAGS_REVERBDELAYSCALE |
+ EAXLISTENERFLAGS_DECAYHFLIMIT;
+
+ public final static int DSPROPERTY_EAXBUFFER_NONE = 0;
+ public final static int DSPROPERTY_EAXBUFFER_ALLPARAMETERS = 1;
+ public final static int DSPROPERTY_EAXBUFFER_DIRECT = 2;
+ public final static int DSPROPERTY_EAXBUFFER_DIRECTHF = 3;
+ public final static int DSPROPERTY_EAXBUFFER_ROOM = 4;
+ public final static int DSPROPERTY_EAXBUFFER_ROOMHF = 5;
+ public final static int DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR = 6;
+ public final static int DSPROPERTY_EAXBUFFER_OBSTRUCTION = 7;
+ public final static int DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO = 8;
+ public final static int DSPROPERTY_EAXBUFFER_OCCLUSION = 9;
+ public final static int DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO = 10;
+ public final static int DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO = 11;
+ public final static int DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF = 13;
+ public final static int DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR = 14;
+ public final static int DSPROPERTY_EAXBUFFER_FLAGS = 15;
+
+// OR these flags with property id
+ /** changes take effect immediately */
+ public final static int DSPROPERTY_EAXBUFFER_IMMEDIATE = 0x00000000;
+ /** changes take effect later */
+ public final static int DSPROPERTY_EAXBUFFER_DEFERRED = 0x80000000;
+ public final static int DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS =
+ DSPROPERTY_EAXBUFFER_NONE |
+ DSPROPERTY_EAXBUFFER_IMMEDIATE;
+
+
+// Used by DSPROPERTY_EAXBUFFER_FLAGS
+// TRUE: value is computed automatically - property is an offset
+// FALSE: value is used directly
+//
+// Note: The number and order of flags may change in future EAX versions.
+// To insure future compatibility, use flag defines as follows:
+// myFlags = EAXBUFFERFLAGS_DIRECTHFAUTO | EAXBUFFERFLAGS_ROOMAUTO;
+// instead of:
+// myFlags = 0x00000003;
+//
+ /** affects DSPROPERTY_EAXBUFFER_DIRECTHF */
+ public final static int EAXBUFFERFLAGS_DIRECTHFAUTO = 0x00000001;
+ /** affects DSPROPERTY_EAXBUFFER_ROOM */
+ public final static int EAXBUFFERFLAGS_ROOMAUTO = 0x00000002;
+ /** affects DSPROPERTY_EAXBUFFER_ROOMHF */
+ public final static int EAXBUFFERFLAGS_ROOMHFAUTO = 0x00000004;
+ /** reserved future use */
+ public final static int EAXBUFFERFLAGS_RESERVED = 0xFFFFFFF8;
+
+// property ranges and defaults:
+
+ public final static int EAXBUFFER_MINDIRECT = (-10000);
+ public final static int EAXBUFFER_MAXDIRECT = 1000;
+ public final static int EAXBUFFER_DEFAULTDIRECT = 0;
+
+ public final static int EAXBUFFER_MINDIRECTHF = (-10000);
+ public final static int EAXBUFFER_MAXDIRECTHF = 0;
+ public final static int EAXBUFFER_DEFAULTDIRECTHF = 0;
+
+ public final static int EAXBUFFER_MINROOM = (-10000);
+ public final static int EAXBUFFER_MAXROOM = 1000;
+ public final static int EAXBUFFER_DEFAULTROOM = 0;
+
+ public final static int EAXBUFFER_MINROOMHF = (-10000);
+ public final static int EAXBUFFER_MAXROOMHF = 0;
+ public final static int EAXBUFFER_DEFAULTROOMHF = 0;
+
+ public final static float EAXBUFFER_MINROOMROLLOFFFACTOR = 0.0f;
+ public final static float EAXBUFFER_MAXROOMROLLOFFFACTOR = 10.f;
+ public final static float EAXBUFFER_DEFAULTROOMROLLOFFFACTOR = 0.0f;
+
+ public final static int EAXBUFFER_MINOBSTRUCTION = (-10000);
+ public final static int EAXBUFFER_MAXOBSTRUCTION = 0;
+ public final static int EAXBUFFER_DEFAULTOBSTRUCTION = 0;
+
+ public final static float EAXBUFFER_MINOBSTRUCTIONLFRATIO = 0.0f;
+ public final static float EAXBUFFER_MAXOBSTRUCTIONLFRATIO = 1.0f;
+ public final static float EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO = 0.0f;
+
+ public final static int EAXBUFFER_MINOCCLUSION = (-10000);
+ public final static int EAXBUFFER_MAXOCCLUSION = 0;
+ public final static int EAXBUFFER_DEFAULTOCCLUSION = 0;
+
+ public final static float EAXBUFFER_MINOCCLUSIONLFRATIO = 0.0f;
+ public final static float EAXBUFFER_MAXOCCLUSIONLFRATIO = 1.0f;
+ public final static float EAXBUFFER_DEFAULTOCCLUSIONLFRATIO = 0.25f;
+
+ public final static float EAXBUFFER_MINOCCLUSIONROOMRATIO = 0.0f;
+ public final static float EAXBUFFER_MAXOCCLUSIONROOMRATIO = 10.0f;
+ public final static float EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO = 0.5f;
+
+ public final static int EAXBUFFER_MINOUTSIDEVOLUMEHF = (-10000);
+ public final static int EAXBUFFER_MAXOUTSIDEVOLUMEHF = 0;
+ public final static int EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF = 0;
+
+ public final static float EAXBUFFER_MINAIRABSORPTIONFACTOR = 0.0f;
+ public final static float EAXBUFFER_MAXAIRABSORPTIONFACTOR = 10.0f;
+ public final static float EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR = 1.0f;
+
+ public final static int EAXBUFFER_DEFAULTFLAGS =
+ EAXBUFFERFLAGS_DIRECTHFAUTO |
+ EAXBUFFERFLAGS_ROOMAUTO |
+ EAXBUFFERFLAGS_ROOMHFAUTO;
+
+// Material transmission presets
+// 3 values in this order:
+// 1: occlusion (or obstruction)
+// 2: occlusion LF Ratio (or obstruction LF Ratio)
+// 3: occlusion Room Ratio
+
+// Single window material preset
+ public final static int EAX_MATERIAL_SINGLEWINDOW = (-2800);
+ public final static float EAX_MATERIAL_SINGLEWINDOWLF = 0.71f;
+ public final static float EAX_MATERIAL_SINGLEWINDOWROOMRATIO = 0.43f;
+
+// Double window material preset
+ public final static int EAX_MATERIAL_DOUBLEWINDOW = (-5000);
+ public final static float EAX_MATERIAL_DOUBLEWINDOWHF = 0.40f;
+ public final static float EAX_MATERIAL_DOUBLEWINDOWROOMRATIO = 0.24f;
+
+// Thin door material preset
+ public final static int EAX_MATERIAL_THINDOOR = (-1800);
+ public final static float EAX_MATERIAL_THINDOORLF = 0.66f;
+ public final static float EAX_MATERIAL_THINDOORROOMRATIO = 0.66f;
+
+// Thick door material preset
+ public final static int EAX_MATERIAL_THICKDOOR = (-4400);
+ public final static float EAX_MATERIAL_THICKDOORLF = 0.64f;
+ public final static float EAX_MATERIAL_THICKDOORROOMRTATION = 0.27f;
+
+// Wood wall material preset
+ public final static int EAX_MATERIAL_WOODWALL = (-4000);
+ public final static float EAX_MATERIAL_WOODWALLLF = 0.50f;
+ public final static float EAX_MATERIAL_WOODWALLROOMRATIO = 0.30f;
+
+// Brick wall material preset
+ public final static int EAX_MATERIAL_BRICKWALL = (-5000);
+ public final static float EAX_MATERIAL_BRICKWALLLF = 0.60f;
+ public final static float EAX_MATERIAL_BRICKWALLROOMRATIO = 0.24f;
+
+// Stone wall material preset
+ public final static int EAX_MATERIAL_STONEWALL = (-6000);
+ public final static float EAX_MATERIAL_STONEWALLLF = 0.68f;
+ public final static float EAX_MATERIAL_STONEWALLROOMRATIO = 0.20f;
+
+// Curtain material preset
+ public final static int EAX_MATERIAL_CURTAIN = (-1200);
+ public final static float EAX_MATERIAL_CURTAINLF = 0.15f;
+ public final static float EAX_MATERIAL_CURTAINROOMRATIO = 1.00f;
+} \ No newline at end of file
diff --git a/src/java/net/java/games/joal/eax/EAXFactory.java b/src/java/net/java/games/joal/eax/EAXFactory.java
new file mode 100644
index 0000000..2547ed7
--- /dev/null
+++ b/src/java/net/java/games/joal/eax/EAXFactory.java
@@ -0,0 +1,59 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal.eax;
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public final class EAXFactory {
+
+ static {
+ System.loadLibrary("joal");
+ }
+
+ private static int SOURCE_GUID;
+ private static int LISTENER_GUID;
+
+ private static EAX eax;
+
+ private static native void init();
+ public static EAX getEAX() {
+ if(eax == null) {
+ init();
+ eax = new EAX(SOURCE_GUID, LISTENER_GUID);
+ }
+ return eax;
+ }
+}
diff --git a/src/java/net/java/games/joal/util/BufferUtils.java b/src/java/net/java/games/joal/util/BufferUtils.java
new file mode 100644
index 0000000..25c9d3d
--- /dev/null
+++ b/src/java/net/java/games/joal/util/BufferUtils.java
@@ -0,0 +1,166 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal.util;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Administrator To change the template for this generated type comment
+ * go to Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class BufferUtils {
+ private static final int CHAR = 2;
+ private static final int SHORT = 2;
+ private static final int INT = 4;
+ private static final int LONG = 8;
+ private static final int FLOAT = 4;
+ private static final int DOUBLE = 8;
+
+ private BufferUtils() {
+ }
+
+ /**
+ * Create a new direct ByteBuffer of the specified size.
+ *
+ * @param size (in bytes) of the returned ByteBuffer
+ *
+ * @return a new direct ByteBuffer of the specified size
+ */
+ public static ByteBuffer newByteBuffer(int size) {
+ ByteBuffer result = null;
+ result = ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder());
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param size DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static CharBuffer newCharBuffer(int size) {
+ CharBuffer result = null;
+ ByteBuffer temp = newByteBuffer(size * CHAR);
+ result = temp.asCharBuffer();
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param size DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static ShortBuffer newShortBuffer(int size) {
+ ShortBuffer result = null;
+ ByteBuffer temp = newByteBuffer(size * SHORT);
+ result = temp.asShortBuffer();
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param size DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static IntBuffer newIntBuffer(int size) {
+ IntBuffer result = null;
+ ByteBuffer temp = newByteBuffer(size * INT);
+ result = temp.asIntBuffer();
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param size DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static LongBuffer newLongBuffer(int size) {
+ LongBuffer result = null;
+ ByteBuffer temp = newByteBuffer(size * LONG);
+ result = temp.asLongBuffer();
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param size DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static FloatBuffer newFloatBuffer(int size) {
+ FloatBuffer result = null;
+ ByteBuffer temp = newByteBuffer(size * FLOAT);
+ result = temp.asFloatBuffer();
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param size DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static DoubleBuffer newDoubleBuffer(int size) {
+ DoubleBuffer result = null;
+ ByteBuffer temp = newByteBuffer(size * DOUBLE);
+ result = temp.asDoubleBuffer();
+
+ return result;
+ }
+}
diff --git a/src/java/net/java/games/joal/util/WAVData.java b/src/java/net/java/games/joal/util/WAVData.java
new file mode 100644
index 0000000..0bc43fa
--- /dev/null
+++ b/src/java/net/java/games/joal/util/WAVData.java
@@ -0,0 +1,57 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal.util;
+
+import java.nio.ByteBuffer;
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public final class WAVData {
+
+ public final ByteBuffer data;
+ public final int format;
+ public final int size;
+ public final int freq;
+ public final boolean loop;
+
+ WAVData(ByteBuffer data, int format, int size, int freq, boolean loop) {
+ this.data = data;
+ this.format = format;
+ this.size = size;
+ this.freq = freq;
+ this.loop = loop;
+ }
+}
diff --git a/src/java/net/java/games/joal/util/WAVLoader.java b/src/java/net/java/games/joal/util/WAVLoader.java
new file mode 100644
index 0000000..c0235da
--- /dev/null
+++ b/src/java/net/java/games/joal/util/WAVLoader.java
@@ -0,0 +1,87 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.joal.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.UnsupportedAudioFileException;
+
+import net.java.games.joal.ALConstants;
+
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public class WAVLoader implements ALConstants {
+ private static final int BUFFER_SIZE = 128000;
+
+ public static WAVData loadFromFile(String filename)
+ throws UnsupportedAudioFileException,
+ IOException {
+ WAVData result = null;
+ File soundFile = new File(filename);
+ AudioInputStream aIn = AudioSystem.getAudioInputStream(soundFile);
+ ReadableByteChannel aChannel = Channels.newChannel(aIn);
+ AudioFormat fmt = aIn.getFormat();
+ int numChannels = fmt.getChannels();
+ int bits = fmt.getSampleSizeInBits();
+ int format = AL_FORMAT_MONO8;
+
+ if ((bits == 8) && (numChannels == 1)) {
+ format = AL_FORMAT_MONO8;
+ } else if ((bits == 16) && (numChannels == 1)) {
+ format = AL_FORMAT_MONO16;
+ } else if ((bits == 8) && (numChannels == 2)) {
+ format = AL_FORMAT_STEREO8;
+ } else if ((bits == 16) && (numChannels == 2)) {
+ format = AL_FORMAT_STEREO16;
+ }
+
+ int freq = Math.round(fmt.getSampleRate());
+ int size = aIn.available();
+ ByteBuffer buffer = ByteBuffer.allocateDirect(size);
+ aChannel.read(buffer);
+ result = new WAVData(buffer, format, size, freq, false);
+ aIn.close();
+ return result;
+ }
+}
diff --git a/src/java/net/java/games/sound3d/AudioSystem3D.java b/src/java/net/java/games/sound3d/AudioSystem3D.java
new file mode 100644
index 0000000..66ef9cc
--- /dev/null
+++ b/src/java/net/java/games/sound3d/AudioSystem3D.java
@@ -0,0 +1,215 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.sound3d;
+
+import java.io.IOException;
+
+import javax.sound.sampled.UnsupportedAudioFileException;
+
+import net.java.games.joal.AL;
+import net.java.games.joal.ALC;
+import net.java.games.joal.ALFactory;
+import net.java.games.joal.util.WAVData;
+import net.java.games.joal.util.WAVLoader;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Athomas Goldberg
+ */
+public class AudioSystem3D {
+ private static AL al;
+ private static ALC alc;
+ private static Listener listener;
+
+ /**
+ * DOCUMENT ME!
+ */
+ public static void init() {
+ ALFactory.initialize();
+ al = ALFactory.getAL();
+ alc = ALFactory.getALC();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param device DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static Context createContext(Device device) {
+ Context result = null;
+ ALC.Context realContext = alc.alcCreateContext(device.realDevice, null);
+ result = new Context(alc, realContext, device);
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param context DOCUMENT ME!
+ */
+ public static void makeContextCurrent(Context context) {
+ ALC.Context realContext = null;
+
+ if (context != null) {
+ realContext = context.realContext;
+ }
+
+ alc.alcMakeContextCurrent(realContext);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param deviceName DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static Device openDevice(String deviceName) {
+ Device result = null;
+ ALC.Device realDevice = alc.alcOpenDevice(deviceName);
+ result = new Device(alc, realDevice);
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param numBuffers DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static Buffer[] generateBuffers(int numBuffers) {
+ Buffer[] result = new Buffer[numBuffers];
+ int[] arr = new int[numBuffers];
+ al.alGenBuffers(numBuffers, arr);
+
+ for (int i = 0; i < numBuffers; i++) {
+ result[i] = new Buffer(al, arr[i]);
+ }
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param filename DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ *
+ * @throws IOException DOCUMENT ME!
+ * @throws UnsupportedAudioFileException DOCUMENT ME!
+ */
+ public static Buffer loadBuffer(String filename)
+ throws IOException, UnsupportedAudioFileException {
+ Buffer result;
+ Buffer[] tmp = generateBuffers(1);
+ result = tmp[0];
+
+ WAVData wd = WAVLoader.loadFromFile(filename);
+ result.configure(wd.data, wd.format, wd.freq);
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param filename DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ *
+ * @throws IOException DOCUMENT ME!
+ * @throws UnsupportedAudioFileException DOCUMENT ME!
+ */
+ public static Source loadSource(String filename)
+ throws IOException, UnsupportedAudioFileException {
+ Buffer buffer = loadBuffer(filename);
+ return generateSource(buffer);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param numSources DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static Source[] generateSources(int numSources) {
+ Source[] result = new Source[numSources];
+ int[] arr = new int[numSources];
+ al.alGenSources(numSources, arr);
+
+ for (int i = 0; i < numSources; i++) {
+ result[i] = new Source(al, arr[i]);
+ }
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param buff DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static Source generateSource(Buffer buff) {
+ Source result = null;
+ Source[] tmp = generateSources(1);
+ result = tmp[0];
+ result.setBuffer(buff);
+
+ return result;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public static Listener getListener() {
+ if (listener == null) {
+ listener = new Listener(al);
+ }
+
+ return listener;
+ }
+}
diff --git a/src/java/net/java/games/sound3d/Buffer.java b/src/java/net/java/games/sound3d/Buffer.java
new file mode 100644
index 0000000..c94915b
--- /dev/null
+++ b/src/java/net/java/games/sound3d/Buffer.java
@@ -0,0 +1,140 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.sound3d;
+
+import java.nio.ByteBuffer;
+
+import net.java.games.joal.AL;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Athomas Goldberg
+ */
+public class Buffer {
+ //DOCUMENT ME!
+ public final static int FORMAT_MONO8 = AL.AL_FORMAT_MONO8;
+
+ //DOCUMENT ME!
+ public final static int FORMAT_MONO16 = AL.AL_FORMAT_MONO16;
+
+ //DOCUMENT ME!
+ public final static int FORMAT_STEREO8 = AL.AL_FORMAT_STEREO8;
+
+ //DOCUMENT ME!
+ public final static int FORMAT_STEREO16 = AL.AL_FORMAT_STEREO16;
+ final int bufferName;
+ private ByteBuffer data;
+ private boolean isConfigured = false;
+ private final AL al;
+
+ Buffer(AL al, int bufferName) {
+ this.bufferName = bufferName;
+ this.al = al;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param data DOCUMENT ME!
+ * @param format DOCUMENT ME!
+ * @param freq DOCUMENT ME!
+ */
+ public void configure(ByteBuffer data, int format, int freq) {
+ if (!isConfigured) {
+ al.alBufferData(bufferName, format, data, data.capacity(), freq);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void delete() {
+ data = null;
+ al.alDeleteBuffers(1, new int[] { bufferName });
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ */
+ public int getBitDepth() {
+ int[] i = new int[1];
+ al.alGetBufferi(bufferName, AL.AL_BITS, i);
+
+ return i[0];
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ */
+ public int getNumChannels() {
+ int[] i = new int[1];
+ al.alGetBufferi(bufferName, AL.AL_CHANNELS, i);
+
+ return i[0];
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ */
+ public ByteBuffer getData() {
+ return data;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ */
+ public int getFrequency() {
+ int[] i = new int[1];
+ al.alGetBufferi(bufferName, AL.AL_FREQUENCY, i);
+
+ return i[0];
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ */
+ public int getSize() {
+ int[] i = new int[1];
+ al.alGetBufferi(bufferName, AL.AL_SIZE, i);
+
+ return i[0];
+ }
+}
diff --git a/src/java/net/java/games/sound3d/Context.java b/src/java/net/java/games/sound3d/Context.java
new file mode 100644
index 0000000..5215810
--- /dev/null
+++ b/src/java/net/java/games/sound3d/Context.java
@@ -0,0 +1,64 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.sound3d;
+
+import net.java.games.joal.ALC;
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public class Context {
+ private final ALC alc;
+ final ALC.Context realContext;
+ final Device device;
+
+ Context(ALC alc, ALC.Context realContext, Device device) {
+ this.alc = alc;
+ this.realContext = realContext;
+ this.device = device;
+ }
+
+ public void suspend() {
+ alc.alcSuspendContext(realContext);
+ }
+
+ public void destroy() {
+ alc.alcDestroyContext(realContext);
+ }
+
+ public Device getDevice() {
+ return device;
+ }
+}
diff --git a/src/java/net/java/games/sound3d/Device.java b/src/java/net/java/games/sound3d/Device.java
new file mode 100644
index 0000000..5973df3
--- /dev/null
+++ b/src/java/net/java/games/sound3d/Device.java
@@ -0,0 +1,54 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.sound3d;
+
+import net.java.games.joal.ALC;
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public class Device {
+ private final ALC alc;
+ final ALC.Device realDevice;
+
+ Device(ALC alc, ALC.Device realDevice) {
+ this.alc = alc;
+ this.realDevice = realDevice;
+ }
+
+ public void close() {
+ alc.alcCloseDevice(realDevice);
+ }
+}
diff --git a/src/java/net/java/games/sound3d/Listener.java b/src/java/net/java/games/sound3d/Listener.java
new file mode 100644
index 0000000..ad93099
--- /dev/null
+++ b/src/java/net/java/games/sound3d/Listener.java
@@ -0,0 +1,95 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.sound3d;
+
+import net.java.games.joal.AL;
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public class Listener {
+ private final AL al;
+ Listener(AL al) {
+ this.al = al;
+ }
+
+ public void setGain(float gain) {
+ al.alListenerf(AL.AL_GAIN,gain);
+ }
+
+ public float getGain() {
+ float[] f = new float[1];
+ al.alGetListenerf(AL.AL_GAIN,f);
+ return f[0];
+ }
+
+ public void setPosition(float x, float y, float z) {
+ al.alListener3f(AL.AL_POSITION,x,y,z);
+ }
+
+ public void setPosition(Vec3f position) {
+ al.alListener3f(AL.AL_POSITION,position.v1, position.v2, position.v3);
+ }
+
+ public Vec3f getPosition() {
+ Vec3f result = null;
+ float[] tmp = new float[3];
+ al.alGetListenerfv(AL.AL_POSITION,tmp);
+ result = new Vec3f(tmp[0],tmp[1],tmp[2]);
+ return result;
+ }
+
+ public void setVelocity(Vec3f velocity) {
+ al.alListener3f(AL.AL_VELOCITY,velocity.v1, velocity.v2, velocity.v3);
+ }
+
+ public Vec3f getVelocity() {
+ Vec3f result = null;
+ float[] tmp = new float[3];
+ al.alGetListenerfv(AL.AL_VELOCITY,tmp);
+ result = new Vec3f(tmp[0],tmp[1],tmp[2]);
+ return result;
+ }
+
+ public void setOrientation(float[] orientation) {
+ al.alListenerfv(AL.AL_ORIENTATION,orientation);
+ }
+
+ public float[] getOrientation() {
+ float[] tmp = new float[6];
+ al.alGetListenerfv(AL.AL_ORIENTATION,tmp);
+ return tmp;
+ }
+}
diff --git a/src/java/net/java/games/sound3d/Source.java b/src/java/net/java/games/sound3d/Source.java
new file mode 100644
index 0000000..f96207c
--- /dev/null
+++ b/src/java/net/java/games/sound3d/Source.java
@@ -0,0 +1,286 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.sound3d;
+
+import net.java.games.joal.AL;
+
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public final class Source {
+ private final AL al;
+ private final int sourceName;
+ private Buffer buffer;
+
+ Source(
+ AL al,
+ int sourceName) {
+ this.al = al;
+ this.sourceName = sourceName;
+ }
+
+ public void play() {
+ al.alSourcePlay(sourceName);
+ }
+
+ public void pause() {
+ al.alSourcePause(sourceName);
+ }
+
+ public void stop() {
+ al.alSourceStop(sourceName);
+ }
+
+ public void rewind() {
+ al.alSourceRewind(sourceName);
+ }
+
+ public void delete() {
+ al.alDeleteSources(1, new int[] { sourceName });
+ }
+
+ public void setPitch(float pitch) {
+ al.alSourcef(sourceName, AL.AL_PITCH, pitch);
+ }
+
+ public float getPitch() {
+ float[] result = new float[1];
+ al.alGetSourcef(sourceName, AL.AL_PITCH,result);
+ return result[0];
+ }
+
+ public void setGain(float gain) {
+ al.alSourcef(sourceName, AL.AL_GAIN, gain);
+ }
+
+ public float getGain() {
+ float[] result = new float[1];
+ al.alGetSourcef(sourceName, AL.AL_GAIN, result);
+ return result[0];
+ }
+
+ public void setMaxDistance(float maxDistance) {
+ al.alSourcef(sourceName, AL.AL_MAX_DISTANCE, maxDistance);
+ }
+
+ public float getMaxDistance() {
+ float[] result = new float[1];
+ al.alGetSourcef(sourceName, AL.AL_MAX_DISTANCE,result);
+ return result[0];
+ }
+
+ public void setRolloffFactor(float rolloffFactor) {
+ al.alSourcef(sourceName, AL.AL_ROLLOFF_FACTOR, rolloffFactor);
+ }
+
+ public float getRolloffFactor() {
+ float[] result = new float[1];
+ al.alGetSourcef(sourceName, AL.AL_ROLLOFF_FACTOR, result);
+ return result[0];
+ }
+
+ public void setReferenceDistance(float referenceDistance) {
+ al.alSourcef(sourceName, AL.AL_REFERENCE_DISTANCE, referenceDistance);
+ }
+
+ public float getReferenceDistance() {
+ float[] result = new float[1];
+ al.alGetSourcef(sourceName, AL.AL_REFERENCE_DISTANCE, result);
+ return result[0];
+ }
+
+ public void setMinGain(float minGain) {
+ al.alSourcef(sourceName, AL.AL_MIN_GAIN, minGain);
+ }
+
+ public float getMinGain() {
+ float[] result = new float[1];
+ al.alGetSourcef(sourceName, AL.AL_MIN_GAIN, result);
+ return result[0];
+ }
+
+ public void setMaxGain(float maxGain) {
+ al.alSourcef(sourceName, AL.AL_MAX_GAIN, maxGain);
+ }
+
+ public float getMaxGain() {
+ float[] result = new float[1];
+ al.alGetSourcef(sourceName, AL.AL_MAX_GAIN, result);
+ return result[0];
+ }
+
+ public void setConeOuterGain(float coneOuterGain) {
+ al.alSourcef(sourceName, AL.AL_CONE_OUTER_GAIN, coneOuterGain);
+ }
+
+ public float getConeOuterGain() {
+ float[] result = new float[1];
+ al.alGetSourcef(sourceName, AL.AL_CONE_OUTER_GAIN, result);
+ return result[0];
+ }
+
+ public void setPosition(Vec3f position) {
+ al.alSource3f(
+ sourceName,
+ AL.AL_POSITION,
+ position.v1,
+ position.v2,
+ position.v3);
+ }
+
+ public void setPosition(
+ float x,
+ float y,
+ float z) {
+ al.alSource3f(sourceName, AL.AL_POSITION, x, y, z);
+ }
+
+ public Vec3f getPosition() {
+ Vec3f result = null;
+ float[] pos = new float[3];
+ al.alGetSourcefv(sourceName, AL.AL_POSITION, pos);
+ result = new Vec3f(pos[0], pos[1], pos[2]);
+ return result;
+ }
+
+ public void setVelocity(Vec3f velocity) {
+ al.alSource3f(
+ sourceName,
+ AL.AL_VELOCITY,
+ velocity.v1,
+ velocity.v2,
+ velocity.v3);
+ }
+
+ public void setVelocity(
+ float x,
+ float y,
+ float z) {
+ al.alSource3f(sourceName, AL.AL_VELOCITY, x, y, z);
+ }
+
+ public Vec3f getVelocity() {
+ Vec3f result = null;
+ float[] vel = new float[3];
+ al.alGetSourcefv(sourceName, AL.AL_VELOCITY, vel);
+ result = new Vec3f(vel[0], vel[1], vel[2]);
+
+ return result;
+ }
+
+ public void setDirection(Vec3f direction) {
+ al.alSource3f(
+ sourceName,
+ AL.AL_DIRECTION,
+ direction.v1,
+ direction.v2,
+ direction.v3);
+ }
+
+ public void setDirection(
+ float x,
+ float y,
+ float z) {
+ al.alSource3f(sourceName, AL.AL_DIRECTION, x, y, z);
+ }
+
+ public Vec3f getDirection() {
+ Vec3f result = null;
+ float[] dir = new float[3];
+ al.alGetSourcefv(sourceName, AL.AL_DIRECTION, dir);
+ result = new Vec3f(dir[0], dir[1], dir[2]);
+
+ return result;
+ }
+
+ public void setSourceRelative(boolean isRelative) {
+ int rel = isRelative ? 1 : 0;
+ al.alSourcei(sourceName, AL.AL_SOURCE_RELATIVE, rel);
+ }
+
+ public boolean isSourceRelative() {
+ int[] result = new int[1];
+ al.alGetSourcei(sourceName, AL.AL_SOURCE_RELATIVE, result);
+ return result[0] == 1;
+ }
+
+ public void setLooping(boolean isLooping) {
+ int loop = isLooping ? 1 : 0;
+ al.alSourcei(sourceName, AL.AL_LOOPING, loop);
+ }
+
+ public int getBuffersQueued() {
+ int[] result = new int[1];
+ al.alGetSourcei(sourceName, AL.AL_BUFFERS_QUEUED, result);
+ return result[0];
+ }
+
+ public int getBuffersProcessed() {
+ int[] result = new int[1];
+ al.alGetSourcei(sourceName, AL.AL_BUFFERS_PROCESSED, result);
+ return result[0];
+ }
+
+ public void setBuffer(Buffer buffer) {
+ al.alSourcei(sourceName, AL.AL_BUFFER, buffer.bufferName);
+ this.buffer = buffer;
+ }
+
+ public Buffer getBuffer() {
+ return buffer;
+ }
+
+ public void queueBuffers(Buffer[] buffers) {
+ int numBuffers = buffers.length;
+ int[] arr = new int[numBuffers];
+
+ for (int i = 0; i < numBuffers; i++) {
+ arr[i] = buffers[i].bufferName;
+ }
+
+ al.alSourceQueueBuffers(sourceName, numBuffers, arr);
+ }
+
+ public void unqueueBuffers(Buffer[] buffers) {
+ int numBuffers = buffers.length;
+ int[] arr = new int[numBuffers];
+
+ for (int i = 0; i < numBuffers; i++) {
+ arr[i] = buffers[i].bufferName;
+ }
+ al.alSourceUnqueueBuffers(sourceName, numBuffers, arr);
+ }
+}
diff --git a/src/java/net/java/games/sound3d/Vec3f.java b/src/java/net/java/games/sound3d/Vec3f.java
new file mode 100644
index 0000000..4823812
--- /dev/null
+++ b/src/java/net/java/games/sound3d/Vec3f.java
@@ -0,0 +1,52 @@
+/**
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+*
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+*/
+
+package net.java.games.sound3d;
+
+/**
+ * @author Athomas Goldberg
+ *
+ */
+public final class Vec3f {
+
+ public final float v1;
+ public final float v2;
+ public final float v3;
+
+ public Vec3f(float v1, float v2, float v3) {
+ this.v1 = v1;
+ this.v2 = v2;
+ this.v3 = v3;
+ }
+}