summaryrefslogtreecommitdiffstats
path: root/src/java/net
diff options
context:
space:
mode:
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.java263
-rw-r--r--src/java/net/java/games/joal/ALCConstants.java95
-rw-r--r--src/java/net/java/games/joal/ALCImpl.java224
-rw-r--r--src/java/net/java/games/joal/ALConstants.java348
-rwxr-xr-xsrc/java/net/java/games/joal/ALException.java62
-rw-r--r--src/java/net/java/games/joal/ALFactory.java168
-rw-r--r--src/java/net/java/games/joal/ALImpl.java921
-rwxr-xr-xsrc/java/net/java/games/joal/NativeLibLoader.java66
-rw-r--r--src/java/net/java/games/joal/OpenALException.java50
-rw-r--r--src/java/net/java/games/joal/eax/EAX.java2
-rw-r--r--src/java/net/java/games/joal/eax/EAXConstants.java2
-rw-r--r--src/java/net/java/games/joal/eax/EAXFactory.java2
-rw-r--r--src/java/net/java/games/joal/util/ALut.java132
-rw-r--r--src/java/net/java/games/joal/util/BufferUtils.java421
-rwxr-xr-xsrc/java/net/java/games/joal/util/Version.java104
-rw-r--r--src/java/net/java/games/joal/util/WAVData.java2
-rw-r--r--src/java/net/java/games/joal/util/WAVLoader.java65
-rw-r--r--src/java/net/java/games/sound3d/AudioSystem3D.java398
-rw-r--r--src/java/net/java/games/sound3d/Buffer.java12
-rw-r--r--src/java/net/java/games/sound3d/Context.java8
-rw-r--r--src/java/net/java/games/sound3d/Device.java8
-rw-r--r--src/java/net/java/games/sound3d/Listener.java12
-rw-r--r--src/java/net/java/games/sound3d/Sound3DException.java50
-rw-r--r--src/java/net/java/games/sound3d/Source.java38
-rw-r--r--src/java/net/java/games/sound3d/Vec3f.java2
26 files changed, 912 insertions, 3803 deletions
diff --git a/src/java/net/java/games/joal/AL.java b/src/java/net/java/games/joal/AL.java
deleted file mode 100644
index ab1c66b..0000000
--- a/src/java/net/java/games/joal/AL.java
+++ /dev/null
@@ -1,1260 +0,0 @@
-/*
-* 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
deleted file mode 100644
index f8855c6..0000000
--- a/src/java/net/java/games/joal/ALC.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/**
-* 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);
-
- public void alcFreeCurrentContext();
-
- /**
- * 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(Device device);
-
- /**
- * 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) {
- System.out.println("Pointer = " + pointer);
- System.out.println("ALC = " + impl);
- 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
deleted file mode 100644
index 47d0754..0000000
--- a/src/java/net/java/games/joal/ALCConstants.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
-* 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
deleted file mode 100644
index e6d9d36..0000000
--- a/src/java/net/java/games/joal/ALCImpl.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/**
-* 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();
- private static Mutex lock = new Mutex();
-
- ALCImpl() {
- System.loadLibrary("joal");
- //
- // Fix to issue 6: Unable to terminate JOAL program with CRTL-C or kill Pid
- // Shouldn't attempt to cleanup before exit, we will let the native driver
- // do it.
- //
- }
-
- public Device alcOpenDevice(String deviceName) {
- return openDeviceNative(deviceName);
- }
-
- private native Device openDeviceNative(String deviceName);
-
- public void alcCloseDevice(Device device) {
- if(device != null) {
- closeDeviceNative(device.pointer);
- }
- }
-
- private native void closeDeviceNative(int pointer);
-
- public Context alcCreateContext(Device device, int[] attrs) {
- Context result = null;
- if(device != null) {
- result = createContextNative(device.pointer, attrs);
- contextMap.put(new Integer(result.pointer), result);
- }
- return result;
- }
- private native Context createContextNative(int pointer, int[] attrs);
-
- public int alcMakeContextCurrent(Context context) {
- int result = 0;
- int pointer = 0;
- if (context != null) {
- pointer = context.pointer;
- }
- lock.acquire();
- result = makeContextCurrentNative(pointer);
- return result;
- }
-
- public void alcFreeCurrentContext() {
- makeContextCurrentNative(0);
- lock.release();
- }
-
- private native int makeContextCurrentNative(int pointer);
-
- public void alcProcessContext(Context context) {
- if(context != null) {
- processContextNative(context.pointer);
- }
- }
-
- private native void processContextNative(int pointer);
-
- public void alcSuspendContext(Context context) {
- if(context != null) {
- suspendContextNative(context.pointer);
- }
- }
-
- private native void suspendContextNative(int pointer);
-
- public void alcDestroyContext(Context context) {
- if(context != null) {
- destroyContextNative(context.pointer);
- }
- }
-
- private native void destroyContextNative(int pointer);
-
- public int alcGetError(Device device) {
- int result = 0;
- int pointer = 0;
- if(device != null) {
- pointer = device.pointer;
- }
- result = alcGetErrorNative(pointer);
- return result;
- }
- private native int alcGetErrorNative(int pointer);
-
- public Context alcGetCurrentContext() {
- Context result = null;
- int pointer = getCurrentContextNative();
- if(pointer != 0) {
- 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;
- if(context != null) {
- int devicePtr = getContextsDeviceNative(context.pointer);
- if(devicePtr != 0) {
- result = new ALC.Device(devicePtr);
- }
- }
- return result;
- }
-
- private native int getContextsDeviceNative(int context);
-
- private void exit() {
-
- Context alcContext = alcGetCurrentContext();
-
- if (alcContext != null) {
- Device alcDevice = alcGetContextsDevice(alcContext);
- alcMakeContextCurrent(null);
- alcDestroyContext(alcContext);
- alcCloseDevice(alcDevice);
- }
- }
-
- private static class Mutex {
- Thread owner = null;
- public synchronized void acquire() {
- boolean interrupted = false;
- while(owner != null && owner != Thread.currentThread()) {
- try {
- wait();
- } catch (InterruptedException e) {
- interrupted = true;
- }
- }
- owner = Thread.currentThread();
- if(interrupted) {
- owner.interrupt();
- }
- }
-
- public synchronized void release() {
- if(!owner.equals(Thread.currentThread())) {
- throw new IllegalMonitorStateException("Not Owner");
- }
- owner = null;
- notify();
- }
- }
-}
diff --git a/src/java/net/java/games/joal/ALConstants.java b/src/java/net/java/games/joal/ALConstants.java
deleted file mode 100644
index 4ee8e3f..0000000
--- a/src/java/net/java/games/joal/ALConstants.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/**
-* 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/ALException.java b/src/java/net/java/games/joal/ALException.java
new file mode 100755
index 0000000..75c6944
--- /dev/null
+++ b/src/java/net/java/games/joal/ALException.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2003-2005 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 MICROSYSTEMS, 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;
+
+/** A generic exception for OpenAL errors used throughout the binding
+ as a substitute for {@link RuntimeException}. */
+
+public class ALException extends RuntimeException {
+ /** Constructs an ALException object. */
+ public ALException() {
+ super();
+ }
+
+ /** Constructs an ALException object with the specified detail
+ message. */
+ public ALException(String message) {
+ super(message);
+ }
+
+ /** Constructs an ALException object with the specified detail
+ message and root cause. */
+ public ALException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /** Constructs an ALException object with the specified root
+ cause. */
+ public ALException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/src/java/net/java/games/joal/ALFactory.java b/src/java/net/java/games/joal/ALFactory.java
index ae9f906..d500a83 100644
--- a/src/java/net/java/games/joal/ALFactory.java
+++ b/src/java/net/java/games/joal/ALFactory.java
@@ -1,111 +1,89 @@
/**
-* 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.
-*/
+ * Copyright (c) 2003-2005 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 MICROSYSTEMS, 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 net.java.games.joal.impl.*;
+
+import com.sun.gluegen.runtime.*;
+
/**
- * 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.
+ * This class provides factory methods for generating AL and ALC objects.
*
* @author Athomas Goldberg
+ * @author Kenneth Russell
*/
public class ALFactory {
- static {
- System.loadLibrary("joal");
- }
+ private static boolean initialized = false;
+ private static AL al;
+ private static ALC alc;
- private static boolean isInitialized = false;
- 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() throws OpenALException {
- String osProperty = System.getProperty("os.name");
- if(osProperty.startsWith("Win")) {
- isInitialized = init(new String[] { "OpenAL32.dll" });
- } else if(osProperty.startsWith("Linux")) {
- isInitialized = init(new String[] { "libopenal.so" });
- } else {
- isInitialized = init(new String[] { "/Library/Frameworks/OpenAL.framework/Versions/Current/OpenAL"});
- }
- return isInitialized;
+ private static synchronized void initialize() throws ALException {
+ try {
+ if (!initialized) {
+ NativeLibLoader.load();
+ initialized = true;
+ }
+ } catch (UnsatisfiedLinkError e) {
+ throw new ALException(e);
}
+ }
- private static native boolean init(String[] oalPaths) throws OpenALException;
-
- /**
- * 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() throws OpenALException {
- if(!isInitialized) {
- initialize();
- }
- if (isInitialized && al == null) {
- al = new ALImpl();
- }
- return al;
+ /**
+ * Get the default AL object. This object is used to access most of the
+ * OpenAL functionality.
+ *
+ * @return the AL object
+ */
+ public static AL getAL() throws ALException {
+ initialize();
+ 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() throws OpenALException{
- if(!isInitialized) {
- initialize();
- }
- if (isInitialized && alc == null) {
- alc = new ALCImpl();
- }
- return alc;
+ /**
+ * 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() throws ALException{
+ initialize();
+ 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
deleted file mode 100644
index 14362de..0000000
--- a/src/java/net/java/games/joal/ALImpl.java
+++ /dev/null
@@ -1,921 +0,0 @@
-/**
-* 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 void alSourcefv(int sourcename, int pname, float[] value) {
- alSourcefvNative(sourcename,pname,value);
- }
-
- private native void alSourcefvNative(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 void alListenerfv(int pname, float[] values) {
- alListenerfvNative(pname,values);
- }
-
- private native void alListenerfvNative(int pname, float[] value);
-
- public void alListenerfv(int pname, FloatBuffer value) {
- if ((value != null) && !value.isDirect()) {
- throw new IllegalArgumentException("buffer must be direct");
- } else {
- alListenerfvNative(pname, value);
- }
- }
-
- private native void alListenerfvNative(int pname, FloatBuffer value);
-
- 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/NativeLibLoader.java b/src/java/net/java/games/joal/NativeLibLoader.java
new file mode 100755
index 0000000..394d1b4
--- /dev/null
+++ b/src/java/net/java/games/joal/NativeLibLoader.java
@@ -0,0 +1,66 @@
+/*
+ * 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
+ * MICROSYSTEMS, 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.security.*;
+
+class NativeLibLoader {
+ static {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ // Workaround for problem in OpenAL32.dll, which is actually
+ // the "wrapper" DLL which looks for real OpenAL
+ // implementations like nvopenal.dll and "*oal.dll".
+ // joal.dll matches this wildcard and a bug in OpenAL32.dll
+ // causes a call through a null function pointer.
+ System.loadLibrary("joal_native");
+
+ // Workaround for 4845371.
+ // Make sure the first reference to the JNI GetDirectBufferAddress is done
+ // from a privileged context so the VM's internal class lookups will succeed.
+ // FIXME: need to figure out an appropriate entry point to call
+ // JAWT jawt = new JAWT();
+ // JAWTFactory.JAWT_GetAWT(jawt);
+
+ return null;
+ }
+ });
+ }
+
+ public static void load() {
+ }
+}
diff --git a/src/java/net/java/games/joal/OpenALException.java b/src/java/net/java/games/joal/OpenALException.java
deleted file mode 100644
index f8a7732..0000000
--- a/src/java/net/java/games/joal/OpenALException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Created on Nov 22, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package net.java.games.joal;
-
-/**
- * @author athomas
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class OpenALException extends Exception {
-
- /**
- *
- */
- public OpenALException() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param arg0
- */
- public OpenALException(String arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param arg0
- */
- public OpenALException(Throwable arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public OpenALException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- // TODO Auto-generated constructor stub
- }
-
-}
diff --git a/src/java/net/java/games/joal/eax/EAX.java b/src/java/net/java/games/joal/eax/EAX.java
index 5ce2a9b..72c7cbf 100644
--- a/src/java/net/java/games/joal/eax/EAX.java
+++ b/src/java/net/java/games/joal/eax/EAX.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
diff --git a/src/java/net/java/games/joal/eax/EAXConstants.java b/src/java/net/java/games/joal/eax/EAXConstants.java
index 23c3400..44f1bee 100644
--- a/src/java/net/java/games/joal/eax/EAXConstants.java
+++ b/src/java/net/java/games/joal/eax/EAXConstants.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
diff --git a/src/java/net/java/games/joal/eax/EAXFactory.java b/src/java/net/java/games/joal/eax/EAXFactory.java
index 2547ed7..c700ce6 100644
--- a/src/java/net/java/games/joal/eax/EAXFactory.java
+++ b/src/java/net/java/games/joal/eax/EAXFactory.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
diff --git a/src/java/net/java/games/joal/util/ALut.java b/src/java/net/java/games/joal/util/ALut.java
index cd89e0c..71673b0 100644
--- a/src/java/net/java/games/joal/util/ALut.java
+++ b/src/java/net/java/games/joal/util/ALut.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
@@ -35,15 +35,12 @@
package net.java.games.joal.util;
-import java.io.IOException;
+import java.io.*;
import java.nio.ByteBuffer;
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.OpenALException;
+import net.java.games.joal.*;
/**
* @author Athomas Goldberg
@@ -51,80 +48,67 @@ import net.java.games.joal.OpenALException;
*/
public final class ALut {
- private static ALC alc;
+ private static ALC alc;
- private ALut() { }
+ private ALut() { }
- public static void alutInit() throws OpenALException {
- System.out.println("Go TEAM!");
- System.out.println("Entering alutInit()");
- ALFactory.initialize();
- alc = ALFactory.getALC();
- //String deviceName = null;
- String deviceName = null;
- /*
- String os = System.getProperty("os.name");
- if (os.startsWith("Windows")) {
- deviceName = "DirectSound3D";
- }
- if (deviceName != null) {
- */
- ALC.Context context;
- ALC.Device device;
- System.out.println("In alutInit(): Device Name = " + deviceName);
- device = alc.alcOpenDevice(deviceName);
- System.out.println("In alutInit(): Device = " + device);
- context = alc.alcCreateContext(device, null);
- alc.alcMakeContextCurrent(context);
- /*
- } else {
- System.out.println(
- "alutInit does not currently support "
- + os
- + ". "
- + "You'll need to construct your device and context"
- + "using the ALC functions for the time being. We apologize "
- + "for the inconvenience.");
- }
- */
- System.out.println("Exiting alutInit()");
+ /** Initializes the OpenAL Utility Toolkit, creates an OpenAL
+ context and makes it current on the current thread. */
+ public static void alutInit() throws ALException {
+ alc = ALFactory.getALC();
+ String deviceName = null;
+ ALCcontext context;
+ ALCdevice device;
+ device = alc.alcOpenDevice(deviceName);
+ if (device == null) {
+ throw new ALException("Error opening default OpenAL device");
}
-
- public static void alutLoadWAVFile(
- String fileName,
- int[] format,
- ByteBuffer[] data,
- int[] size,
- int[] freq,
- int[] loop) {
- try {
- WAVData wd = WAVLoader.loadFromFile(fileName);
- format[0] = wd.format;
- data[0] = wd.data;
- size[0] = wd.size;
- freq[0] = wd.freq;
- loop[0] = wd.loop ? AL.AL_TRUE : AL.AL_FALSE;
- } catch (IOException e) {
- e.printStackTrace();
- } catch (UnsupportedAudioFileException e) {
- e.printStackTrace();
- }
+ context = alc.alcCreateContext(device, null);
+ if (context == null) {
+ throw new ALException("Error creating OpenAL context");
+ }
+ alc.alcMakeContextCurrent(context);
+ if (alc.alcGetError(device) != 0) {
+ throw new ALException("Error making OpenAL context current");
}
+ }
- public static void alutUnloadWAV(
- int format,
- ByteBuffer data,
- int size,
- int freq) {
- // unneeded. here for completeness.
+ public static void alutLoadWAVFile(String fileName,
+ int[] format,
+ ByteBuffer[] data,
+ int[] size,
+ int[] freq,
+ int[] loop) throws ALException {
+ try {
+ WAVData wd = WAVLoader.loadFromFile(fileName);
+ format[0] = wd.format;
+ data[0] = wd.data;
+ size[0] = wd.size;
+ freq[0] = wd.freq;
+ loop[0] = wd.loop ? AL.AL_TRUE : AL.AL_FALSE;
+ } catch (Exception e) {
+ throw new ALException(e);
}
+ }
- public static void alutExit() {
-
- ALC.Context context = alc.alcGetCurrentContext();
- ALC.Device device = alc.alcGetContextsDevice(context);
- alc.alcFreeCurrentContext();
- alc.alcDestroyContext(context);
- alc.alcCloseDevice(device);
+ public static void alutLoadWAVFile(InputStream stream,
+ int[] format,
+ ByteBuffer[] data,
+ int[] size,
+ int[] freq,
+ int[] loop) throws ALException {
+ try {
+ if (!(stream instanceof BufferedInputStream)) {
+ stream = new BufferedInputStream(stream);
+ }
+ WAVData wd = WAVLoader.loadFromStream(stream);
+ format[0] = wd.format;
+ data[0] = wd.data;
+ size[0] = wd.size;
+ freq[0] = wd.freq;
+ loop[0] = wd.loop ? AL.AL_TRUE : AL.AL_FALSE;
+ } catch (Exception e) {
+ throw new ALException(e);
}
+ }
}
diff --git a/src/java/net/java/games/joal/util/BufferUtils.java b/src/java/net/java/games/joal/util/BufferUtils.java
index 47bf3bc..05de65a 100644
--- a/src/java/net/java/games/joal/util/BufferUtils.java
+++ b/src/java/net/java/games/joal/util/BufferUtils.java
@@ -1,165 +1,266 @@
-/**
-* 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.
-*/
+/*
+ * 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
+ * MICROSYSTEMS, 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.
+ *
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
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;
-
-
-/**
- * Provides a collection of methods for generating direct Buffers of various
- * types.
- *
- * @author Athomas Goldberg
- */
+import java.nio.*;
+import java.util.*;
+
+/** Utility routines for dealing with direct buffers. */
+
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;
- }
-
- /**
- * Create a new direct CharBuffer of the specified size.
- *
- * @param size (in chars) of the returned CharBuffer
- *
- * @return a new direct CharBuffer of the specified size
- */
- public static CharBuffer newCharBuffer(int size) {
- CharBuffer result = null;
- ByteBuffer temp = newByteBuffer(size * CHAR);
- result = temp.asCharBuffer();
-
- return result;
- }
-
- /**
- * Create a new direct ShortBuffer of the specified size.
- *
- * @param size (in shorts) of the returned ShortBuffer
- *
- * @return a new direct ShortBuffer of the specified size
- */
- public static ShortBuffer newShortBuffer(int size) {
- ShortBuffer result = null;
- ByteBuffer temp = newByteBuffer(size * SHORT);
- result = temp.asShortBuffer();
-
- return result;
- }
-
- /**
- * Create a new direct IntBuffer of the specified size.
- *
- * @param size (in ints) of the returned IntBuffer
- *
- * @return a new direct IntBuffer of the specified size
- */
- public static IntBuffer newIntBuffer(int size) {
- IntBuffer result = null;
- ByteBuffer temp = newByteBuffer(size * INT);
- result = temp.asIntBuffer();
-
- return result;
- }
-
- /**
- * Create a new direct LongBuffer of the specified size.
- *
- * @param size (in longs) of the returned LongBuffer
- *
- * @return a new direct LongsBuffer of the specified size
- */
- public static LongBuffer newLongBuffer(int size) {
- LongBuffer result = null;
- ByteBuffer temp = newByteBuffer(size * LONG);
- result = temp.asLongBuffer();
-
- return result;
- }
-
- /**
- * Create a new direct FloatBuffer of the specified size.
- *
- * @param size (in floats) of the returned FloatBuffer
- *
- * @return a new direct FloatBuffer of the specified size
- */
- public static FloatBuffer newFloatBuffer(int size) {
- FloatBuffer result = null;
- ByteBuffer temp = newByteBuffer(size * FLOAT);
- result = temp.asFloatBuffer();
-
- return result;
- }
-
- /**
- * Create a new direct DoubleBuffer of the specified size.
- *
- * @param size (in doubles) of the returned DoubleBuffer
- *
- * @return a new direct DoubleBuffer of the specified size
- */
- public static DoubleBuffer newDoubleBuffer(int size) {
- DoubleBuffer result = null;
- ByteBuffer temp = newByteBuffer(size * DOUBLE);
- result = temp.asDoubleBuffer();
- return result;
- }
+ public static final int SIZEOF_BYTE = 1;
+ public static final int SIZEOF_SHORT = 2;
+ public static final int SIZEOF_INT = 4;
+ public static final int SIZEOF_FLOAT = 4;
+ public static final int SIZEOF_LONG = 8;
+ public static final int SIZEOF_DOUBLE = 8;
+
+ //----------------------------------------------------------------------
+ // Allocation routines
+ //
+
+ /** Allocates a new direct ByteBuffer with the specified number of
+ elements. The returned buffer will have its byte order set to
+ the host platform's native byte order. */
+ public static ByteBuffer newByteBuffer(int numElements) {
+ ByteBuffer bb = ByteBuffer.allocateDirect(numElements);
+ bb.order(ByteOrder.nativeOrder());
+ return bb;
+ }
+
+ /** Allocates a new direct DoubleBuffer with the specified number of
+ elements. The returned buffer will have its byte order set to
+ the host platform's native byte order. */
+ public static DoubleBuffer newDoubleBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_DOUBLE);
+ return bb.asDoubleBuffer();
+ }
+
+ /** Allocates a new direct FloatBuffer with the specified number of
+ elements. The returned buffer will have its byte order set to
+ the host platform's native byte order. */
+ public static FloatBuffer newFloatBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT);
+ return bb.asFloatBuffer();
+ }
+
+ /** Allocates a new direct IntBuffer with the specified number of
+ elements. The returned buffer will have its byte order set to
+ the host platform's native byte order. */
+ public static IntBuffer newIntBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT);
+ return bb.asIntBuffer();
+ }
+
+ /** Allocates a new direct LongBuffer with the specified number of
+ elements. The returned buffer will have its byte order set to
+ the host platform's native byte order. */
+ public static LongBuffer newLongBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_LONG);
+ return bb.asLongBuffer();
+ }
+
+ /** Allocates a new direct ShortBuffer with the specified number of
+ elements. The returned buffer will have its byte order set to
+ the host platform's native byte order. */
+ public static ShortBuffer newShortBuffer(int numElements) {
+ ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT);
+ return bb.asShortBuffer();
+ }
+
+ //----------------------------------------------------------------------
+ // Copy routines (type-to-type)
+ //
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed ByteBuffer into
+ a newly-allocated direct ByteBuffer. The returned buffer will
+ have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining());
+ orig.mark();
+ dest.put(orig);
+ orig.reset();
+ dest.rewind();
+ return dest;
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed DoubleBuffer
+ into a newly-allocated direct DoubleBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static DoubleBuffer copyDoubleBuffer(DoubleBuffer orig) {
+ return copyDoubleBufferAsByteBuffer(orig).asDoubleBuffer();
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed FloatBuffer
+ into a newly-allocated direct FloatBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static FloatBuffer copyFloatBuffer(FloatBuffer orig) {
+ return copyFloatBufferAsByteBuffer(orig).asFloatBuffer();
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed IntBuffer
+ into a newly-allocated direct IntBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static IntBuffer copyIntBuffer(IntBuffer orig) {
+ return copyIntBufferAsByteBuffer(orig).asIntBuffer();
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed LongBuffer
+ into a newly-allocated direct LongBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static LongBuffer copyLongBuffer(LongBuffer orig) {
+ return copyLongBufferAsByteBuffer(orig).asLongBuffer();
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed ShortBuffer
+ into a newly-allocated direct ShortBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ShortBuffer copyShortBuffer(ShortBuffer orig) {
+ return copyShortBufferAsByteBuffer(orig).asShortBuffer();
+ }
+
+ //----------------------------------------------------------------------
+ // Copy routines (type-to-ByteBuffer)
+ //
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed DoubleBuffer
+ into a newly-allocated direct ByteBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyDoubleBufferAsByteBuffer(DoubleBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_DOUBLE);
+ orig.mark();
+ dest.asDoubleBuffer().put(orig);
+ orig.reset();
+ dest.rewind();
+ return dest;
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed FloatBuffer
+ into a newly-allocated direct ByteBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT);
+ orig.mark();
+ dest.asFloatBuffer().put(orig);
+ orig.reset();
+ dest.rewind();
+ return dest;
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed IntBuffer into
+ a newly-allocated direct ByteBuffer. The returned buffer will
+ have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT);
+ orig.mark();
+ dest.asIntBuffer().put(orig);
+ orig.reset();
+ dest.rewind();
+ return dest;
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed LongBuffer into
+ a newly-allocated direct ByteBuffer. The returned buffer will
+ have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyLongBufferAsByteBuffer(LongBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_LONG);
+ orig.mark();
+ dest.asLongBuffer().put(orig);
+ orig.reset();
+ dest.rewind();
+ return dest;
+ }
+
+ /** Copies the <i>remaining</i> elements (as defined by
+ <code>limit() - position()</code>) in the passed ShortBuffer
+ into a newly-allocated direct ByteBuffer. The returned buffer
+ will have its byte order set to the host platform's native byte
+ order. The position of the newly-allocated buffer will be zero,
+ and the position of the passed buffer is unchanged (though its
+ mark is changed). */
+ public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) {
+ ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT);
+ orig.mark();
+ dest.asShortBuffer().put(orig);
+ orig.reset();
+ dest.rewind();
+ return dest;
+ }
}
diff --git a/src/java/net/java/games/joal/util/Version.java b/src/java/net/java/games/joal/util/Version.java
new file mode 100755
index 0000000..51cff25
--- /dev/null
+++ b/src/java/net/java/games/joal/util/Version.java
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2005 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 MICROSYSTEMS, 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;
+
+/**
+ * The version and build number of this implementation.
+ * Version numbers for a release are of the form: w.x.y[-a]-z, where:
+ * <ul>
+ * <li>
+ * w - the major version number of the release. This number should
+ * start at 1. Typically, a bump in the major version number
+ * signifies that the release breaks backwards compatibility
+ * with some older release.
+ * </li>
+ * <li>
+ * x - minor version number. This number starts at 0. A bump in
+ * the minor version number signifies a release that has significant
+ * new functionality.
+ * </li>
+ * <li>
+ * y - minor-minor version number number. This number starts at 0. A
+ * bump in the minor-minor version number signifies that new bug
+ * fixes have been added to the build.
+ * </li>
+ * <li>
+ * a - an optional build designator followed by a digit. Valid build
+ * designators are:
+ * <ul>
+ * <li>alpha</li>
+ * <li>beta</li>
+ * </ul>
+ * </li>
+ * <li>
+ * z - build number. This is used to specify the build number of the
+ * release. This is usually only important to people that use
+ * the daily build of a project. The format is the lower-case
+ * letter 'b' followed by a two digit number.
+ * </li>
+ * </ul>
+ *
+ * For example, the following are all valid version strings:
+ * <ul>
+ * <li>1.1.2-b02</li>
+ * <li>1.3.5-alpha1-b19</li>
+ * <li>4.7.1-beta3-b20</li>
+ * </ul>
+ *
+ */
+public final class Version {
+
+ /**
+ * Private constructor - no need for user to create
+ * an instance of this class.
+ */
+ private Version() {
+ }
+
+ /**
+ * Version string of this build.
+ */
+ private static final String version = "1.1.0-b01";
+
+ /**
+ * Returns the version string and build number of
+ * this implementation. See the class description
+ * for the version string format.
+ *
+ * @return The version string of this implementation.
+ */
+ public static String getVersion() {
+ return version;
+ }
+}
diff --git a/src/java/net/java/games/joal/util/WAVData.java b/src/java/net/java/games/joal/util/WAVData.java
index 9ab9e46..c0584e9 100644
--- a/src/java/net/java/games/joal/util/WAVData.java
+++ b/src/java/net/java/games/joal/util/WAVData.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
diff --git a/src/java/net/java/games/joal/util/WAVLoader.java b/src/java/net/java/games/joal/util/WAVLoader.java
index 4cb2836..e7a5257 100644
--- a/src/java/net/java/games/joal/util/WAVLoader.java
+++ b/src/java/net/java/games/joal/util/WAVLoader.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
@@ -33,20 +33,12 @@
package net.java.games.joal.util;
-import net.java.games.joal.ALConstants;
-
-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 java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+import javax.sound.sampled.*;
+import net.java.games.joal.*;
/**
* A Loader utility for (.wav) files. Creates a WAVData object containing the
@@ -74,6 +66,31 @@ public class WAVLoader implements ALConstants {
WAVData result = null;
File soundFile = new File(filename);
AudioInputStream aIn = AudioSystem.getAudioInputStream(soundFile);
+ return readFromStream(aIn);
+ }
+
+ /**
+ * This method loads a (.wav) file into a WAVData object.
+ *
+ * @param stream An InputStream for the .WAV file.
+ *
+ * @return a WAVData object containing the audio data
+ *
+ * @throws UnsupportedAudioFileException if the format of the audio if not
+ * supported.
+ * @throws IOException If the file can no be found or some other IO error
+ * occurs
+ */
+ public static WAVData loadFromStream(InputStream stream)
+ throws UnsupportedAudioFileException, IOException {
+ WAVData result = null;
+ AudioInputStream aIn = AudioSystem.getAudioInputStream(stream);
+ return readFromStream(aIn);
+ }
+
+
+ private static WAVData readFromStream(AudioInputStream aIn)
+ throws UnsupportedAudioFileException, IOException {
ReadableByteChannel aChannel = Channels.newChannel(aIn);
AudioFormat fmt = aIn.getFormat();
int numChannels = fmt.getChannels();
@@ -93,8 +110,24 @@ public class WAVLoader implements ALConstants {
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);
+ while (buffer.remaining() > 0) {
+ aChannel.read(buffer);
+ }
+ buffer.rewind();
+
+ // Must byte swap on big endian platforms
+ // Thanks to swpalmer on javagaming.org forums for hint at fix
+ if ((bits == 16) && (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN)) {
+ int len = buffer.remaining();
+ for (int i = 0; i < len; i += 2) {
+ byte a = buffer.get(i);
+ byte b = buffer.get(i+1);
+ buffer.put(i, b);
+ buffer.put(i+1, a);
+ }
+ }
+
+ WAVData 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
index 8dc4ba3..ea1affa 100644
--- a/src/java/net/java/games/sound3d/AudioSystem3D.java
+++ b/src/java/net/java/games/sound3d/AudioSystem3D.java
@@ -1,42 +1,39 @@
/**
-* 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.
-*/
+ * 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 MICROSYSTEMS, 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;
-import net.java.games.joal.ALC;
-import net.java.games.joal.ALFactory;
-import net.java.games.joal.OpenALException;
+import net.java.games.joal.*;
import net.java.games.joal.util.WAVData;
import net.java.games.joal.util.WAVLoader;
@@ -52,180 +49,175 @@ import javax.sound.sampled.UnsupportedAudioFileException;
* @author Athomas Goldberg
*/
public class AudioSystem3D {
- private static AL al;
- private static ALC alc;
- private static Listener listener;
-
- /**
- * Iniitalize the Sound3D environment. This must be called before
- * other methods in the class can be used.
- */
- public static void init() throws Sound3DException {
- try {
- ALFactory.initialize();
- al = ALFactory.getAL();
- alc = ALFactory.getALC();
- } catch (OpenALException e) {
- throw new Sound3DException("Could not initialize AudioSystem3D: ",e);
- }
- }
-
- /**
- * Creates a new Sound3D Context for a specified device.
- *
- * @param device The device the Context is being created for.
- *
- * @return The new Sound3D context.
- */
- 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;
+ private static AL al;
+ private static ALC alc;
+ private static Listener listener;
+
+ /**
+ * Iniitalize the Sound3D environment. This must be called before
+ * other methods in the class can be used.
+ */
+ public static void init() throws ALException {
+ al = ALFactory.getAL();
+ alc = ALFactory.getALC();
+ }
+
+ /**
+ * Creates a new Sound3D Context for a specified device.
+ *
+ * @param device The device the Context is being created for.
+ *
+ * @return The new Sound3D context.
+ */
+ public static Context createContext(Device device) {
+ Context result = null;
+ ALCcontext realContext = alc.alcCreateContext(device.realDevice, null);
+ result = new Context(alc, realContext, device);
+ return result;
+ }
+
+ /**
+ * Makes the specified context the current context.
+ *
+ * @param context the context to make current.
+ */
+ public static void makeContextCurrent(Context context) {
+ ALCcontext realContext = null;
+
+ if (context != null) {
+ realContext = context.realContext;
}
- /**
- * Makes the specified context the current context.
- *
- * @param context the context to make current.
- */
- public static void makeContextCurrent(Context context) {
- ALC.Context realContext = null;
-
- if (context != null) {
- realContext = context.realContext;
- }
-
- alc.alcMakeContextCurrent(realContext);
+ alc.alcMakeContextCurrent(realContext);
+ }
+
+ /**
+ * Opens the specifified audio device.
+ *
+ * @param deviceName The specified device name, On windows this will be
+ * DirectSound3D. We will be automating device discovery in upcoming versions
+ * of this class.
+ *
+ * @return The device described by the specifed name.
+ */
+ public static Device openDevice(String deviceName) {
+ Device result = null;
+ ALCdevice realDevice = alc.alcOpenDevice(deviceName);
+ result = new Device(alc, realDevice);
+
+ return result;
+ }
+
+ /**
+ * Generate an array of Sound3D buffers.
+ *
+ * @param numBuffers The number of Sound3D buffers to generate.
+ *
+ * @return an array of (initially enpty) Sound3D buffers.
+ */
+ public static Buffer[] generateBuffers(int numBuffers) {
+ Buffer[] result = new Buffer[numBuffers];
+ int[] arr = new int[numBuffers];
+ al.alGenBuffers(numBuffers, arr, 0);
+
+ for (int i = 0; i < numBuffers; i++) {
+ result[i] = new Buffer(al, arr[i]);
}
- /**
- * Opens the specifified audio device.
- *
- * @param deviceName The specified device name, On windows this will be
- * DirectSound3D. We will be automating device discovery in upcoming versions
- * of this class.
- *
- * @return The device described by the specifed name.
- */
- public static Device openDevice(String deviceName) {
- Device result = null;
- ALC.Device realDevice = alc.alcOpenDevice(deviceName);
- result = new Device(alc, realDevice);
-
- return result;
+ return result;
+ }
+
+ /**
+ * Loads a Sound3D buffer with the specified audio file.
+ *
+ * @param filename the name of the file to load.
+ *
+ * @return a new Sound3D buffer containing the audio data from the
+ * specified file.
+ *
+ * @throws IOException If the file cannot be found or some other IO error
+ * occurs.
+ * @throws UnsupportedAudioFileException If the format of the sudio data is
+ * not supported
+ */
+ 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;
+ }
+
+ /**
+ * Loads a Sound3D Source with the specified audio file. This is
+ * functionally equivelant to generateSource(loadBuffer(fileName));
+ *
+ * @param filename the name of the file to load.
+ *
+ * @return a new Sound3D Source containing the audio data from the
+ * specified file.
+ *
+ * @throws IOException If the file cannot be found or some other IO error
+ * occurs.
+ * @throws UnsupportedAudioFileException If the format of the sudio data is
+ * not supported
+ */
+ public static Source loadSource(String filename)
+ throws IOException, UnsupportedAudioFileException {
+ Buffer buffer = loadBuffer(filename);
+
+ return generateSource(buffer);
+ }
+
+ /**
+ * Generates a set of uninitialized Source3D sources
+ *
+ * @param numSources the number of Sound3D sources to generate.
+ *
+ * @return an array of uninitialized sources.
+ */
+ public static Source[] generateSources(int numSources) {
+ Source[] result = new Source[numSources];
+ int[] arr = new int[numSources];
+ al.alGenSources(numSources, arr, 0);
+
+ for (int i = 0; i < numSources; i++) {
+ result[i] = new Source(al, arr[i]);
}
- /**
- * Generate an array of Sound3D buffers.
- *
- * @param numBuffers The number of Sound3D buffers to generate.
- *
- * @return an array of (initially enpty) Sound3D buffers.
- */
- 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;
+ return result;
+ }
+
+ /**
+ * Generate a Sound3D source from an initialized Buffer.
+ *
+ * @param buff The buffer to generate the source from.
+ *
+ * @return the newly generated Source.
+ */
+ public static Source generateSource(Buffer buff) {
+ Source result = null;
+ Source[] tmp = generateSources(1);
+ result = tmp[0];
+ result.setBuffer(buff);
+
+ return result;
+ }
+
+ /**
+ * Get the listener object associated with this Sound3D environment.
+ *
+ * @return The listener object.
+ */
+ public static Listener getListener() {
+ if (listener == null) {
+ listener = new Listener(al);
}
- /**
- * Loads a Sound3D buffer with the specified audio file.
- *
- * @param filename the name of the file to load.
- *
- * @return a new Sound3D buffer containing the audio data from the
- * specified file.
- *
- * @throws IOException If the file cannot be found or some other IO error
- * occurs.
- * @throws UnsupportedAudioFileException If the format of the sudio data is
- * not supported
- */
- 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;
- }
-
- /**
- * Loads a Sound3D Source with the specified audio file. This is
- * functionally equivelant to generateSource(loadBuffer(fileName));
- *
- * @param filename the name of the file to load.
- *
- * @return a new Sound3D Source containing the audio data from the
- * specified file.
- *
- * @throws IOException If the file cannot be found or some other IO error
- * occurs.
- * @throws UnsupportedAudioFileException If the format of the sudio data is
- * not supported
- */
- public static Source loadSource(String filename)
- throws IOException, UnsupportedAudioFileException {
- Buffer buffer = loadBuffer(filename);
-
- return generateSource(buffer);
- }
-
- /**
- * Generates a set of uninitialized Source3D sources
- *
- * @param numSources the number of Sound3D sources to generate.
- *
- * @return an array of uninitialized sources.
- */
- 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;
- }
-
- /**
- * Generate a Sound3D source from an initialized Buffer.
- *
- * @param buff The buffer to generate the source from.
- *
- * @return the newly generated Source.
- */
- public static Source generateSource(Buffer buff) {
- Source result = null;
- Source[] tmp = generateSources(1);
- result = tmp[0];
- result.setBuffer(buff);
-
- return result;
- }
-
- /**
- * Get the listener object associated with this Sound3D environment.
- *
- * @return The listener object.
- */
- public static Listener getListener() {
- if (listener == null) {
- listener = new Listener(al);
- }
-
- return listener;
- }
+ return listener;
+ }
}
diff --git a/src/java/net/java/games/sound3d/Buffer.java b/src/java/net/java/games/sound3d/Buffer.java
index cd666ae..70ad188 100644
--- a/src/java/net/java/games/sound3d/Buffer.java
+++ b/src/java/net/java/games/sound3d/Buffer.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
@@ -81,7 +81,7 @@ public class Buffer {
*/
public void delete() {
data = null;
- al.alDeleteBuffers(1, new int[] { bufferID });
+ al.alDeleteBuffers(1, new int[] { bufferID }, 0);
}
/**
@@ -91,7 +91,7 @@ public class Buffer {
*/
public int getBitDepth() {
int[] i = new int[1];
- al.alGetBufferi(bufferID, AL.AL_BITS, i);
+ al.alGetBufferi(bufferID, AL.AL_BITS, i, 0);
return i[0];
}
@@ -103,7 +103,7 @@ public class Buffer {
*/
public int getNumChannels() {
int[] i = new int[1];
- al.alGetBufferi(bufferID, AL.AL_CHANNELS, i);
+ al.alGetBufferi(bufferID, AL.AL_CHANNELS, i, 0);
return i[0];
}
@@ -124,7 +124,7 @@ public class Buffer {
*/
public int getFrequency() {
int[] i = new int[1];
- al.alGetBufferi(bufferID, AL.AL_FREQUENCY, i);
+ al.alGetBufferi(bufferID, AL.AL_FREQUENCY, i, 0);
return i[0];
}
@@ -136,7 +136,7 @@ public class Buffer {
*/
public int getSize() {
int[] i = new int[1];
- al.alGetBufferi(bufferID, AL.AL_SIZE, i);
+ al.alGetBufferi(bufferID, AL.AL_SIZE, i, 0);
return i[0];
}
diff --git a/src/java/net/java/games/sound3d/Context.java b/src/java/net/java/games/sound3d/Context.java
index 8b442a6..49344cd 100644
--- a/src/java/net/java/games/sound3d/Context.java
+++ b/src/java/net/java/games/sound3d/Context.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
@@ -33,7 +33,7 @@
package net.java.games.sound3d;
-import net.java.games.joal.ALC;
+import net.java.games.joal.*;
/**
@@ -43,10 +43,10 @@ import net.java.games.joal.ALC;
*/
public class Context {
private final ALC alc;
- final ALC.Context realContext;
+ final ALCcontext realContext;
final Device device;
- Context(ALC alc, ALC.Context realContext, Device device) {
+ Context(ALC alc, ALCcontext realContext, Device device) {
this.alc = alc;
this.realContext = realContext;
this.device = device;
diff --git a/src/java/net/java/games/sound3d/Device.java b/src/java/net/java/games/sound3d/Device.java
index 44879a3..96c352b 100644
--- a/src/java/net/java/games/sound3d/Device.java
+++ b/src/java/net/java/games/sound3d/Device.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
@@ -33,7 +33,7 @@
package net.java.games.sound3d;
-import net.java.games.joal.ALC;
+import net.java.games.joal.*;
/**
@@ -43,9 +43,9 @@ import net.java.games.joal.ALC;
*/
public class Device {
private final ALC alc;
- final ALC.Device realDevice;
+ final ALCdevice realDevice;
- Device(ALC alc, ALC.Device realDevice) {
+ Device(ALC alc, ALCdevice realDevice) {
this.alc = alc;
this.realDevice = realDevice;
}
diff --git a/src/java/net/java/games/sound3d/Listener.java b/src/java/net/java/games/sound3d/Listener.java
index d80c8d0..b25320c 100644
--- a/src/java/net/java/games/sound3d/Listener.java
+++ b/src/java/net/java/games/sound3d/Listener.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
@@ -68,7 +68,7 @@ public class Listener {
*/
public float getGain() {
float[] f = new float[1];
- al.alGetListenerf(AL.AL_GAIN, f);
+ al.alGetListenerf(AL.AL_GAIN, f, 0);
return f[0];
}
@@ -109,7 +109,7 @@ public class Listener {
public Vec3f getPosition() {
Vec3f result = null;
float[] tmp = new float[3];
- al.alGetListenerfv(AL.AL_POSITION, tmp);
+ al.alGetListenerfv(AL.AL_POSITION, tmp, 0);
result = new Vec3f(tmp[0], tmp[1], tmp[2]);
return result;
@@ -136,7 +136,7 @@ public class Listener {
public Vec3f getVelocity() {
Vec3f result = null;
float[] tmp = new float[3];
- al.alGetListenerfv(AL.AL_VELOCITY, tmp);
+ al.alGetListenerfv(AL.AL_VELOCITY, tmp, 0);
result = new Vec3f(tmp[0], tmp[1], tmp[2]);
return result;
@@ -151,7 +151,7 @@ public class Listener {
* look-at vector.
*/
public void setOrientation(float[] orientation) {
- al.alListenerfv(AL.AL_ORIENTATION, orientation);
+ al.alListenerfv(AL.AL_ORIENTATION, orientation, 0);
}
/**
@@ -165,7 +165,7 @@ public class Listener {
*/
public float[] getOrientation() {
float[] tmp = new float[6];
- al.alGetListenerfv(AL.AL_ORIENTATION, tmp);
+ al.alGetListenerfv(AL.AL_ORIENTATION, tmp, 0);
return tmp;
}
}
diff --git a/src/java/net/java/games/sound3d/Sound3DException.java b/src/java/net/java/games/sound3d/Sound3DException.java
deleted file mode 100644
index 6b927ca..0000000
--- a/src/java/net/java/games/sound3d/Sound3DException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Created on Nov 22, 2003
- *
- * To change the template for this generated file go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-package net.java.games.sound3d;
-
-/**
- * @author athomas
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class Sound3DException extends Exception {
-
- /**
- *
- */
- public Sound3DException() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param arg0
- */
- public Sound3DException(String arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param arg0
- */
- public Sound3DException(Throwable arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public Sound3DException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- // TODO Auto-generated constructor stub
- }
-
-}
diff --git a/src/java/net/java/games/sound3d/Source.java b/src/java/net/java/games/sound3d/Source.java
index 5e4183d..f5655be 100644
--- a/src/java/net/java/games/sound3d/Source.java
+++ b/src/java/net/java/games/sound3d/Source.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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
@@ -85,7 +85,7 @@ public final class Source {
* Delete this source, freeing its resources.
*/
public void delete() {
- al.alDeleteSources(1, new int[] { sourceID });
+ al.alDeleteSources(1, new int[] { sourceID }, 0);
}
/**
@@ -106,7 +106,7 @@ public final class Source {
*/
public float getPitch() {
float[] result = new float[1];
- al.alGetSourcef(sourceID, AL.AL_PITCH, result);
+ al.alGetSourcef(sourceID, AL.AL_PITCH, result, 0);
return result[0];
}
@@ -129,7 +129,7 @@ public final class Source {
*/
public float getGain() {
float[] result = new float[1];
- al.alGetSourcef(sourceID, AL.AL_GAIN, result);
+ al.alGetSourcef(sourceID, AL.AL_GAIN, result, 0);
return result[0];
}
@@ -152,7 +152,7 @@ public final class Source {
*/
public float getMaxDistance() {
float[] result = new float[1];
- al.alGetSourcef(sourceID, AL.AL_MAX_DISTANCE, result);
+ al.alGetSourcef(sourceID, AL.AL_MAX_DISTANCE, result, 0);
return result[0];
}
@@ -173,7 +173,7 @@ public final class Source {
*/
public float getRolloffFactor() {
float[] result = new float[1];
- al.alGetSourcef(sourceID, AL.AL_ROLLOFF_FACTOR, result);
+ al.alGetSourcef(sourceID, AL.AL_ROLLOFF_FACTOR, result, 0);
return result[0];
}
@@ -196,7 +196,7 @@ public final class Source {
*/
public float getReferenceDistance() {
float[] result = new float[1];
- al.alGetSourcef(sourceID, AL.AL_REFERENCE_DISTANCE, result);
+ al.alGetSourcef(sourceID, AL.AL_REFERENCE_DISTANCE, result, 0);
return result[0];
}
@@ -217,7 +217,7 @@ public final class Source {
*/
public float getMinGain() {
float[] result = new float[1];
- al.alGetSourcef(sourceID, AL.AL_MIN_GAIN, result);
+ al.alGetSourcef(sourceID, AL.AL_MIN_GAIN, result, 0);
return result[0];
}
@@ -238,7 +238,7 @@ public final class Source {
*/
public float getMaxGain() {
float[] result = new float[1];
- al.alGetSourcef(sourceID, AL.AL_MAX_GAIN, result);
+ al.alGetSourcef(sourceID, AL.AL_MAX_GAIN, result, 0);
return result[0];
}
@@ -259,7 +259,7 @@ public final class Source {
*/
public float getConeOuterGain() {
float[] result = new float[1];
- al.alGetSourcef(sourceID, AL.AL_CONE_OUTER_GAIN, result);
+ al.alGetSourcef(sourceID, AL.AL_CONE_OUTER_GAIN, result, 0);
return result[0];
}
@@ -299,7 +299,7 @@ public final class Source {
public Vec3f getPosition() {
Vec3f result = null;
float[] pos = new float[3];
- al.alGetSourcefv(sourceID, AL.AL_POSITION, pos);
+ al.alGetSourcefv(sourceID, AL.AL_POSITION, pos, 0);
result = new Vec3f(pos[0], pos[1], pos[2]);
return result;
@@ -338,7 +338,7 @@ public final class Source {
public Vec3f getVelocity() {
Vec3f result = null;
float[] vel = new float[3];
- al.alGetSourcefv(sourceID, AL.AL_VELOCITY, vel);
+ al.alGetSourcefv(sourceID, AL.AL_VELOCITY, vel, 0);
result = new Vec3f(vel[0], vel[1], vel[2]);
return result;
@@ -377,7 +377,7 @@ public final class Source {
public Vec3f getDirection() {
Vec3f result = null;
float[] dir = new float[3];
- al.alGetSourcefv(sourceID, AL.AL_DIRECTION, dir);
+ al.alGetSourcefv(sourceID, AL.AL_DIRECTION, dir, 0);
result = new Vec3f(dir[0], dir[1], dir[2]);
return result;
@@ -404,7 +404,7 @@ public final class Source {
*/
public boolean isSourceRelative() {
int[] result = new int[1];
- al.alGetSourcei(sourceID, AL.AL_SOURCE_RELATIVE, result);
+ al.alGetSourcei(sourceID, AL.AL_SOURCE_RELATIVE, result, 0);
return result[0] == 1;
}
@@ -427,7 +427,7 @@ public final class Source {
public boolean getLooping() {
boolean result = false;
int[] tmp = new int[1];
- al.alGetSourcei(sourceID, AL.AL_LOOPING, tmp);
+ al.alGetSourcei(sourceID, AL.AL_LOOPING, tmp, 0);
return tmp[0] == AL.AL_TRUE;
}
@@ -438,7 +438,7 @@ public final class Source {
*/
public int getBuffersQueued() {
int[] result = new int[1];
- al.alGetSourcei(sourceID, AL.AL_BUFFERS_QUEUED, result);
+ al.alGetSourcei(sourceID, AL.AL_BUFFERS_QUEUED, result, 0);
return result[0];
}
@@ -449,7 +449,7 @@ public final class Source {
*/
public int getBuffersProcessed() {
int[] result = new int[1];
- al.alGetSourcei(sourceID, AL.AL_BUFFERS_PROCESSED, result);
+ al.alGetSourcei(sourceID, AL.AL_BUFFERS_PROCESSED, result, 0);
return result[0];
}
@@ -487,7 +487,7 @@ public final class Source {
arr[i] = buffers[i].bufferID;
}
- al.alSourceQueueBuffers(sourceID, numBuffers, arr);
+ al.alSourceQueueBuffers(sourceID, numBuffers, arr, 0);
}
/**
@@ -503,6 +503,6 @@ public final class Source {
arr[i] = buffers[i].bufferID;
}
- al.alSourceUnqueueBuffers(sourceID, numBuffers, arr);
+ al.alSourceUnqueueBuffers(sourceID, numBuffers, arr, 0);
}
}
diff --git a/src/java/net/java/games/sound3d/Vec3f.java b/src/java/net/java/games/sound3d/Vec3f.java
index f6f494b..71b1d92 100644
--- a/src/java/net/java/games/sound3d/Vec3f.java
+++ b/src/java/net/java/games/sound3d/Vec3f.java
@@ -18,7 +18,7 @@
* 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
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, 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