From 5f9e58c5b1a23119a63dfb1e76e73349858439db Mon Sep 17 00:00:00 2001 From: athomas Date: Sat, 7 Jun 2003 00:24:00 +0000 Subject: Initial check-in of project files git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@21 03bf7f67-59de-4072-a415-9a990d468a3f --- src/java/build.xml | 79 ++ src/java/net/java/games/joal/AL.java | 1260 ++++++++++++++++++++ src/java/net/java/games/joal/ALC.java | 259 ++++ src/java/net/java/games/joal/ALCConstants.java | 95 ++ src/java/net/java/games/joal/ALCImpl.java | 177 +++ src/java/net/java/games/joal/ALConstants.java | 348 ++++++ src/java/net/java/games/joal/ALFactory.java | 105 ++ src/java/net/java/games/joal/ALImpl.java | 905 ++++++++++++++ src/java/net/java/games/joal/eax/EAX.java | 140 +++ src/java/net/java/games/joal/eax/EAXConstants.java | 350 ++++++ src/java/net/java/games/joal/eax/EAXFactory.java | 59 + src/java/net/java/games/joal/util/BufferUtils.java | 166 +++ src/java/net/java/games/joal/util/WAVData.java | 57 + src/java/net/java/games/joal/util/WAVLoader.java | 87 ++ src/java/net/java/games/sound3d/AudioSystem3D.java | 215 ++++ src/java/net/java/games/sound3d/Buffer.java | 140 +++ src/java/net/java/games/sound3d/Context.java | 64 + src/java/net/java/games/sound3d/Device.java | 54 + src/java/net/java/games/sound3d/Listener.java | 95 ++ src/java/net/java/games/sound3d/Source.java | 286 +++++ src/java/net/java/games/sound3d/Vec3f.java | 52 + src/native/albind.c | 720 +++++++++++ src/native/albind.h | 703 +++++++++++ src/native/alcbind.c | 140 +++ src/native/alcbind.h | 148 +++ src/native/alfactory.c | 47 + src/native/alfactory.h | 66 + src/native/build.xml | 71 ++ src/native/eaxbind.c | 85 ++ src/native/eaxbind.h | 63 + src/native/eaxfactory.c | 50 + src/native/eaxfactory.h | 58 + src/native/extal.c | 416 +++++++ src/native/extal.h | 315 +++++ 34 files changed, 7875 insertions(+) create mode 100644 src/java/build.xml create mode 100644 src/java/net/java/games/joal/AL.java create mode 100644 src/java/net/java/games/joal/ALC.java create mode 100644 src/java/net/java/games/joal/ALCConstants.java create mode 100644 src/java/net/java/games/joal/ALCImpl.java create mode 100644 src/java/net/java/games/joal/ALConstants.java create mode 100644 src/java/net/java/games/joal/ALFactory.java create mode 100644 src/java/net/java/games/joal/ALImpl.java create mode 100644 src/java/net/java/games/joal/eax/EAX.java create mode 100644 src/java/net/java/games/joal/eax/EAXConstants.java create mode 100644 src/java/net/java/games/joal/eax/EAXFactory.java create mode 100644 src/java/net/java/games/joal/util/BufferUtils.java create mode 100644 src/java/net/java/games/joal/util/WAVData.java create mode 100644 src/java/net/java/games/joal/util/WAVLoader.java create mode 100644 src/java/net/java/games/sound3d/AudioSystem3D.java create mode 100644 src/java/net/java/games/sound3d/Buffer.java create mode 100644 src/java/net/java/games/sound3d/Context.java create mode 100644 src/java/net/java/games/sound3d/Device.java create mode 100644 src/java/net/java/games/sound3d/Listener.java create mode 100644 src/java/net/java/games/sound3d/Source.java create mode 100644 src/java/net/java/games/sound3d/Vec3f.java create mode 100644 src/native/albind.c create mode 100644 src/native/albind.h create mode 100644 src/native/alcbind.c create mode 100644 src/native/alcbind.h create mode 100644 src/native/alfactory.c create mode 100644 src/native/alfactory.h create mode 100644 src/native/build.xml create mode 100644 src/native/eaxbind.c create mode 100644 src/native/eaxbind.h create mode 100644 src/native/eaxfactory.c create mode 100644 src/native/eaxfactory.h create mode 100644 src/native/extal.c create mode 100644 src/native/extal.h (limited to 'src') diff --git a/src/java/build.xml b/src/java/build.xml new file mode 100644 index 0000000..7a1a68c --- /dev/null +++ b/src/java/build.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/java/net/java/games/joal/AL.java b/src/java/net/java/games/joal/AL.java new file mode 100644 index 0000000..e5c155d --- /dev/null +++ b/src/java/net/java/games/joal/AL.java @@ -0,0 +1,1260 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal; + +import java.nio.ByteBuffer; + + +/** + * This class contains the core OpenAL functions + * + * @author Athomas Goldberg + */ +public interface AL extends ALConstants { + // AL_BUFFER RELATED METHODS + + /** + * This method generates one or more buffers.
+ *
+ * Interface to C language function: + *
ALvoid alGenBuffers(ALsizei n, ALuint *buffers);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alGenBuffers(ALsizei n, ALuint *buffers);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alDeleteBuffers(ALsizei n, ALuint *buffers);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alDeleteBuffers(ALsizei n, ALuint *buffers);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALboolean alIsBuffer(ALuint buffer);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alBufferData(ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alBufferData(ALuint buffer, ALenum format, ALvoid *data, ALsizei size, ALsizei freq);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alGetBufferf(ALuint buffer, ALuint pname, float value);
+ *

+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alGetBufferf(ALuint buffer, ALuint pname, ALfloat *value);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alGetBufferf(ALuint buffer, ALuint pname, ALfloat *value);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alGetBufferi(ALuint buffer, ALuint pname, ALint *value);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alGetBufferi(ALuint buffer, ALuint pname, ALint value);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alGetBufferi(ALuint buffer, ALuint pname, ALint *value);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alGenSources(ALsizei n, ALuint *sources);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alGenSources(ALsizei n, ALuint *sources);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alDeleteSources(ALsizei n, ALuint *sources);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alDeleteSources(ALsizei n, ALuint *sources);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alDeleteSources(ALsizei n, ALuint *sources);
+ * + * @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.
+ *
+ * Interface to C language function: + *
ALvoid alSourcei(ALuint sourceID, ALuint pname, ALfloat value);
+ * + * @param sourceID source ID whose attribute is being set + * @param pname the name of the attribute to set: + *
+     *     AL_PITCH
+     *     AL_GAIN
+     *     AL_MAX_DISTANCE
+     *     AL_ROLLOFF_FACTOR
+     *     AL_REFERENCE_DISTANCE
+     *     AL_MIN_GAIN
+     *     AL_MAX_GAIN
+     *     AL_CONE_OUTER_GAIN
+     * 
+ * @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.
+ *
+ * Interface to C language function: + *
ALvoid aSourcefv(ALuint source, ALenum pname, ALfloat *values)
+ * + * @param sourceID source ID whose attribute is being set + * @param pname the nameof the attribute to set: + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_DIRECTION
+     * 
+ * @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.
+ *
+ * Interface to C language function: + *
ALvoid aSourcefv(ALuint source, ALenum pname, ALfloat *values)
+ * + * @param sourceID source ID whose attribute is being set + * @param pname the nameof the attribute to set: + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_DIRECTION
+     * 
+ * @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.
+ *
+ * Interface to C lanuage function: + *
ALvoid alSource3f (ALuint source, ALenum pname, ALfloat v1, ALfloat v2, ALfloat v3);
+ * + * @param sourceID the id of the source whose atribute is being set. + * @param pname the name of the attribute being set. + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_DIRECTION
+     * 
+ * @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.
+ *
+ * Interface to C language function: + *
ALvoid aSourcei(ALuint source, ALenum pname, ALint value)
+ * + * @param sourceID source ID whose attribute is being set + * @param pname the nameof the attribute to set: + *
+     *      AL_SOURCE_RELATIVE
+     *      AL_LOOPING
+     *      AL_BUFFER
+     *      AL_SOURCE_STATE
+     * 
+ * @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.
+ *
+ * Interface to C language unction: + *
ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);
+ * + * @param sourceID the id of the source whose attribute is being retrieved. + * @param pname he name of the attribute to retrieve + *
+     *      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
+     * 
+ * @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.
+ *
+ * Interface to C language unction: + *
ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);
+ * + * @param sourceID the id of the source whose attribute is being retrieved. + * @param pname he name of the attribute to retrieve + *
+     *      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
+     * 
+ * @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.
+ *
+ * Interface to C language unction: + *
ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);
+ * + * @param sourceID the id of the source whose attribute is being retrieved. + * @param pname he name of the attribute to retrieve + *
+     *      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
+     * 
+ * @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.
+ *
+ * Interface to C language unction: + *
ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);
+ * + * + * @param sourceID the id of the source whose attribute is being retrieved. + * @param pname the name of the attribute to retrieve + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_DIRECTION
+     * 
+ * @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.
+ *
+ * Interface to C language unction: + *
ALvoid alGetSourcef(ALuint source, ALenum pname, ALfloat *value);
+ * + * + * @param sourceID the id of the source whose attribute is being retrieved. + * @param pname the name of the attribute to retrieve + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_DIRECTION
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetSourcei(ALuint source, Alenum pname, ALint *value);
+ * + * @param sourceID source id whose attribute is being retrieved. + * @param pname the name of the attribute being retrieved. + *
+     *      AL_SOURCE_RELATIVE
+     *      AL_BUFFER
+     *      AL_LOOPING
+     *      AL_SOURCE_STATE
+     *      AL_BUFFERS_QUEUED
+     *      AL_BUFFERS_PROCESSED
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetSourcei(ALuint source, Alenum pname, ALint *value);
+ * + * @param sourceID source id whose attribute is being retrieved. + * @param pname the name of the attribute being retrieved. + *
+     *      AL_SOURCE_RELATIVE
+     *      AL_BUFFER
+     *      AL_LOOPING
+     *      AL_SOURCE_STATE
+     *      AL_BUFFERS_QUEUED
+     *      AL_BUFFERS_PROCESSED
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetSourcei(ALuint source, Alenum pname, ALint *value);
+ * + * @param sourceID source id whose attribute is being retrieved. + * @param pname the name of the attribute being retrieved. + *
+     *      AL_SOURCE_RELATIVE
+     *      AL_BUFFER
+     *      AL_LOOPING
+     *      AL_SOURCE_STATE
+     *      AL_BUFFERS_QUEUED
+     *      AL_BUFFERS_PROCESSED
+     * 
+ * @return the value being retrieved + */ + public int alGetSourcei(int sourceID, int pname); + + /** + * This method plays a source.
+ *
+ *Interface to C Language function: + *
ALvoid alSourcePlay(ALuint source);
+ * + * @param sourceID the id of the source to be played + */ + public void alSourcePlay(int sourceID); + + /** + * This method plays a set of sources.
+ *
+ * Interface to C Language function: + *
ALvoid alSourcePlayv(Alsizei, ALuint *sources);
+ * + * @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.
+ *
+ *
ALvoid alSourcePlayv(Alsizei, ALuint *sources);
+ * + * @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.
+ *
+ *Interface to C Language function: + *
ALvoid alSourcePause(ALuint source);
+ * + * @param sourceID the id of the source to be paused + */ + public void alSourcePause(int sourceID); + + /** + * This method pauses a set of sources.
+ *
+ *
ALvoid alSourcePausev(Alsizei, ALuint *sources);
+ * + * @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.
+ *
+ *
ALvoid alSourcePausev(Alsizei, ALuint *sources);
+ * + * @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.
+ *
+ *Interface to C Language function: + *
ALvoid alSourceStop(ALuint source);
+ * + * @param sourceID the id of the source to be stopped + */ + public void alSourceStop(int sourceID); + + /** + * This method stops a set of sources.
+ *
+ *
ALvoid alSourceStopv(Alsizei, ALuint *sources);
+ * + * @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.
+ *
+ *
ALvoid alSourceStopv(Alsizei, ALuint *sources);
+ * + * @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.
+ *
+ *Interface to C Language function: + *
ALvoid alSourceRewind(ALuint source);
+ * + * @param sourceID the id of the source to be rewound + */ + public void alSourceRewind(int sourceID); + + /** + * This method rewinds a set of sources.
+ *
+ *Interface to C Language function: + *
ALvoid alSourceRewindv(Alsizei, ALuint *sources);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alSourceRewindv(Alsizei, ALuint *sources);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
alSourceQueueBuffers(ALuint source, ALsizei n, ALuint *buffers);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
alSourceQueueBuffers(ALuint source, ALsizei n, ALuint *buffers);
+ * + * @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 n buffers + * can be removed from the queue
+ *
+ * Interface to C Language function: + *
ALvoid alSourceUnqueueBuffers(ALuint source, ALsizei n, ALuint *buffers);
+ * + * @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 n buffers + * can be removed from the queue
+ *
+ * Interface to C Language function: + *
ALvoid alSourceUnqueueBuffers(ALuint source, ALsizei n, ALuint *buffers);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alListenerf(ALenum pname, ALfloat value);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alListener3f(ALenum pname, ALfloat v1, ALfloat v2, ALfloat v3);
+ * + * @param pname the name of the attribute to be set: + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_ORIENTATION
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alListenerfv(ALenum pname, ALfloat *values);
+ * + * @param pname the name of the attribute to be set: + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_ORIENTATION 
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alListenerfv(ALenum pname, ALfloat *values);
+ * + * @param pname the name of the attribute to be set: + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_ORIENTATION 
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alListeneri(ALenum pname, ALint value);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetListenerf(ALenum pname, ALfloat *value);
+ * + * @param pname the name of the attribute to be retrieved: + *
+     *      AL_GAIN
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetListenerf(ALenum pname, ALfloat *value);
+ * + * @param pname the name of the attribute to be retrieved: + *
+     *      AL_GAIN
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alListeneri(ALenum pname, ALfloat *value);
+ * + * @param pname the name of the attribute to be retrieved: + *
+     *      AL_GAIN
+     * 
+ * @return the retrieved value + */ + public float alGetListenerf(int pname); + + /** + * This method retrieves a 3-element floating point property of the listener.
+ *
+ * Interface to C Language function: + *
ALvoid alGetListener3f(ALenum pname, ALfloat *v1, ALfloat *v2, ALfloat *v3);
+ * + * @param pname the name of the attribute to be retrieved: + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     * 
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetListener3f(ALenum pname, ALfloat *v1, ALfloat *v2, ALfloat *v3);
+ * + * @param pname the name of the attribute to be retrieved: + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     * 
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetListenerfv(ALenum pname, ALint *value);
+ * + * @param pname the nameof the atribute to be retrieved: + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_ORIENTATION
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetListenerfv(ALenum pname, ALint *value);
+ * + * @param pname the nameof the atribute to be retrieved: + *
+     *      AL_POSITION
+     *      AL_VELOCITY
+     *      AL_ORIENTATION
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetListeneri(ALenum pname, ALint *value);
+ * + * @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.
+ * Note: there are no integer listener properties at this time.
+ *
+ * Interface to C Language function: + *
ALvoid alGetListeneri(ALenum pname, ALint *value);
+ * + * @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.
+ * Note: there are no integer listener properties at this time.
+ *
+ * Interface to C Language function: + *
ALvoid alGetListeneri(ALenum pname, ALint *value);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alDisable(ALenum cpability);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alDisable(ALenum cpability);
+ * + * @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
+ *
+ * Interface to C Language function: + *
ALboolean alIsEnabled(ALenum cpability);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALboolean alGetBoolean(ALenum pname);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALdouble alGetDouble(ALEnum pname);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALfoat alGetFloat(ALenum pname);
+ * + * @param pname the sateto be queried: + *
+     *      AL_DOPPLER_FACTOR
+     *      AL_DOPPLER_VELOCITY
+     * 
+ * + * @return the state described by pname + */ + public float alGetFloat(int pname); + + /** + * This method returns an integer OpenAL state.
+ *
+ * Interface to C Language function: + *
ALint alGetInteger(ALenum pname);
+ * + * @param pname the name of the state to be queried: + *
+     *      AL_DISTANCE_MODEL
+     * 
+ * @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
+ *
+ * Interface to C Language function: + *
ALvoid alGetBooleanv(ALenum pname, ALboolean *value);
+ * + * @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. + *
+ *
+ * Interface to C Language function: + *
ALvoid alGetDoublev(ALenum, ALdouble *value);
+ * + * @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. + *
+ *
+ * Interface to C Language function: + *
ALvoid alGetDoublev(ALenum, ALdouble *value);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetFloatv(ALenum pname, ALfloat *value);
+ * + * @param pname the state to be retrieved + *
+     *      AL_DOPPLER_FACTOR
+     *      AL_DOPPLER_VELOCITY
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetFloatv(ALenum pname, ALfloat *value);
+ * + * @param pname the state to be retrieved + *
+     *      AL_DOPPLER_FACTOR
+     *      AL_DOPPLER_VELOCITY
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetIntegerv(ALenum pname, ALint *data);
+ * + * @param pname the state to be returned: + *
+     *      AL_DISTANCE_MODEL
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALvoid alGetIntegerv(ALenum pname, ALint *data);
+ * + * @param pname the state to be returned: + *
+     *      AL_DISTANCE_MODEL
+     * 
+ * @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.
+ *
+ * Interface to C Language function: + *
ALubyte* alGetString(int pname);
+ * + * @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
+ *
+ * Interface to C Language function: + *
ALvoid alDistanceModel(ALenum value);
+ * + * @param model the distance model to set: + *
+     *      AL_NONE
+     *      AL_INVERSE_DISTANCE
+     *      AL_INVERSE_DISTANCE_CLAMPED
+     * 
+ */ + public void alDistanceModel(int model); + + /** + * This method selects the OpenAL Doppler factor value. + * The default value is 1.0
+ *
+ * Interface to C Language function: + *
ALvoid alDopplerFactor(ALfloat value);
+ * + * @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 + *
+ * Interface to C Language function: + *
ALvoid alDopplerVelocity(ALfloat value);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALenum alGetError(ALvoid);
+ * + * @return the current error state + */ + public int alGetError(); + + // EXTENSION RELATED METHODS + /** + * This ehod tests is a specific extension is available + * for the OpenAL driver.
+ *
+ * Interface to C Language function: + *
ALboolean alIsExtensionPresent(ALubyte *extName);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALenum alGetEnumValue(ALubyte *enumName);
+ * + * @param enumName a string describing an OpenAL constant + * + * @return the actual constant for the described constant. + */ + public int alGetEnumValue(String enumName); +} diff --git a/src/java/net/java/games/joal/ALC.java b/src/java/net/java/games/joal/ALC.java new file mode 100644 index 0000000..bb53bc5 --- /dev/null +++ b/src/java/net/java/games/joal/ALC.java @@ -0,0 +1,259 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal; + +/** + * This class contains the context-related OpenAL functions. + * + * @author Athomas Goldberg + */ +public interface ALC extends ALCConstants { + /** + * This method opens a device by name.
+ *
+ * Interface to C Language function: + *
ALCdevice* alcOpenDevice(const ALubyte *token);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
void alcCloseDevice ALCDevice *dev);
+ * + * @param device the opened device to close + */ + public void alcCloseDevice(Device device); + + /** + * This method creates a context using a specified device.
+ *
+ * Interface to C Language function: + *
void alcCreateContext(ALCdevice *dev, ALint* attrList);
+ * + * @param device an opened device + * @param attrs a set of attributes: + *
+     *      ALC_FREQUENCY
+     *      ALC_REFRESH
+     *      ALC_SYNC
+     * 
+ * + * @return a context for the specified device. + */ + public Context alcCreateContext(Device device, int[] attrs); + + /** + * This method makes the specified context the current context.
+ *
+ * Interface to C Language function: + *
ALCEnum alcMakeContextCurrent(ALvoid *alcHandle);
+ * + * @param context the new context + * + * @return an error code on failure + */ + public int alcMakeContextCurrent(Context context); + + /** + * This method tells a context to begin processing.
+ *
+ * Interface to C Language function: + *
void alcProcessContext(ALvoid *alHandle);
+ * + * @param context the context to be processed + */ + public void alcProcessContext(Context context); + + /** + * This method suspends processing on the current context.
+ *
+ * Interface to C Language function: + *
void alcSusendContext(ALvoid *alcHandle);
+ * + * @param context the context to be suspended. + */ + public void alcSuspendContext(Context context); + + /** + * This method destroys a context.
+ *
+ * Interface to C Language function: + *
ALCEnum alcDestroyContext(ALvoid *alcHandle);
+ * + * @param context the context to be destroyed + */ + public void alcDestroyContext(Context context); + + /** + * This method retrieves the current context error state.
+ *
+ *Interface to C Language function: + *
ALCEnum alcGetError(ALvoid);
+ * @return the current context error state + */ + public int alcGetError(); + + /** + * This method retrieves the current context.
+ *
+ * Interface to C Language function: + *
void* alcGetCurrentContext(ALvoid);
+ * + * @return the current context + */ + public Context alcGetCurrentContext(); + + /** + * This method returns the Device associated with the given context.
+ *
+ * Interface to C Language function: + *
ALCdevice* alcGetContextDevice(ALvoid *alcHandle);
+ * + * @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.
+ *
+ *Interface to C Language function: + *
ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName);
+ * + * @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.
+ *
+ * Interface to C Language function: + *
ALubyte* alcGetString(ALCDevice *device, ALenum pname);
+ * + * @param device the device to be queried + * @param attribute the attribute to be retrieved: + *
+     *      ALC_DEFAULT_DEVICE_SPECIFIER
+     *      ALC_DEVICE_SPECIFIER
+     *      ALC_EXTENSIONS
+     * 
+ * + * @return the string value of the attribute + */ + public String alcGetString(Device device, int attribute); + + /** + * This method retrieves integer properties related to the context.
+ *
+ * Interface to C Language function: + *
ALvoid alcGetIntegerv(ALCdevice *device, ALenum token, ALsizei n, ALint *data);
+ * + * @param device the device to be queried + * @param attribute the attribute to be retrieved + * @param size the size of the destination array provided + * @param retValue an array to hold the data to be returned. + * + */ + public void alcGetIntegerv( + Device device, + int attribute, + int size, + int[] retValue); + + /** + * This class provides a reference to an OpenAL device + * + */ + public class Device { + final int pointer; + + Device(int pointer) { + this.pointer = pointer; + } + + public int hashCode() { + return (int) pointer; + } + + public boolean equals(Object obj) { + boolean result = false; + + if (obj instanceof Device && (obj.hashCode() == pointer)) { + result = true; + } + + return result; + } + } + + /** + * This class provides a reference to an OpenAL context + * + */ + public static class Context { + final ALC alcContext; + final int pointer; + + Context(ALC impl, int pointer) { + this.pointer = pointer; + this.alcContext = impl; + } + } +} diff --git a/src/java/net/java/games/joal/ALCConstants.java b/src/java/net/java/games/joal/ALCConstants.java new file mode 100644 index 0000000..47d0754 --- /dev/null +++ b/src/java/net/java/games/joal/ALCConstants.java @@ -0,0 +1,95 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +* +* Created on Jun 6, 2003 +*/ + +package net.java.games.joal; + +/** + * @author Athomas Goldberg + * + */ +public interface ALCConstants { + /* Boolean False. */ + public final static int ALC_FALSE = 0; + + /* Boolean True. */ + public final static int ALC_TRUE = 1; + + /** Errors: No Error. */ + public final static int ALC_NO_ERROR = ALC_FALSE; + + public final static int ALC_MAJOR_VERSION = 0x1000; + public final static int ALC_MINOR_VERSION = 0x1001; + public final static int ALC_ATTRIBUTES_SIZE = 0x1002; + public final static int ALC_ALL_ATTRIBUTES = 0x1003; + + public final static int ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004; + public final static int ALC_DEVICE_SPECIFIER = 0x1005; + public final static int ALC_EXTENSIONS = 0x1006; + + public final static int ALC_FREQUENCY = 0x1007; + public final static int ALC_REFRESH = 0x1008; + public final static int ALC_SYNC = 0x1009; + + /** + * The device argument does not name a valid dvice. + */ + public final static int ALC_INVALID_DEVICE = 0xA001; + + /** + * The context argument does not name a valid context. + */ + public final static int ALC_INVALID_CONTEXT = 0xA002; + + /** + * A function was called at inappropriate time, + * or in an inappropriate way, causing an illegal state. + * This can be an incompatible ALenum, object ID, + * and/or function. + */ + public final static int ALC_INVALID_ENUM = 0xA003; + + /** + * Illegal value passed as an argument to an AL call. + * Applies to parameter values, but not to enumerations. + */ + public final static int ALC_INVALID_VALUE = 0xA004; + + /** + * A function could not be completed, + * because there is not enough memory available. + */ + public final static int ALC_OUT_OF_MEMORY = 0xA005; + +} diff --git a/src/java/net/java/games/joal/ALCImpl.java b/src/java/net/java/games/joal/ALCImpl.java new file mode 100644 index 0000000..ca180ef --- /dev/null +++ b/src/java/net/java/games/joal/ALCImpl.java @@ -0,0 +1,177 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal; + +import java.util.HashMap; + +final class ALCImpl implements ALC { + private final HashMap contextMap = new HashMap(); + + ALCImpl() { + System.loadLibrary("joal"); + Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { + public void run() { + exit(); + } + })); + } + + public Device alcOpenDevice(String deviceName) { + Device result = null; + result = new Device(openDeviceNative(deviceName)); + + return result; + } + + private native int openDeviceNative(String deviceName); + + public void alcCloseDevice(Device device) { + closeDeviceNative(device.pointer); + } + + private native void closeDeviceNative(int pointer); + + public Context alcCreateContext(Device device, int[] attrs) { + Context result = null; + int pointer = createContextNative(device.pointer, attrs); + if (pointer != 0) { + result = new Context(this, pointer); + contextMap.put(new Integer(pointer), result); + } + return result; + } + + private native int createContextNative(int pointer, int[] attrs); + + public int alcMakeContextCurrent(Context context) { + int result = 0; + int pointer = 0; + + if (context != null) { + pointer = context.pointer; + } + + result = makeContextCurrentNative(pointer); + + return result; + } + + private native int makeContextCurrentNative(int pointer); + + public void alcProcessContext(Context context) { + processContextNative(context.pointer); + } + + private native void processContextNative(int pointer); + + public void alcSuspendContext(Context context) { + suspendContextNative(context.pointer); + } + + private native void suspendContextNative(int pointer); + + public void alcDestroyContext(Context context) { + destroyContextNative(context.pointer); + } + + private native void destroyContextNative(int pointer); + + public native int alcGetError(); + + public Context alcGetCurrentContext() { + Context result = null; + int pointer = getCurrentContextNative(); + result = (Context) contextMap.get(new Integer(pointer)); + return result; + } + + private native int getCurrentContextNative(); + + public boolean alcIsExtensionPresent(Device device, String extName) { + boolean result = false; + + return result; + } + + // public Method getProcAddress(Device device, String funcName); + public int alcGetEnumValue(Device device, String enumName) { + return getEnumValueNative(device.pointer, enumName); + } + + private native int getEnumValueNative(int pointer, String enumValue); + + public String alcGetString(Device device, int attribute) { + String result = null; + result = alcGetStringNative(device.pointer, attribute); + return result; + } + + private native String alcGetStringNative(int pointer, int attribute); + + public void alcGetIntegerv( + Device device, + int attribute, + int size, + int[] array) { + alcGetIntegervNative(device.pointer, attribute, size, array); + } + + private native void alcGetIntegervNative( + int pointer, + int attr, + int size, + int[] arr); + + public Device alcGetContextsDevice(Context context) { + Device result = null; + int devicePtr = getContextDeviceNative(context.pointer); + Device device = new ALC.Device(devicePtr); + + return result; + } + + private native int getContextDeviceNative(int context); + + private void exit() { + + Context alcContext = alcGetCurrentContext(); + + if (alcContext != null) { + Device alcDevice = alcGetContextsDevice(alcContext); + alcMakeContextCurrent(null); + alcDestroyContext(alcContext); + alcCloseDevice(alcDevice); + } + } +} diff --git a/src/java/net/java/games/joal/ALConstants.java b/src/java/net/java/games/joal/ALConstants.java new file mode 100644 index 0000000..4ee8e3f --- /dev/null +++ b/src/java/net/java/games/joal/ALConstants.java @@ -0,0 +1,348 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal; + +/** + * This interface contains the standard constants used by OpenAL + * @author Athomas Goldberg + */ +public interface ALConstants { + + /** Bad value */ + public static final int AL_INVALID = -1; + + /** Disable value */ + public static final int AL_NONE = 0; + + /** Boolean False */ + public static final int AL_FALSE = 0; + + /** Boolean True */ + public static final int AL_TRUE = 1; + + /** + * Indicate the type of SOURCE. + * Sources can be spatialized + */ + public static final int AL_SOURCE_TYPE = 0x200; + + /** Indicate source has absolute coordinates */ + public static final int AL_SOURCE_ABSOLUTE = 0x201; + + /** Indicate Source has listener relative coordinates */ + public static final int AL_SOURCE_RELATIVE = 0x202; + + /** + * Directional source, inner cone angle, in degrees + * Range: [0-360] + * Default: 360 + */ + public static final int AL_CONE_INNER_ANGLE = 0x1001; + + /** + * Directional source, outer cone angle, in degrees. + * Range: [0-360] + * Default: 360 + */ + public static final int AL_CONE_OUTER_ANGLE = 0x1002; + + /** + * Specify the pitch to be applied, either at source, + * or on mixer results, at listener. + * Range: [0.5-2.0] + * Default: 1.0 + */ + public static final int AL_PITCH = 0x1003; + + /** + * Specify the current location in three dimensional space. + * OpenAL, like OpenGL, uses a right handed coordinate system, + * where in a frontal default view X (thumb) points right, + * Y points up (index finger), and Z points towards the + * viewer/camera (middle finger). + * To switch from a left handed coordinate system, flip the + * sign on the Z coordinate. + * Listener position is always in the world coordinate system. + */ + public static final int AL_POSITION = 0x1004; + + /** Specify the current direction as forward vector. */ + public static final int AL_DIRECTION = 0x1005; + + /** Specify the current velocity in three dimensional space. */ + public static final int AL_VELOCITY = 0x1006; + + /** + * Indicate whether source has to loop infinite. + * Type: ALboolean + * Range: [AL_TRUE, AL_FALSE] + * Default: AL_FALSE + */ + public static final int AL_LOOPING = 0x1007; + + /** + * Indicate the buffer to provide sound samples. + * Type: ALuint. + * Range: any valid Buffer id. + */ + public static final int AL_BUFFER = 0x1009; + + /** + * Indicate the gain (volume amplification) applied. + * Type: ALfloat. + * Range: ]0.0- ] + * A value of 1.0 means un-attenuated/unchanged. + * Each division by 2 equals an attenuation of -6dB. + * Each multiplicaton with 2 equals an amplification of +6dB. + * A value of 0.0 is meaningless with respect to a logarithmic + * scale; it is interpreted as zero volume - the channel + * is effectively disabled. + */ + public static final int AL_GAIN = 0x100A; + + /** + * Indicate minimum source attenuation. + * Type: ALfloat + * Range: [0.0 - 1.0] + */ + public static final int AL_MIN_GAIN = 0x100D; + + /** + * Indicate maximum source attenuation. + * Type: ALfloat + * Range: [0.0 - 1.0] + */ + public static final int AL_MAX_GAIN = 0x100E; + + /** + * Specify the current orientation. + * Type: ALfv6 (at/up) + * Range: N/A + */ + public static final int AL_ORIENTATION = 0x100F; + + /* byte offset into source (in canon format). -1 if source + * is not playing. Don't set this, get this. + * + * Type: ALfloat + * Range: [0.0 - ] + * Default: 1.0 + */ + public static final int AL_REFERENCE_DISTANCE = 0x1020; + + /** + * Indicate the rolloff factor for the source. + * Type: ALfloat + * Range: [0.0 - ] + * Default: 1.0 + */ + public static final int AL_ROLLOFF_FACTOR = 0x1021; + + /** + * Indicate the gain (volume amplification) applied. + * Type: ALfloat. + * Range: ]0.0- ] + * A value of 1.0 means un-attenuated/unchanged. + * Each division by 2 equals an attenuation of -6dB. + * Each multiplicaton with 2 equals an amplification of +6dB. + * A value of 0.0 is meaningless with respect to a logarithmic + * scale; it is interpreted as zero volume - the channel + * is effectively disabled. + */ + public static final int AL_CONE_OUTER_GAIN = 0x1022; + + /** + * Specify the maximum distance. + * Type: ALfloat + * Range: [0.0 - ] + */ + public static final int AL_MAX_DISTANCE = 0x1023; + + /** + * Specify the channel mask. (Creative) + * Type: ALuint + * Range: [0 - 255] + */ + public static final int AL_CHANNEL_MASK = 0x3000; + + /** Source state information */ + public static final int AL_SOURCE_STATE = 0x1010; + + /** Source state information */ + public static final int AL_INITIAL = 0x1011; + + /** Source state information */ + public static final int AL_PLAYING = 0x1012; + + /** Source state information */ + public static final int AL_PAUSED = 0x1013; + + /** Source state information */ + public static final int AL_STOPPED = 0x1014; + + /** Buffer Queue params */ + public static final int AL_BUFFERS_QUEUED = 0x1015; + + /** Buffer Queue params */ + public static final int AL_BUFFERS_PROCESSED = 0x1016; + + /** Sound buffers: format specifier. */ + public static final int AL_FORMAT_MONO8 = 0x1100; + + /** Sound buffers: format specifier. */ + public static final int AL_FORMAT_MONO16 = 0x1101; + + /** Sound buffers: format specifier. */ + public static final int AL_FORMAT_STEREO8 = 0x1102; + + /** Sound buffers: format specifier. */ + public static final int AL_FORMAT_STEREO16 = 0x1103; + + /** + * Sound buffers: frequency, in units of Hertz [Hz]. + * This is the number of samples per second. Half of the + * sample frequency marks the maximum significant + * frequency component. + */ + public static final int AL_FREQUENCY = 0x2001; + + /** + * Sound buffers: frequency, in units of Hertz [Hz]. + * This is the number of samples per second. Half of the + * sample frequency marks the maximum significant + * frequency component. + */ + public static final int AL_BITS = 0x2002; + + /** + * Sound buffers: frequency, in units of Hertz [Hz]. + * This is the number of samples per second. Half of the + * sample frequency marks the maximum significant + * frequency component. + */ + public static final int AL_CHANNELS = 0x2003; + + /** + * Sound buffers: frequency, in units of Hertz [Hz]. + * This is the number of samples per second. Half of the + * sample frequency marks the maximum significant + * frequency component. + */ + public static final int AL_SIZE = 0x2004; + + /** + * Sound buffers: frequency, in units of Hertz [Hz]. + * This is the number of samples per second. Half of the + * sample frequency marks the maximum significant + * frequency component. + */ + public static final int AL_DATA = 0x2005; + + /** + * Buffer state. + * + * Not supported for public use (yet). + */ + public static final int AL_UNUSED = 0x2010; + + /** + * Buffer state. + * + * Not supported for public use (yet). + */ + public static final int AL_PENDING = 0x2011; + + /** + * Buffer state. + * + * Not supported for public use (yet). + */ + public static final int AL_PROCESSED = 0x2012; + + /** Errors: No Error. */ + public static final int AL_NO_ERROR = AL_FALSE; + + /** Illegal name passed as an argument to an AL call. */ + public static final int AL_INVALID_NAME = 0xA001; + + /** Illegal enum passed as an argument to an AL call. */ + public static final int AL_INVALID_ENUM = 0xA002; + + /** + * Illegal value passed as an argument to an AL call. + * Applies to parameter values, but not to enumerations. + */ + public static final int AL_INVALID_VALUE = 0xA003; + + /** + * A function was called at inappropriate time, + * or in an inappropriate way, causing an illegal state. + * This can be an incompatible ALenum, object ID, + * and/or function. + */ + public static final int AL_INVALID_OPERATION = 0xA004; + + /** + * A function could not be completed, + * because there is not enough memory available. + */ + public static final int AL_OUT_OF_MEMORY = 0xA005; + + /** Context strings: Vendor */ + public static final int AL_VENDOR = 0xB001; + + /** Context strings: Version */ + public static final int AL_VERSION = 0xB002; + + /** Context strings: Renderer */ + public static final int AL_RENDERER = 0xB003; + + /** Context strings: Extensions */ + public static final int AL_EXTENSIONS = 0xB004; + + /** Doppler scale. Default 1.0 */ + public static final int AL_DOPPLER_FACTOR = 0xC000; + + /** Doppler velocity. Default 1.0 */ + public static final int AL_DOPPLER_VELOCITY = 0xC001; + + /** Distance model. Default AL_INVERSE_DISTANCE_CLAMPED */ + public static final int AL_DISTANCE_MODEL = 0xD000; + + /** Distance model */ + public static final int AL_INVERSE_DISTANCE = 0xD001; + + /** Distance model */ + public static final int AL_INVERSE_DISTANCE_CLAMPED = 0xD002; +} \ No newline at end of file diff --git a/src/java/net/java/games/joal/ALFactory.java b/src/java/net/java/games/joal/ALFactory.java new file mode 100644 index 0000000..70b6fd8 --- /dev/null +++ b/src/java/net/java/games/joal/ALFactory.java @@ -0,0 +1,105 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal; + +/** + * This class provides factory methods for generating AL and ALC objects. The + * class must be initialized before use, and should be deinitialized when OpenAL + * functionality is no longer needed to free up native resources. + * + * @author Athomas Goldberg + */ +public class ALFactory { + static { + System.loadLibrary("joal"); + } + + private static boolean isInitialized; + private static ALImpl al; + private static ALC alc; + + /** + * Initialize the OpenAL environment + * + * @return true is OpenAL was able to initialize, + * false if OpenAL was not able to intialize + */ + public static boolean initialize() { + String osProperty = System.getProperty("os.name"); + if(osProperty.startsWith("Win")) { + isInitialized = init(new String[] { "OpenAL32.dll" }); + } else { + // Linux & OSX + } + return isInitialized; + } + + private static native boolean init(String[] oalPaths); + + /** + * Deinitialize the OpenAL environment + * + * @return true if OpenAL was able to be deinitialized, + * false if OpenAL uas unable to be deinitialized + */ + public static native boolean deinitialize(); + + /** + * Get the default AL object. This object is used to access most of the + * OpenAL functionality. + * + * @return the AL object + */ + public static AL getAL() { + if (al == null) { + al = new ALImpl(); + } + + return al; + } + + /** + * Get the default ALC object. This object is used to access most of the + * OpenAL context functionality. + * + * @return the ALC object + */ + public static ALC getALC() { + if (alc == null) { + alc = new ALCImpl(); + } + + return alc; + } +} diff --git a/src/java/net/java/games/joal/ALImpl.java b/src/java/net/java/games/joal/ALImpl.java new file mode 100644 index 0000000..9ac8301 --- /dev/null +++ b/src/java/net/java/games/joal/ALImpl.java @@ -0,0 +1,905 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal; + +import java.nio.ByteBuffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + + +final class ALImpl implements AL { + ALImpl() { + System.loadLibrary("joal"); + } + + // AL_BUFFER RELATED METHODS + + public void alGenBuffers(int n, IntBuffer buffers) { + if ( + (buffers == null) || + !buffers.isDirect() || + (n > buffers.capacity()) + ) { + throw new IllegalArgumentException( + "buffers must be direct, can not be null" + + " and buffer capacity must be greater than requested number of " + + "buffers." + ); + } else { + alGenBuffersNative(n, buffers); + } + } + + private native void alGenBuffersNative(int n, IntBuffer buffers); + + public void alGenBuffers(int n, int[] buffers) { + if ((buffers == null) || (n > buffers.length)) { + throw new IllegalArgumentException( + "buffers can not be null" + + " and array length must be greater than requested number of " + + "buffers." + ); + } else { + alGenBuffersNative(n, buffers); + } + } + + private native void alGenBuffersNative(int n, int[] buffers); + + public void alDeleteBuffers(int n, IntBuffer buffers) { + if ( + (buffers == null) || + !buffers.isDirect() || + (n > buffers.capacity()) + ) { + throw new IllegalArgumentException( + "buffers must be direct, can not be null" + + " and buffer capacity must be greater than requested number of " + + "buffers." + ); + } else { + alDeleteBuffersNative(n, buffers); + } + } + + private native void alDeleteBuffersNative(int n, IntBuffer buffers); + + public void alDeleteBuffers(int n, int[] buffers) { + if ((buffers == null) || (n > buffers.length)) { + throw new IllegalArgumentException( + "buffers can not be null" + + " and array length must be greater than requested number of " + + "buffers." + ); + } else { + alDeleteBuffersNative(n, buffers); + } + } + + private native void alDeleteBuffersNative(int n, int[] buffers); + + public native boolean alIsBuffer(int bufferName); + + public void alBufferData( + int buffername, + int format, + byte[] data, + int size, + int frequency + ) { + if (data == null) { + throw new IllegalArgumentException("data must not be null"); + } else { + alBufferDataNative(buffername, format, data, size, frequency); + } + } + + private native void alBufferDataNative( + int buffername, + int format, + byte[] data, + int size, + int frequency + ); + + public void alBufferData( + int buffername, + int format, + ByteBuffer data, + int size, + int frequency + ) { + if ((data == null) || !data.isDirect()) { + throw new IllegalArgumentException( + "data must be a direct, non-null buffer" + ); + } else { + alBufferDataNative(buffername, format, data, size, frequency); + } + } + + private native void alBufferDataNative( + int buffername, + int format, + ByteBuffer data, + int size, + int frequency + ); + + public void alGetBufferf(int bufferName, int pname, float[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException( + "Return Value argument must not be null." + ); + } else { + alGetBufferfNative(bufferName, pname, retValue); + } + } + + private native void alGetBufferfNative( + int bufferName, + int pname, + float[] retValue + ); + + public void alGetBufferf(int bufferName, int pname, FloatBuffer retValue) { + if ((retValue == null) || !retValue.isDirect()) { + throw new IllegalArgumentException( + "Return Value argument must be a direct, non-null buffer" + ); + } else { + alGetBufferfNative(bufferName, pname, retValue); + } + } + + private native void alGetBufferfNative( + int bufferName, + int pname, + FloatBuffer retValue + ); + + public native float alGetBufferf(int bufferName, int pname); + + public void alGetBufferi(int bufferName, int pname, int[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException( + "Return Value argument must not be null" + ); + } else { + alGetBufferiNative(bufferName, pname, retValue); + } + } + + private native void alGetBufferiNative( + int bufferName, + int pname, + int[] retValue + ); + + public void alGetBufferi(int bufferName, int pname, IntBuffer retValue) { + if ((retValue == null) || !retValue.isDirect()) { + throw new IllegalArgumentException( + "Return Value argument must be a direct, non-null IntBuffer" + ); + } else { + alGetBufferiNative(bufferName, pname, retValue); + } + } + + private native void alGetBufferiNative( + int bufferName, + int pname, + IntBuffer retValue + ); + + public native int alGetBufferi(int bufferName, int pname); + + // SOURCE RELATED METHODS + public void alGenSources(int numSources, int[] sources) { + if ((sources == null) || (numSources > sources.length)) { + throw new IllegalArgumentException( + "sources can not be null" + + " and array length must be greater than requested number of " + + "sources." + ); + } else { + alGenSourcesNative(numSources, sources); + } + } + + private native void alGenSourcesNative(int numSources, int[] sources); + + public void alGenSources(int numSources, IntBuffer sources) { + if ( + (sources == null) || + !sources.isDirect() || + (numSources > sources.capacity()) + ) { + throw new IllegalArgumentException( + "sources buffer must be direct, can not be null" + + " and capacity must be greater than requested number of " + + "sources." + ); + } else { + alGenSourcesNative(numSources, sources); + } + } + + private native void alGenSourcesNative(int numSources, IntBuffer sources); + + public void alDeleteSources(int numSources, int[] sources) { + if ((sources == null) || (numSources > sources.length)) { + throw new IllegalArgumentException( + "sources can not be null" + + " and array length must be greater than requested number of " + + "sources." + ); + } else { + alDeleteSourcesNative(numSources, sources); + } + } + + private native void alDeleteSourcesNative(int numSources, int[] sources); + + public void alDeleteSources(int numSources, IntBuffer sources) { + if ( + (sources == null) || + !sources.isDirect() || + (numSources > sources.capacity()) + ) { + throw new IllegalArgumentException( + "sources buffer must be direct, can not be null" + + " and capacity must be greater than requested number of " + + "sources." + ); + } else { + alDeleteSourcesNative(numSources, sources); + } + } + + private native void alDeleteSourcesNative( + int numSources, + IntBuffer sources + ); + + public native boolean alIsSource(int sourceName); + + public native void alSourcei(int sourcename, int pname, int value); + + public native void alSourcef(int sourcename, int pname, float value); + + public native void alSourcefv(int sourcename, int pname, float[] value); + + public void alSourcefv(int sourcename, int pname, FloatBuffer value) { + if ((value != null) && !value.isDirect()) { + throw new IllegalArgumentException("buffer must be direct"); + } else { + alSourcefvNative(sourcename, pname, value); + } + } + + private native void alSourcefvNative( + int sourcename, + int pname, + FloatBuffer value + ); + + public native void alSource3f( + int sourcename, + int pname, + float v1, + float v2, + float v3 + ); + + public void alGetSourcef(int sourcename, int pname, float[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException("retValue must not be null"); + } else { + alGetSourcefNative(sourcename, pname, retValue); + } + } + + private native void alGetSourcefNative( + int sourcename, + int pname, + float[] retValue + ); + + public void alGetSourcef(int sourceName, int pname, FloatBuffer buffer) { + if ((buffer == null) || !buffer.isDirect()) { + throw new IllegalArgumentException( + "Buffer must be direct and non-null" + ); + } else { + alGetSourcefNative(sourceName, pname, buffer); + } + } + + private native void alGetSourcefNative( + int sourceName, + int pname, + FloatBuffer buffer + ); + + public native float alGetSourcef(int sourceName, int pname); + + public void alGetSourcefv(int sourcename, int pname, FloatBuffer value) { + if ((value == null) || !value.isDirect()) { + throw new IllegalArgumentException( + "Buffer must be direct and non-null" + ); + } else { + alGetSourcefvNative(sourcename, pname, value); + } + } + + private native void alGetSourcefvNative( + int sourcename, + int pname, + FloatBuffer value + ); + + + public void alGetSourcefv(int sourcename, int pname, float[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException( + "retValue arg array must not be null" + ); + } else { + alGetSourcefvNative(sourcename, pname, retValue); + } + } + + private native void alGetSourcefvNative( + int sourcename, + int pname, + float[] retValue + ); + + + public void alGetSourcei(int sourcename, int pname, int[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException( + "retValue arg array must not be null" + ); + } else { + alGetSourceiNative(sourcename, pname, retValue); + } + } + + private native void alGetSourceiNative( + int sourcename, + int pname, + int[] retValue + ); + + public void alGetSourcei(int sourcename, int pname, IntBuffer value) { + if ((value == null) || !value.isDirect()) { + throw new IllegalArgumentException( + "Buffer must be direct and non-null" + ); + } else { + alGetSourceiNative(sourcename, pname, value); + } + } + + private native void alGetSourceiNative( + int sourcename, + int pname, + IntBuffer retValue + ); + + public native int alGetSourcei(int sourcename, int pname); + + + public native void alSourcePlay(int sourcename); + + public void alSourcePlayv(int numSources, int[] sourcenames) { + if ((sourcenames == null) || (numSources > sourcenames.length)) { + throw new IllegalArgumentException( + "sourcenames must be non-null" + + " and at least as large as the number of sources requested" + ); + } else { + alSourcePlayvNative(numSources, sourcenames); + } + } + + private native void alSourcePlayvNative(int numSources, int[] sourcenames); + + public void alSourcePlayv(int numSources, IntBuffer sourcenames) { + if ( + (sourcenames == null) || + (numSources > sourcenames.capacity()) || + !sourcenames.isDirect() + ) { + throw new IllegalArgumentException( + "sourcenames buffer must be direct, non-null and have a" + + " equals or greater capacity than the number of sources" + + " requested" + ); + } else { + alSourcePlayvNative(numSources, sourcenames); + } + } + + private native void alSourcePlayvNative( + int numSources, + IntBuffer sourcenames + ); + + public native void alSourcePause(int sourcename); + + public void alSourcePausev(int numSources, int[] sourcenames) { + if ((sourcenames == null) || (numSources > sourcenames.length)) { + throw new IllegalArgumentException( + "sourcenames must be non-null" + + " and at least as large as the number of sources requested" + ); + } else { + alSourcePausevNative(numSources, sourcenames); + } + } + + private native void alSourcePausevNative(int numSources, int[] sourcenames); + + public void alSourcePausev(int numSources, IntBuffer sourcenames) { + if ( + (sourcenames == null) || + (numSources > sourcenames.capacity()) || + !sourcenames.isDirect() + ) { + throw new IllegalArgumentException( + "sourcenames buffer must be direct, non-null and have a" + + " equals or greater capacity than the number of sources" + + " requested" + ); + } else { + alSourcePausevNative(numSources, sourcenames); + } + } + + private native void alSourcePausevNative( + int numSources, + IntBuffer sourcenames + ); + + public native void alSourceStop(int sourcename); + + public void alSourceStopv(int numSources, int[] sourcenames) { + if ((sourcenames == null) || (numSources > sourcenames.length)) { + throw new IllegalArgumentException( + "sourcenames must be non-null" + + " and at least as large as the number of sources requested" + ); + } else { + alSourceStopvNative(numSources, sourcenames); + } + } + + private native void alSourceStopvNative(int numSources, int[] sourcenames); + + public void alSourceStopv(int numSources, IntBuffer sourcenames) { + if ( + (sourcenames == null) || + (numSources > sourcenames.capacity()) || + !sourcenames.isDirect() + ) { + throw new IllegalArgumentException( + "sourcenames buffer must be direct, non-null and have a" + + " equals or greater capacity than the number of sources" + + " requested" + ); + } else { + alSourcePlayvNative(numSources, sourcenames); + } + } + + private native void alSourceStopvNative( + int numSources, + IntBuffer sourcenames + ); + + public native void alSourceRewind(int sourcename); + + public void alSourceRewindv(int numSources, int[] sourcenames) { + if ((sourcenames == null) || (numSources > sourcenames.length)) { + throw new IllegalArgumentException( + "sourcenames must be non-null" + + " and at least as large as the number of sources requested" + ); + } else { + alSourceRewindvNative(numSources, sourcenames); + } + } + + private native void alSourceRewindvNative( + int numSources, + int[] sourcenames + ); + + public void alSourceRewindv(int numSources, IntBuffer sourcenames) { + if ( + (sourcenames == null) || + (numSources > sourcenames.capacity()) || + !sourcenames.isDirect() + ) { + throw new IllegalArgumentException( + "sourcenames buffer must be direct, non-null and have a" + + " equals or greater capacity than the number of sources" + + " requested" + ); + } else { + alSourceRewindvNative(numSources, sourcenames); + } + } + + private native void alSourceRewindvNative( + int numSources, + IntBuffer sourcenames + ); + + public void alSourceQueueBuffers( + int sourcename, + int numBuffers, + int[] buffernames + ) { + if ((buffernames == null) || (numBuffers > buffernames.length)) { + throw new IllegalArgumentException( + "buffernames must be non-null and equal or greater " + + "than the numBuffers specified" + ); + } else { + alSourceQueueBuffersNative(sourcename, numBuffers, buffernames); + } + } + + private native void alSourceQueueBuffersNative( + int sourcename, + int numBuffers, + int[] buffernames + ); + + public void alSourceQueueBuffers( + int sourcename, + int numBuffers, + IntBuffer buffernames + ) { + if ( + (buffernames == null) || + !buffernames.isDirect() || + (numBuffers > buffernames.capacity()) + ) { + throw new IllegalArgumentException( + "only non-null, direct buffers of numBuffers capacity" + + " or greater may be used." + ); + } else { + alSourceQueueBuffersNative(sourcename, numBuffers, buffernames); + } + } + + private native void alSourceQueueBuffersNative( + int sourcename, + int numBuffers, + IntBuffer buffernames + ); + + public void alSourceUnqueueBuffers( + int sourcename, + int numBuffers, + int[] buffernames + ) { + if ((buffernames == null) || (numBuffers > buffernames.length)) { + throw new IllegalArgumentException( + "buffernames must be non-null and equal or greater " + + "than the numBuffers specified" + ); + } else { + alSourceUnqueueBuffersNative(sourcename, numBuffers, buffernames); + } + } + + private native void alSourceUnqueueBuffersNative( + int sourcename, + int numBuffers, + int[] buffernames + ); + + public void alSourceUnqueueBuffers( + int sourcename, + int numBuffers, + IntBuffer buffernames + ) { + if ( + (buffernames == null) || + !buffernames.isDirect() || + (numBuffers > buffernames.capacity()) + ) { + throw new IllegalArgumentException( + "only non-null, direct buffers of numBuffers capacity" + + " or greater may be used." + ); + } else { + alSourceUnqueueBuffersNative(sourcename, numBuffers, buffernames); + } + } + + private native void alSourceUnqueueBuffersNative( + int sourcename, + int numBuffers, + IntBuffer buffernames + ); + + // LISTENER RELATED METHODS + public native void alListenerf(int pname, float value); + + public native void alListener3f(int pname, float v1, float v2, float v3); + + public native void alListenerfv(int pname, float[] values); + + public native void alListenerfv(int pname, FloatBuffer values); + + public native void alListeneri(int pname, int value); + + public void alGetListenerf(int pname, float[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException( + "retValue must be non-null array" + ); + } + } + + private native void alGetListenerfNative(int pname, float[] retValue); + + public void alGetListenerf(int pname, FloatBuffer retValue) { + if ((retValue == null) || !retValue.isDirect()) { + throw new IllegalArgumentException( + "retValue must be a non-null direct buffer" + ); + } else { + alGetListenerfNative(pname, retValue); + } + } + + private native void alGetListenerfNative(int pname, FloatBuffer retValue); + + public native float alGetListenerf(int pname); + + public void alGetListener3f( + int pname, + FloatBuffer v1, + FloatBuffer v2, + FloatBuffer v3 + ) { + if ( + ((v1 == null) || !v1.isDirect()) || + ((v2 == null) || !v2.isDirect()) || + ((v3 == null) || !v3.isDirect()) + ) { + throw new IllegalArgumentException( + "buffers must be non-null and direct" + ); + } else { + alGetListener3fNative(pname, v1, v2, v3); + } + } + + private native void alGetListener3fNative( + int pname, + FloatBuffer v1, + FloatBuffer v2, + FloatBuffer v3 + ); + + public void alGetListener3f(int pname, float[] v1, float[] v2, float[] v3) { + if ((v1 == null) || (v2 == null) || (v3 == null)) { + throw new IllegalArgumentException("Arrays must be non-null"); + } else { + alGetListener3fNative(pname, v1, v2, v3); + } + } + + private native void alGetListener3fNative( + int pname, + float[] v1, + float[] v2, + float[] v3 + ); + + public void alGetListenerfv(int pname, float[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException("Array must be non-null"); + } else { + alGetListenerfvNative(pname, retValue); + } + } + + private native void alGetListenerfvNative(int pname, float[] retValue); + + public void alGetListenerfv(int pname, FloatBuffer retValue) { + if ((retValue == null) || !retValue.isDirect()) { + throw new IllegalArgumentException( + "Buffer must be non-null and direct" + ); + } else { + alGetListenerfvNative(pname, retValue); + } + } + + private native void alGetListenerfvNative(int pname, FloatBuffer retValue); + + public void alGetListeneri(int pname, int[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException("Array must be non-null"); + } else { + alGetListeneriNative(pname, retValue); + } + } + + private native void alGetListeneriNative(int pname, int[] retValue); + + public void alGetListeneri(int pname, IntBuffer retValue) { + if ((retValue == null) || !retValue.isDirect()) { + throw new IllegalArgumentException( + "Buffer must be non-null and direct" + ); + } else { + alGetListeneriNative(pname, retValue); + } + } + + private native void alGetListeneriNative(int pname, IntBuffer retValue); + + public native int alGetListeneri(int pname); + + // STATE RELATED METHODS + public native void alEnable(int capability); + + public native void alDisable(int capability); + + public native boolean alIsEnabled(int capability); + + public native boolean alGetBoolean(int pname); + + public native double alGetDouble(int pname); + + public native float alGetFloat(int pname); + + public native int alGetInteger(int pname); + + // No Boolean Array states at the moment + // public native void getBooleanv(int pname, ByteBuffer value); + + public void alGetBooleanv(int pname, boolean[] value) { + if (value == null) { + throw new IllegalArgumentException("Array must be non-null"); + } else { + value[0] = false; + // do nothing for now, there are no boolean vector props + // alGetBooleanvNative(pname, value); + } + } + + private native void alGetBooleanvNative(int pname, boolean[] value); + + public void alGetDoublev(int pname, double[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException("Array must be non-null"); + } else { + alGetDoublevNative(pname, retValue); + } + } + + private native void alGetDoublevNative(int pname, double[] retValue); + + public void alGetDoublev(int pname, DoubleBuffer value) { + if ((value == null) || !value.isDirect()) { + throw new IllegalArgumentException( + "Buffer must be non-null and direct" + ); + } else { + alGetDoublevNative(pname, value); + } + } + + private native void alGetDoublevNative(int pname, DoubleBuffer value); + + public void alGetFloatv(int pname, float[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException("Array must be non-null"); + } else { + alGetFloatvNative(pname, retValue); + } + } + + private native void alGetFloatvNative(int pname, float[] retValue); + + public void alGetFloatv(int pname, FloatBuffer value) { + if ((value == null) || !value.isDirect()) { + throw new IllegalArgumentException( + "Buffer must be non-null and direct" + ); + } else { + alGetFloatvNative(pname, value); + } + } + + private native void alGetFloatvNative(int pname, FloatBuffer value); + + public void alGetIntegerv(int pname, int[] retValue) { + if (retValue == null) { + throw new IllegalArgumentException("Array must be non-null"); + } else { + alGetIntegervNative(pname, retValue); + } + } + + private native void alGetIntegervNative(int pname, int[] retValue); + + public void alGetIntegerv(int pname, IntBuffer value) { + if ((value == null) || !value.isDirect()) { + throw new IllegalArgumentException( + "Buffer must be non-null and direct" + ); + } else { + alGetIntegervNative(pname, value); + } + } + + private native void alGetIntegervNative(int pname, IntBuffer value); + + public native String alGetString(int pname); + + public native void alDistanceModel(int model); + + public native void alDopplerFactor(float value); + + public native void alDopplerVelocity(float value); + + // ERROR RELATED METHODS + public native int alGetError(); + + // EXTENSION RELATED METHODS + public native boolean alIsExtensionPresent(String extName); + + // public native Method getProcAddress(String methodName); + public native int alGetEnumValue(String enumName); + /* (non-Javadoc) + * @see net.java.games.joal.AL#alGetBooleanv(int, boolean[]) + */ + +} diff --git a/src/java/net/java/games/joal/eax/EAX.java b/src/java/net/java/games/joal/eax/EAX.java new file mode 100644 index 0000000..5ce2a9b --- /dev/null +++ b/src/java/net/java/games/joal/eax/EAX.java @@ -0,0 +1,140 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal.eax; + +import java.nio.Buffer; + + +/** + * @author Athomas Goldberg + * + */ +public class EAX implements EAXConstants { + static { + System.loadLibrary("joal"); + } + + public static final int SOURCE = 0; + public static final int LISTENER = 1; + + private final int sourceGUID = SOURCE; + private final int listenerGUID = LISTENER; + + /** + * @param sourceGUID + * @param listenerGUID + */ + EAX(int sourceGUID, int listenerGUID) { + // this.sourceGUID = sourceGUID; + // this.listenerGUID = listenerGUID; + } + + /** + * This method sets an EAX property value.
+ *
+ * Interface to C Language function: + *
ALenum EAXSet(const struct _GUID *propertySetID, ALuint property, ALuint source, ALvoid *value, ALuint size)
+ * + * @param objectFlag a flag indicating a LISTENER or a SOURCE + * @param pname the property being set + * @param source the ID of the source, or 0 for Listener properties + * @param value a direct Buffer to hold the value retrieved + * @param size the size of the Buffer + */ + public native void EAXSet( + int objectFlag, + int pname, + int source, + Buffer value, + int size + ); + + /** + * This method retrieves an EAX property value.
+ *
+ * Interface to C Language function: + *
ALenum EAXGet(const struct _GUID *propertySetID, ALuint property, ALuint source, ALvoid *value, ALuint size)
+ * + * @param objectFlag a flag indicating a LISTENER or a SOURCE + * @param pname the property being queried + * @param source the ID of the source, or 0 for Listener properties + * @param value a direct Buffer to hold the value retrieved + * @param size the size of the Buffer + */ + public native void EAXGet( + int objectFlag, + int pname, + int source, + Buffer value, + int size + ); + + /** + * This method sets a source property. + * @param sourceID the ID of the source whose property is being set. + * @param pname the name of the property being set + * @param value a direct Buffer containing the value to be set + */ + public void setSourceProperty(int sourceID, int pname, Buffer value) { + EAXSet(sourceGUID, pname, sourceID, value, value.capacity()); + } + + /** + * This method retrieves a source property. + * @param sourceID the ID of the source whose property is being retrieved. + * @param pname the name of the property being retrieved + * @param value a direct Buffer to hold the value to be retrieved + */ + public void getSourceProperty(int pname, int sourceID, Buffer value) { + EAXGet(sourceGUID, pname, sourceID, value, value.capacity()); + } + + /** + * This method sets a Listener property. + * @param pname the name of the property being set + * @param value a direct Buffer containing the value to be set + */ + public void setListenerProperty(int pname, Buffer value) { + EAXSet(listenerGUID, pname, 0, value, value.capacity()); + } + + /** + * This method retrieves a Listener property. + * @param pname the name of the property being retrieved + * @param value a direct Buffer to hold the value to be retrieved + */ + public void getListenerProperty(int pname, Buffer value) { + EAXGet(listenerGUID, pname, 0, value, value.capacity()); + } +} diff --git a/src/java/net/java/games/joal/eax/EAXConstants.java b/src/java/net/java/games/joal/eax/EAXConstants.java new file mode 100644 index 0000000..23c3400 --- /dev/null +++ b/src/java/net/java/games/joal/eax/EAXConstants.java @@ -0,0 +1,350 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal.eax; +/** + * + * This class implements the basic EAX extension constants. + * + * @author Athomas Goldberg + */ +public interface EAXConstants { + + public final static int DSPROPERTY_EAXLISTENER_NONE = 0; + public final static int DSPROPERTY_EAXLISTENER_ALLPARAMETERS = 1; + public final static int DSPROPERTY_EAXLISTENER_ROOM = 2; + public final static int DSPROPERTY_EAXLISTENER_ROOMHF = 3; + public final static int DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR = 4; + public final static int DSPROPERTY_EAXLISTENER_DECAYTIME = 5; + public final static int DSPROPERTY_EAXLISTENER_DECAYHFRATIO = 6; + public final static int DSPROPERTY_EAXLISTENER_REFLECTIONS = 7; + public final static int DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY = 8; + public final static int DSPROPERTY_EAXLISTENER_REVERB = 9; + public final static int DSPROPERTY_EAXLISTENER_REVERBDELAY = 10; + public final static int DSPROPERTY_EAXLISTENER_ENVIRONMENT = 11; + public final static int DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE = 12; + public final static int DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION = 13; + public final static int DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF = 14; + public final static int DSPROPERTY_EAXLISTENER_FLAGS = 15; + +// OR these flags with property id // + /** changes take effect immediately */ + public static final int DSPROPERTY_EAXLISTENER_IMMEDIATE = 0x00000000; + + /** changes take effect later */ + public static final int DSPROPERTY_EAXLISTENER_DEFERRED = 0x80000000; + + public static final int DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS = + DSPROPERTY_EAXLISTENER_NONE | + DSPROPERTY_EAXLISTENER_IMMEDIATE; + + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_GENERIC = 0; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_PADDEDCELL = 1; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_ROOM = 2; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_BATHROOM = 3; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_LIVINGROOM = 4; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_STONEROOM = 5; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_AUDITORIUM = 6; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_CONCERTHALL = 7; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_CAVE = 8; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_ARENA = 9; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_HANGAR = 10; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_CARPETEDHALLWAY = 11; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_HALLWAY = 12; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_STONECORRIDOR = 13; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_ALLEY = 14; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_FOREST = 15; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_CITY = 16; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_MOUNTAINS = 17; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_QUARRY = 18; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_PLAIN = 19; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_PARKINGLOT = 20; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_SEWERPIPE = 21; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_UNDERWATER = 22; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_DRUGGED = 23; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_DIZZY = 24; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_PSYCHOTIC = 25; + /** used by DSPROPERTY_EAXLISTENER_ENVIRONMENT */ + public final static int EAX_ENVIRONMENT_COUNT = 26; + +// These flags determine what properties are affected by environment size. + /** reverberation decay time */ + public final static int EAXLISTENERFLAGS_DECAYTIMESCALE = 0x00000001; + /** reflection level */ + public final static int EAXLISTENERFLAGS_REFLECTIONSSCALE = 0x00000002; + /** initial reflection delay time */ + public final static int EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE = 0x00000004; + /** reflections level */ + public final static int EAXLISTENERFLAGS_REVERBSCALE = 0x00000008; + /** late reverberation delay time */ + public final static int EAXLISTENERFLAGS_REVERBDELAYSCALE = 0x00000010; + + /** This flag limits high-frequency decay time according to air absorption.*/ + public final static int EAXLISTENERFLAGS_DECAYHFLIMIT = 0x00000020; + /** reserved future use */ + public final static int EAXLISTENERFLAGS_RESERVED = 0xFFFFFFC0; + +// property ranges and defaults: + + public final static int EAXLISTENER_MINROOM = -10000; + public final static int EAXLISTENER_MAXROOM = 0; + public final static int EAXLISTENER_DEFAULTROOM = -1000; + + public final static int EAXLISTENER_MINROOMHF = -10000; + public final static int EAXLISTENER_MAXROOMHF = 0; + public final static int EAXLISTENER_DEFAULTROOMHF = -100; + + public final static float EAXLISTENER_MINROOMROLLOFFFACTOR = 0.0f; + public final static float EAXLISTENER_MAXROOMROLLOFFFACTOR = 10.0f; + public final static float EAXLISTENER_DEFAULTROOMROLLOFFFACTOR = 0.0f; + + public final static float EAXLISTENER_MINDECAYTIME = 0.1f; + public final static float EAXLISTENER_MAXDECAYTIME = 20.0f; + public final static float EAXLISTENER_DEFAULTDECAYTIME = 1.49f; + + public final static float EAXLISTENER_MINDECAYHFRATIO = 0.1f; + public final static float EAXLISTENER_MAXDECAYHFRATIO = 2.0f; + public final static float EAXLISTENER_DEFAULTDECAYHFRATIO = 0.83f; + + public final static int EAXLISTENER_MINREFLECTIONS = -10000; + public final static int EAXLISTENER_MAXREFLECTIONS = 1000; + public final static int EAXLISTENER_DEFAULTREFLECTIONS = -2602; + + public final static float EAXLISTENER_MINREFLECTIONSDELAY = 0.0f; + public final static float EAXLISTENER_MAXREFLECTIONSDELAY = 0.3f; + public final static float EAXLISTENER_DEFAULTREFLECTIONSDELAY = 0.007f; + + public final static int EAXLISTENER_MINREVERB = -10000; + public final static int EAXLISTENER_MAXREVERB = 2000; + public final static int EAXLISTENER_DEFAULTREVERB = 200; + + public final static float EAXLISTENER_MINREVERBDELAY = 0.0f; + public final static float EAXLISTENER_MAXREVERBDELAY = 0.1f; + public final static float EAXLISTENER_DEFAULTREVERBDELAY = 0.011f; + + public final static int EAXLISTENER_MINENVIRONMENT = 0; + public final static int EAXLISTENER_MAXENVIRONMENT = EAX_ENVIRONMENT_COUNT-1; + public final static int EAXLISTENER_DEFAULTENVIRONMENT = EAX_ENVIRONMENT_GENERIC; + + public final static float EAXLISTENER_MINENVIRONMENTSIZE = 1.0f; + public final static float EAXLISTENER_MAXENVIRONMENTSIZE = 100.0f; + public final static float EAXLISTENER_DEFAULTENVIRONMENTSIZE = 7.5f; + + public final static float EAXLISTENER_MINENVIRONMENTDIFFUSION = 0.0f; + public final static float EAXLISTENER_MAXENVIRONMENTDIFFUSION = 1.0f; + public final static float EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION = 1.0f; + + public final static float EAXLISTENER_MINAIRABSORPTIONHF = -100.0f; + public final static float EAXLISTENER_MAXAIRABSORPTIONHF = 0.0f; + public final static float EAXLISTENER_DEFAULTAIRABSORPTIONHF = -5.0f; + + public final static int EAXLISTENER_DEFAULTFLAGS = + EAXLISTENERFLAGS_DECAYTIMESCALE | + EAXLISTENERFLAGS_REFLECTIONSSCALE | + EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | + EAXLISTENERFLAGS_REVERBSCALE | + EAXLISTENERFLAGS_REVERBDELAYSCALE | + EAXLISTENERFLAGS_DECAYHFLIMIT; + + public final static int DSPROPERTY_EAXBUFFER_NONE = 0; + public final static int DSPROPERTY_EAXBUFFER_ALLPARAMETERS = 1; + public final static int DSPROPERTY_EAXBUFFER_DIRECT = 2; + public final static int DSPROPERTY_EAXBUFFER_DIRECTHF = 3; + public final static int DSPROPERTY_EAXBUFFER_ROOM = 4; + public final static int DSPROPERTY_EAXBUFFER_ROOMHF = 5; + public final static int DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR = 6; + public final static int DSPROPERTY_EAXBUFFER_OBSTRUCTION = 7; + public final static int DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO = 8; + public final static int DSPROPERTY_EAXBUFFER_OCCLUSION = 9; + public final static int DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO = 10; + public final static int DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO = 11; + public final static int DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF = 13; + public final static int DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR = 14; + public final static int DSPROPERTY_EAXBUFFER_FLAGS = 15; + +// OR these flags with property id + /** changes take effect immediately */ + public final static int DSPROPERTY_EAXBUFFER_IMMEDIATE = 0x00000000; + /** changes take effect later */ + public final static int DSPROPERTY_EAXBUFFER_DEFERRED = 0x80000000; + public final static int DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS = + DSPROPERTY_EAXBUFFER_NONE | + DSPROPERTY_EAXBUFFER_IMMEDIATE; + + +// Used by DSPROPERTY_EAXBUFFER_FLAGS +// TRUE: value is computed automatically - property is an offset +// FALSE: value is used directly +// +// Note: The number and order of flags may change in future EAX versions. +// To insure future compatibility, use flag defines as follows: +// myFlags = EAXBUFFERFLAGS_DIRECTHFAUTO | EAXBUFFERFLAGS_ROOMAUTO; +// instead of: +// myFlags = 0x00000003; +// + /** affects DSPROPERTY_EAXBUFFER_DIRECTHF */ + public final static int EAXBUFFERFLAGS_DIRECTHFAUTO = 0x00000001; + /** affects DSPROPERTY_EAXBUFFER_ROOM */ + public final static int EAXBUFFERFLAGS_ROOMAUTO = 0x00000002; + /** affects DSPROPERTY_EAXBUFFER_ROOMHF */ + public final static int EAXBUFFERFLAGS_ROOMHFAUTO = 0x00000004; + /** reserved future use */ + public final static int EAXBUFFERFLAGS_RESERVED = 0xFFFFFFF8; + +// property ranges and defaults: + + public final static int EAXBUFFER_MINDIRECT = (-10000); + public final static int EAXBUFFER_MAXDIRECT = 1000; + public final static int EAXBUFFER_DEFAULTDIRECT = 0; + + public final static int EAXBUFFER_MINDIRECTHF = (-10000); + public final static int EAXBUFFER_MAXDIRECTHF = 0; + public final static int EAXBUFFER_DEFAULTDIRECTHF = 0; + + public final static int EAXBUFFER_MINROOM = (-10000); + public final static int EAXBUFFER_MAXROOM = 1000; + public final static int EAXBUFFER_DEFAULTROOM = 0; + + public final static int EAXBUFFER_MINROOMHF = (-10000); + public final static int EAXBUFFER_MAXROOMHF = 0; + public final static int EAXBUFFER_DEFAULTROOMHF = 0; + + public final static float EAXBUFFER_MINROOMROLLOFFFACTOR = 0.0f; + public final static float EAXBUFFER_MAXROOMROLLOFFFACTOR = 10.f; + public final static float EAXBUFFER_DEFAULTROOMROLLOFFFACTOR = 0.0f; + + public final static int EAXBUFFER_MINOBSTRUCTION = (-10000); + public final static int EAXBUFFER_MAXOBSTRUCTION = 0; + public final static int EAXBUFFER_DEFAULTOBSTRUCTION = 0; + + public final static float EAXBUFFER_MINOBSTRUCTIONLFRATIO = 0.0f; + public final static float EAXBUFFER_MAXOBSTRUCTIONLFRATIO = 1.0f; + public final static float EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO = 0.0f; + + public final static int EAXBUFFER_MINOCCLUSION = (-10000); + public final static int EAXBUFFER_MAXOCCLUSION = 0; + public final static int EAXBUFFER_DEFAULTOCCLUSION = 0; + + public final static float EAXBUFFER_MINOCCLUSIONLFRATIO = 0.0f; + public final static float EAXBUFFER_MAXOCCLUSIONLFRATIO = 1.0f; + public final static float EAXBUFFER_DEFAULTOCCLUSIONLFRATIO = 0.25f; + + public final static float EAXBUFFER_MINOCCLUSIONROOMRATIO = 0.0f; + public final static float EAXBUFFER_MAXOCCLUSIONROOMRATIO = 10.0f; + public final static float EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO = 0.5f; + + public final static int EAXBUFFER_MINOUTSIDEVOLUMEHF = (-10000); + public final static int EAXBUFFER_MAXOUTSIDEVOLUMEHF = 0; + public final static int EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF = 0; + + public final static float EAXBUFFER_MINAIRABSORPTIONFACTOR = 0.0f; + public final static float EAXBUFFER_MAXAIRABSORPTIONFACTOR = 10.0f; + public final static float EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR = 1.0f; + + public final static int EAXBUFFER_DEFAULTFLAGS = + EAXBUFFERFLAGS_DIRECTHFAUTO | + EAXBUFFERFLAGS_ROOMAUTO | + EAXBUFFERFLAGS_ROOMHFAUTO; + +// Material transmission presets +// 3 values in this order: +// 1: occlusion (or obstruction) +// 2: occlusion LF Ratio (or obstruction LF Ratio) +// 3: occlusion Room Ratio + +// Single window material preset + public final static int EAX_MATERIAL_SINGLEWINDOW = (-2800); + public final static float EAX_MATERIAL_SINGLEWINDOWLF = 0.71f; + public final static float EAX_MATERIAL_SINGLEWINDOWROOMRATIO = 0.43f; + +// Double window material preset + public final static int EAX_MATERIAL_DOUBLEWINDOW = (-5000); + public final static float EAX_MATERIAL_DOUBLEWINDOWHF = 0.40f; + public final static float EAX_MATERIAL_DOUBLEWINDOWROOMRATIO = 0.24f; + +// Thin door material preset + public final static int EAX_MATERIAL_THINDOOR = (-1800); + public final static float EAX_MATERIAL_THINDOORLF = 0.66f; + public final static float EAX_MATERIAL_THINDOORROOMRATIO = 0.66f; + +// Thick door material preset + public final static int EAX_MATERIAL_THICKDOOR = (-4400); + public final static float EAX_MATERIAL_THICKDOORLF = 0.64f; + public final static float EAX_MATERIAL_THICKDOORROOMRTATION = 0.27f; + +// Wood wall material preset + public final static int EAX_MATERIAL_WOODWALL = (-4000); + public final static float EAX_MATERIAL_WOODWALLLF = 0.50f; + public final static float EAX_MATERIAL_WOODWALLROOMRATIO = 0.30f; + +// Brick wall material preset + public final static int EAX_MATERIAL_BRICKWALL = (-5000); + public final static float EAX_MATERIAL_BRICKWALLLF = 0.60f; + public final static float EAX_MATERIAL_BRICKWALLROOMRATIO = 0.24f; + +// Stone wall material preset + public final static int EAX_MATERIAL_STONEWALL = (-6000); + public final static float EAX_MATERIAL_STONEWALLLF = 0.68f; + public final static float EAX_MATERIAL_STONEWALLROOMRATIO = 0.20f; + +// Curtain material preset + public final static int EAX_MATERIAL_CURTAIN = (-1200); + public final static float EAX_MATERIAL_CURTAINLF = 0.15f; + public final static float EAX_MATERIAL_CURTAINROOMRATIO = 1.00f; +} \ No newline at end of file diff --git a/src/java/net/java/games/joal/eax/EAXFactory.java b/src/java/net/java/games/joal/eax/EAXFactory.java new file mode 100644 index 0000000..2547ed7 --- /dev/null +++ b/src/java/net/java/games/joal/eax/EAXFactory.java @@ -0,0 +1,59 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal.eax; + +/** + * @author Athomas Goldberg + * + */ +public final class EAXFactory { + + static { + System.loadLibrary("joal"); + } + + private static int SOURCE_GUID; + private static int LISTENER_GUID; + + private static EAX eax; + + private static native void init(); + public static EAX getEAX() { + if(eax == null) { + init(); + eax = new EAX(SOURCE_GUID, LISTENER_GUID); + } + return eax; + } +} diff --git a/src/java/net/java/games/joal/util/BufferUtils.java b/src/java/net/java/games/joal/util/BufferUtils.java new file mode 100644 index 0000000..25c9d3d --- /dev/null +++ b/src/java/net/java/games/joal/util/BufferUtils.java @@ -0,0 +1,166 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal.util; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.CharBuffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; +import java.nio.ShortBuffer; + + +/** + * DOCUMENT ME! + * + * @author Administrator To change the template for this generated type comment + * go to Window>Preferences>Java>Code Generation>Code and Comments + */ +public class BufferUtils { + private static final int CHAR = 2; + private static final int SHORT = 2; + private static final int INT = 4; + private static final int LONG = 8; + private static final int FLOAT = 4; + private static final int DOUBLE = 8; + + private BufferUtils() { + } + + /** + * Create a new direct ByteBuffer of the specified size. + * + * @param size (in bytes) of the returned ByteBuffer + * + * @return a new direct ByteBuffer of the specified size + */ + public static ByteBuffer newByteBuffer(int size) { + ByteBuffer result = null; + result = ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); + + return result; + } + + /** + * DOCUMENT ME! + * + * @param size DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static CharBuffer newCharBuffer(int size) { + CharBuffer result = null; + ByteBuffer temp = newByteBuffer(size * CHAR); + result = temp.asCharBuffer(); + + return result; + } + + /** + * DOCUMENT ME! + * + * @param size DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static ShortBuffer newShortBuffer(int size) { + ShortBuffer result = null; + ByteBuffer temp = newByteBuffer(size * SHORT); + result = temp.asShortBuffer(); + + return result; + } + + /** + * DOCUMENT ME! + * + * @param size DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static IntBuffer newIntBuffer(int size) { + IntBuffer result = null; + ByteBuffer temp = newByteBuffer(size * INT); + result = temp.asIntBuffer(); + + return result; + } + + /** + * DOCUMENT ME! + * + * @param size DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static LongBuffer newLongBuffer(int size) { + LongBuffer result = null; + ByteBuffer temp = newByteBuffer(size * LONG); + result = temp.asLongBuffer(); + + return result; + } + + /** + * DOCUMENT ME! + * + * @param size DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static FloatBuffer newFloatBuffer(int size) { + FloatBuffer result = null; + ByteBuffer temp = newByteBuffer(size * FLOAT); + result = temp.asFloatBuffer(); + + return result; + } + + /** + * DOCUMENT ME! + * + * @param size DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static DoubleBuffer newDoubleBuffer(int size) { + DoubleBuffer result = null; + ByteBuffer temp = newByteBuffer(size * DOUBLE); + result = temp.asDoubleBuffer(); + + return result; + } +} diff --git a/src/java/net/java/games/joal/util/WAVData.java b/src/java/net/java/games/joal/util/WAVData.java new file mode 100644 index 0000000..0bc43fa --- /dev/null +++ b/src/java/net/java/games/joal/util/WAVData.java @@ -0,0 +1,57 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal.util; + +import java.nio.ByteBuffer; + +/** + * @author Athomas Goldberg + * + */ +public final class WAVData { + + public final ByteBuffer data; + public final int format; + public final int size; + public final int freq; + public final boolean loop; + + WAVData(ByteBuffer data, int format, int size, int freq, boolean loop) { + this.data = data; + this.format = format; + this.size = size; + this.freq = freq; + this.loop = loop; + } +} diff --git a/src/java/net/java/games/joal/util/WAVLoader.java b/src/java/net/java/games/joal/util/WAVLoader.java new file mode 100644 index 0000000..c0235da --- /dev/null +++ b/src/java/net/java/games/joal/util/WAVLoader.java @@ -0,0 +1,87 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal.util; + +import java.io.File; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; + +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.UnsupportedAudioFileException; + +import net.java.games.joal.ALConstants; + + +/** + * @author Athomas Goldberg + * + */ +public class WAVLoader implements ALConstants { + private static final int BUFFER_SIZE = 128000; + + public static WAVData loadFromFile(String filename) + throws UnsupportedAudioFileException, + IOException { + WAVData result = null; + File soundFile = new File(filename); + AudioInputStream aIn = AudioSystem.getAudioInputStream(soundFile); + ReadableByteChannel aChannel = Channels.newChannel(aIn); + AudioFormat fmt = aIn.getFormat(); + int numChannels = fmt.getChannels(); + int bits = fmt.getSampleSizeInBits(); + int format = AL_FORMAT_MONO8; + + if ((bits == 8) && (numChannels == 1)) { + format = AL_FORMAT_MONO8; + } else if ((bits == 16) && (numChannels == 1)) { + format = AL_FORMAT_MONO16; + } else if ((bits == 8) && (numChannels == 2)) { + format = AL_FORMAT_STEREO8; + } else if ((bits == 16) && (numChannels == 2)) { + format = AL_FORMAT_STEREO16; + } + + int freq = Math.round(fmt.getSampleRate()); + int size = aIn.available(); + ByteBuffer buffer = ByteBuffer.allocateDirect(size); + aChannel.read(buffer); + result = new WAVData(buffer, format, size, freq, false); + aIn.close(); + return result; + } +} diff --git a/src/java/net/java/games/sound3d/AudioSystem3D.java b/src/java/net/java/games/sound3d/AudioSystem3D.java new file mode 100644 index 0000000..66ef9cc --- /dev/null +++ b/src/java/net/java/games/sound3d/AudioSystem3D.java @@ -0,0 +1,215 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.sound3d; + +import java.io.IOException; + +import javax.sound.sampled.UnsupportedAudioFileException; + +import net.java.games.joal.AL; +import net.java.games.joal.ALC; +import net.java.games.joal.ALFactory; +import net.java.games.joal.util.WAVData; +import net.java.games.joal.util.WAVLoader; + + +/** + * DOCUMENT ME! + * + * @author Athomas Goldberg + */ +public class AudioSystem3D { + private static AL al; + private static ALC alc; + private static Listener listener; + + /** + * DOCUMENT ME! + */ + public static void init() { + ALFactory.initialize(); + al = ALFactory.getAL(); + alc = ALFactory.getALC(); + } + + /** + * DOCUMENT ME! + * + * @param device DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static Context createContext(Device device) { + Context result = null; + ALC.Context realContext = alc.alcCreateContext(device.realDevice, null); + result = new Context(alc, realContext, device); + + return result; + } + + /** + * DOCUMENT ME! + * + * @param context DOCUMENT ME! + */ + public static void makeContextCurrent(Context context) { + ALC.Context realContext = null; + + if (context != null) { + realContext = context.realContext; + } + + alc.alcMakeContextCurrent(realContext); + } + + /** + * DOCUMENT ME! + * + * @param deviceName DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static Device openDevice(String deviceName) { + Device result = null; + ALC.Device realDevice = alc.alcOpenDevice(deviceName); + result = new Device(alc, realDevice); + + return result; + } + + /** + * DOCUMENT ME! + * + * @param numBuffers DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static Buffer[] generateBuffers(int numBuffers) { + Buffer[] result = new Buffer[numBuffers]; + int[] arr = new int[numBuffers]; + al.alGenBuffers(numBuffers, arr); + + for (int i = 0; i < numBuffers; i++) { + result[i] = new Buffer(al, arr[i]); + } + + return result; + } + + /** + * DOCUMENT ME! + * + * @param filename DOCUMENT ME! + * + * @return DOCUMENT ME! + * + * @throws IOException DOCUMENT ME! + * @throws UnsupportedAudioFileException DOCUMENT ME! + */ + public static Buffer loadBuffer(String filename) + throws IOException, UnsupportedAudioFileException { + Buffer result; + Buffer[] tmp = generateBuffers(1); + result = tmp[0]; + + WAVData wd = WAVLoader.loadFromFile(filename); + result.configure(wd.data, wd.format, wd.freq); + + return result; + } + + /** + * DOCUMENT ME! + * + * @param filename DOCUMENT ME! + * + * @return DOCUMENT ME! + * + * @throws IOException DOCUMENT ME! + * @throws UnsupportedAudioFileException DOCUMENT ME! + */ + public static Source loadSource(String filename) + throws IOException, UnsupportedAudioFileException { + Buffer buffer = loadBuffer(filename); + return generateSource(buffer); + } + + /** + * DOCUMENT ME! + * + * @param numSources DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static Source[] generateSources(int numSources) { + Source[] result = new Source[numSources]; + int[] arr = new int[numSources]; + al.alGenSources(numSources, arr); + + for (int i = 0; i < numSources; i++) { + result[i] = new Source(al, arr[i]); + } + + return result; + } + + /** + * DOCUMENT ME! + * + * @param buff DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static Source generateSource(Buffer buff) { + Source result = null; + Source[] tmp = generateSources(1); + result = tmp[0]; + result.setBuffer(buff); + + return result; + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public static Listener getListener() { + if (listener == null) { + listener = new Listener(al); + } + + return listener; + } +} diff --git a/src/java/net/java/games/sound3d/Buffer.java b/src/java/net/java/games/sound3d/Buffer.java new file mode 100644 index 0000000..c94915b --- /dev/null +++ b/src/java/net/java/games/sound3d/Buffer.java @@ -0,0 +1,140 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.sound3d; + +import java.nio.ByteBuffer; + +import net.java.games.joal.AL; + + +/** + * DOCUMENT ME! + * + * @author Athomas Goldberg + */ +public class Buffer { + //DOCUMENT ME! + public final static int FORMAT_MONO8 = AL.AL_FORMAT_MONO8; + + //DOCUMENT ME! + public final static int FORMAT_MONO16 = AL.AL_FORMAT_MONO16; + + //DOCUMENT ME! + public final static int FORMAT_STEREO8 = AL.AL_FORMAT_STEREO8; + + //DOCUMENT ME! + public final static int FORMAT_STEREO16 = AL.AL_FORMAT_STEREO16; + final int bufferName; + private ByteBuffer data; + private boolean isConfigured = false; + private final AL al; + + Buffer(AL al, int bufferName) { + this.bufferName = bufferName; + this.al = al; + } + + /** + * DOCUMENT ME! + * + * @param data DOCUMENT ME! + * @param format DOCUMENT ME! + * @param freq DOCUMENT ME! + */ + public void configure(ByteBuffer data, int format, int freq) { + if (!isConfigured) { + al.alBufferData(bufferName, format, data, data.capacity(), freq); + } + } + + /** + * DOCUMENT ME! + */ + public void delete() { + data = null; + al.alDeleteBuffers(1, new int[] { bufferName }); + } + + /** + * DOCUMENT ME! + * + */ + public int getBitDepth() { + int[] i = new int[1]; + al.alGetBufferi(bufferName, AL.AL_BITS, i); + + return i[0]; + } + + /** + * DOCUMENT ME! + * + */ + public int getNumChannels() { + int[] i = new int[1]; + al.alGetBufferi(bufferName, AL.AL_CHANNELS, i); + + return i[0]; + } + + /** + * DOCUMENT ME! + * + */ + public ByteBuffer getData() { + return data; + } + + /** + * DOCUMENT ME! + * + */ + public int getFrequency() { + int[] i = new int[1]; + al.alGetBufferi(bufferName, AL.AL_FREQUENCY, i); + + return i[0]; + } + + /** + * DOCUMENT ME! + * + */ + public int getSize() { + int[] i = new int[1]; + al.alGetBufferi(bufferName, AL.AL_SIZE, i); + + return i[0]; + } +} diff --git a/src/java/net/java/games/sound3d/Context.java b/src/java/net/java/games/sound3d/Context.java new file mode 100644 index 0000000..5215810 --- /dev/null +++ b/src/java/net/java/games/sound3d/Context.java @@ -0,0 +1,64 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.sound3d; + +import net.java.games.joal.ALC; + +/** + * @author Athomas Goldberg + * + */ +public class Context { + private final ALC alc; + final ALC.Context realContext; + final Device device; + + Context(ALC alc, ALC.Context realContext, Device device) { + this.alc = alc; + this.realContext = realContext; + this.device = device; + } + + public void suspend() { + alc.alcSuspendContext(realContext); + } + + public void destroy() { + alc.alcDestroyContext(realContext); + } + + public Device getDevice() { + return device; + } +} diff --git a/src/java/net/java/games/sound3d/Device.java b/src/java/net/java/games/sound3d/Device.java new file mode 100644 index 0000000..5973df3 --- /dev/null +++ b/src/java/net/java/games/sound3d/Device.java @@ -0,0 +1,54 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.sound3d; + +import net.java.games.joal.ALC; + +/** + * @author Athomas Goldberg + * + */ +public class Device { + private final ALC alc; + final ALC.Device realDevice; + + Device(ALC alc, ALC.Device realDevice) { + this.alc = alc; + this.realDevice = realDevice; + } + + public void close() { + alc.alcCloseDevice(realDevice); + } +} diff --git a/src/java/net/java/games/sound3d/Listener.java b/src/java/net/java/games/sound3d/Listener.java new file mode 100644 index 0000000..ad93099 --- /dev/null +++ b/src/java/net/java/games/sound3d/Listener.java @@ -0,0 +1,95 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.sound3d; + +import net.java.games.joal.AL; + +/** + * @author Athomas Goldberg + * + */ +public class Listener { + private final AL al; + Listener(AL al) { + this.al = al; + } + + public void setGain(float gain) { + al.alListenerf(AL.AL_GAIN,gain); + } + + public float getGain() { + float[] f = new float[1]; + al.alGetListenerf(AL.AL_GAIN,f); + return f[0]; + } + + public void setPosition(float x, float y, float z) { + al.alListener3f(AL.AL_POSITION,x,y,z); + } + + public void setPosition(Vec3f position) { + al.alListener3f(AL.AL_POSITION,position.v1, position.v2, position.v3); + } + + public Vec3f getPosition() { + Vec3f result = null; + float[] tmp = new float[3]; + al.alGetListenerfv(AL.AL_POSITION,tmp); + result = new Vec3f(tmp[0],tmp[1],tmp[2]); + return result; + } + + public void setVelocity(Vec3f velocity) { + al.alListener3f(AL.AL_VELOCITY,velocity.v1, velocity.v2, velocity.v3); + } + + public Vec3f getVelocity() { + Vec3f result = null; + float[] tmp = new float[3]; + al.alGetListenerfv(AL.AL_VELOCITY,tmp); + result = new Vec3f(tmp[0],tmp[1],tmp[2]); + return result; + } + + public void setOrientation(float[] orientation) { + al.alListenerfv(AL.AL_ORIENTATION,orientation); + } + + public float[] getOrientation() { + float[] tmp = new float[6]; + al.alGetListenerfv(AL.AL_ORIENTATION,tmp); + return tmp; + } +} diff --git a/src/java/net/java/games/sound3d/Source.java b/src/java/net/java/games/sound3d/Source.java new file mode 100644 index 0000000..f96207c --- /dev/null +++ b/src/java/net/java/games/sound3d/Source.java @@ -0,0 +1,286 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.sound3d; + +import net.java.games.joal.AL; + + +/** + * @author Athomas Goldberg + * + */ +public final class Source { + private final AL al; + private final int sourceName; + private Buffer buffer; + + Source( + AL al, + int sourceName) { + this.al = al; + this.sourceName = sourceName; + } + + public void play() { + al.alSourcePlay(sourceName); + } + + public void pause() { + al.alSourcePause(sourceName); + } + + public void stop() { + al.alSourceStop(sourceName); + } + + public void rewind() { + al.alSourceRewind(sourceName); + } + + public void delete() { + al.alDeleteSources(1, new int[] { sourceName }); + } + + public void setPitch(float pitch) { + al.alSourcef(sourceName, AL.AL_PITCH, pitch); + } + + public float getPitch() { + float[] result = new float[1]; + al.alGetSourcef(sourceName, AL.AL_PITCH,result); + return result[0]; + } + + public void setGain(float gain) { + al.alSourcef(sourceName, AL.AL_GAIN, gain); + } + + public float getGain() { + float[] result = new float[1]; + al.alGetSourcef(sourceName, AL.AL_GAIN, result); + return result[0]; + } + + public void setMaxDistance(float maxDistance) { + al.alSourcef(sourceName, AL.AL_MAX_DISTANCE, maxDistance); + } + + public float getMaxDistance() { + float[] result = new float[1]; + al.alGetSourcef(sourceName, AL.AL_MAX_DISTANCE,result); + return result[0]; + } + + public void setRolloffFactor(float rolloffFactor) { + al.alSourcef(sourceName, AL.AL_ROLLOFF_FACTOR, rolloffFactor); + } + + public float getRolloffFactor() { + float[] result = new float[1]; + al.alGetSourcef(sourceName, AL.AL_ROLLOFF_FACTOR, result); + return result[0]; + } + + public void setReferenceDistance(float referenceDistance) { + al.alSourcef(sourceName, AL.AL_REFERENCE_DISTANCE, referenceDistance); + } + + public float getReferenceDistance() { + float[] result = new float[1]; + al.alGetSourcef(sourceName, AL.AL_REFERENCE_DISTANCE, result); + return result[0]; + } + + public void setMinGain(float minGain) { + al.alSourcef(sourceName, AL.AL_MIN_GAIN, minGain); + } + + public float getMinGain() { + float[] result = new float[1]; + al.alGetSourcef(sourceName, AL.AL_MIN_GAIN, result); + return result[0]; + } + + public void setMaxGain(float maxGain) { + al.alSourcef(sourceName, AL.AL_MAX_GAIN, maxGain); + } + + public float getMaxGain() { + float[] result = new float[1]; + al.alGetSourcef(sourceName, AL.AL_MAX_GAIN, result); + return result[0]; + } + + public void setConeOuterGain(float coneOuterGain) { + al.alSourcef(sourceName, AL.AL_CONE_OUTER_GAIN, coneOuterGain); + } + + public float getConeOuterGain() { + float[] result = new float[1]; + al.alGetSourcef(sourceName, AL.AL_CONE_OUTER_GAIN, result); + return result[0]; + } + + public void setPosition(Vec3f position) { + al.alSource3f( + sourceName, + AL.AL_POSITION, + position.v1, + position.v2, + position.v3); + } + + public void setPosition( + float x, + float y, + float z) { + al.alSource3f(sourceName, AL.AL_POSITION, x, y, z); + } + + public Vec3f getPosition() { + Vec3f result = null; + float[] pos = new float[3]; + al.alGetSourcefv(sourceName, AL.AL_POSITION, pos); + result = new Vec3f(pos[0], pos[1], pos[2]); + return result; + } + + public void setVelocity(Vec3f velocity) { + al.alSource3f( + sourceName, + AL.AL_VELOCITY, + velocity.v1, + velocity.v2, + velocity.v3); + } + + public void setVelocity( + float x, + float y, + float z) { + al.alSource3f(sourceName, AL.AL_VELOCITY, x, y, z); + } + + public Vec3f getVelocity() { + Vec3f result = null; + float[] vel = new float[3]; + al.alGetSourcefv(sourceName, AL.AL_VELOCITY, vel); + result = new Vec3f(vel[0], vel[1], vel[2]); + + return result; + } + + public void setDirection(Vec3f direction) { + al.alSource3f( + sourceName, + AL.AL_DIRECTION, + direction.v1, + direction.v2, + direction.v3); + } + + public void setDirection( + float x, + float y, + float z) { + al.alSource3f(sourceName, AL.AL_DIRECTION, x, y, z); + } + + public Vec3f getDirection() { + Vec3f result = null; + float[] dir = new float[3]; + al.alGetSourcefv(sourceName, AL.AL_DIRECTION, dir); + result = new Vec3f(dir[0], dir[1], dir[2]); + + return result; + } + + public void setSourceRelative(boolean isRelative) { + int rel = isRelative ? 1 : 0; + al.alSourcei(sourceName, AL.AL_SOURCE_RELATIVE, rel); + } + + public boolean isSourceRelative() { + int[] result = new int[1]; + al.alGetSourcei(sourceName, AL.AL_SOURCE_RELATIVE, result); + return result[0] == 1; + } + + public void setLooping(boolean isLooping) { + int loop = isLooping ? 1 : 0; + al.alSourcei(sourceName, AL.AL_LOOPING, loop); + } + + public int getBuffersQueued() { + int[] result = new int[1]; + al.alGetSourcei(sourceName, AL.AL_BUFFERS_QUEUED, result); + return result[0]; + } + + public int getBuffersProcessed() { + int[] result = new int[1]; + al.alGetSourcei(sourceName, AL.AL_BUFFERS_PROCESSED, result); + return result[0]; + } + + public void setBuffer(Buffer buffer) { + al.alSourcei(sourceName, AL.AL_BUFFER, buffer.bufferName); + this.buffer = buffer; + } + + public Buffer getBuffer() { + return buffer; + } + + public void queueBuffers(Buffer[] buffers) { + int numBuffers = buffers.length; + int[] arr = new int[numBuffers]; + + for (int i = 0; i < numBuffers; i++) { + arr[i] = buffers[i].bufferName; + } + + al.alSourceQueueBuffers(sourceName, numBuffers, arr); + } + + public void unqueueBuffers(Buffer[] buffers) { + int numBuffers = buffers.length; + int[] arr = new int[numBuffers]; + + for (int i = 0; i < numBuffers; i++) { + arr[i] = buffers[i].bufferName; + } + al.alSourceUnqueueBuffers(sourceName, numBuffers, arr); + } +} diff --git a/src/java/net/java/games/sound3d/Vec3f.java b/src/java/net/java/games/sound3d/Vec3f.java new file mode 100644 index 0000000..4823812 --- /dev/null +++ b/src/java/net/java/games/sound3d/Vec3f.java @@ -0,0 +1,52 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.sound3d; + +/** + * @author Athomas Goldberg + * + */ +public final class Vec3f { + + public final float v1; + public final float v2; + public final float v3; + + public Vec3f(float v1, float v2, float v3) { + this.v1 = v1; + this.v2 = v2; + this.v3 = v3; + } +} diff --git a/src/native/albind.c b/src/native/albind.c new file mode 100644 index 0000000..023f235 --- /dev/null +++ b/src/native/albind.c @@ -0,0 +1,720 @@ +/** +* 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. +*/ + + +#include "albind.h" +#include "extal.h" + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGenBuffersNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint numBuffers, jobject buffers) { + if(buffers == 0) { + + } + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,buffers); + alGenBuffers((ALsizei)numBuffers,p); +} +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGenBuffersNative__I_3I + (JNIEnv *env, jobject obj, jint numBuffers, jintArray buffers) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,buffers,0); + if(p) { + alGenBuffers((ALsizei)numBuffers,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,buffers,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDeleteBuffersNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint numBuffers, jobject buffers) { + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,buffers); + if(p) { + alDeleteBuffers((ALsizei)numBuffers,p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDeleteBuffersNative__I_3I + (JNIEnv *env, jobject obj, jint numBuffers, jintArray buffers) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,buffers,0); + if(p) { + alDeleteBuffers((ALsizei)numBuffers,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,buffers,p,0); +} + +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alIsBuffer + (JNIEnv *env, jobject obj, jint bufferName) { + jboolean result; + result = alIsBuffer((ALuint)bufferName); + return result; +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alBufferDataNative__IILjava_nio_ByteBuffer_2II + (JNIEnv *env, + jobject obj, + jint bufferName, + jint format, + jobject data, + jint size, + jint frequency) { + ALvoid *p = (ALvoid*)(*env)->GetDirectBufferAddress(env,data); + if(p) { + alBufferData((ALuint)bufferName, + (ALenum)format, + p, + (ALsizei)size, + (ALsizei)frequency); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alBufferDataNative__II_3BII + (JNIEnv *env, + jobject obj, + jint bufferName, + jint format, + jbyteArray data, + jint size, + jint frequency) { + ALvoid *p = (ALvoid*)(*env)->GetPrimitiveArrayCritical(env,data,0); + if(p) { + alBufferData((ALuint)bufferName, + (ALenum)format, + p, + (ALsizei)size, + (ALsizei)frequency); + } + (*env)->ReleasePrimitiveArrayCritical(env,data,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetBufferfNative__II_3F + (JNIEnv *env, jobject obj, jint buffer, jint pname, jfloatArray rv) { + ALfloat *result = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,rv,0); + alGetBufferf((ALuint)buffer, (ALenum)pname, result); + (*env)->ReleasePrimitiveArrayCritical(env,rv,result,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetBufferfNative__IILjava_nio_FloatBuffer_2 + (JNIEnv *env, jobject obj, jint buffer, jint pname, jobject rv) { + ALfloat *p = (ALfloat*)(*env)->GetDirectBufferAddress(env,rv); + if(p) { + alGetBufferf((ALuint)buffer, (ALenum)pname, p); + } +} + +JNIEXPORT jfloat JNICALL Java_net_java_games_joal_ALImpl_alGetBufferf__II + (JNIEnv *env, jobject obj, jint buffer, jint pname) { + jfloat result; + alGetBufferf((ALuint)buffer, (ALenum)pname, &result); + return result; +} + + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetBufferiNative__II_3I + (JNIEnv *env, jobject obj, jint buffer, jint pname, jintArray rv) { + ALint *p = (ALint*)(*env)->GetPrimitiveArrayCritical(env,rv,0); + if(p) { + alGetBufferi((ALuint)buffer, (ALenum)pname, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,rv,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetBufferiNative__IILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint buffer, jint pname, jobject rv) { + ALint *p = (ALint*)(*env)->GetDirectBufferAddress(env,rv); + if(p) { + alGetBufferi((ALuint)buffer, (ALenum)pname, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,rv,p,0); +} + +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetBufferi__II + (JNIEnv *env, jobject obj, jint buffer, jint pname) { + ALint result; + alGetBufferi((ALuint)buffer, (ALenum)pname, &result); + return (jint)result; +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGenSourcesNative__I_3I + (JNIEnv *env, jobject obj, jint numSources, jintArray sources) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,sources,0); + if(p) { + alGenSources((ALsizei)numSources,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,sources,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGenSourcesNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint numSources, jobject sources) { + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,sources); + if(p) { + alGenSources((ALsizei)numSources,p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDeleteSourcesNative__I_3I + (JNIEnv *env, jobject obj, jint numSources, jintArray sources) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,sources,0); + if(p) { + alDeleteSources((ALsizei)numSources, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,sources,p,0); +} + +/* + * Class: net_java_games_joal_AL + * Method: alDeleteSources + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDeleteSourcesNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint numSources, jobject sources) { + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,sources); + if(p) { + alDeleteSources((ALsizei)numSources, p); + } +} + +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alIsSource + (JNIEnv *env, jobject obj, jint sourceName) { + alIsSource((ALuint)sourceName); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcei + (JNIEnv *env, jobject obj, jint source, jint pname, jint value) { + alSourcei((ALuint)source,(ALenum)pname, (ALint)value); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcef + (JNIEnv *env, jobject obj, jint source, jint pname, jfloat value) { + alSourcef((ALuint)source,(ALenum)pname, (ALfloat)value); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcefvNative__II_3F + (JNIEnv *env, jobject obj, jint source, jint pname, jfloatArray value) { + ALfloat *p = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,value,0); + if(p) { + alSourcefv((ALuint)source, (ALenum)pname, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,value,p,0); +} + +/* + * Class: net_java_games_joal_AL + * Method: alSourcefv + * Signature: (IILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcefvNative__IILjava_nio_FloatBuffer_2 + (JNIEnv *env, jobject obj, jint source, jint pname, jobject value) { + ALfloat *p = (ALfloat*)(*env)->GetDirectBufferAddress(env,value); + alSourcefv((ALuint)source, (ALenum)pname, p); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSource3f + (JNIEnv *env, + jobject obj, + jint source, + jint pname, + jfloat v1, + jfloat v2, + jfloat v3) { + alSource3f((ALuint)source, + (ALenum)pname, + (ALfloat)v1, + (ALfloat)v2, + (ALfloat)v3); +} + + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourcefNative__II_3F + (JNIEnv *env, jobject obj, jint source, jint pname, jfloatArray rv) { + ALfloat *p = (*env)->GetPrimitiveArrayCritical(env,rv,0); + if(p) { + alGetSourcef((ALuint)source, (ALenum)pname, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,rv,p,0); +} + +/* + * Class: net_java_games_joal_AL + * Method: alGetSourcef + * Signature: (IILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourcefNative__IILjava_nio_FloatBuffer_2 + (JNIEnv *env, jobject obj, jint source, jint pname, jobject rv) { + ALfloat *p = (*env)->GetDirectBufferAddress(env,rv); + if(p) { + alGetSourcef((ALuint)source, (ALenum)pname, p); + } +} + +/* + * Class: net_java_games_joal_AL + * Method: alGetSourcef + * Signature: (II)F + */ +JNIEXPORT jfloat JNICALL Java_net_java_games_joal_ALImpl_alGetSourcef__II + (JNIEnv *env, jobject obj, jint source, jint pname) { + jfloat result; + alGetSourcef((ALuint)source, (ALenum)pname, &result); + return result; +} + + + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourcefvNative__IILjava_nio_FloatBuffer_2 + (JNIEnv *env, jobject obj, jint source, jint pname, jobject value) { + ALfloat *p = (ALfloat*)(*env)->GetDirectBufferAddress(env,value); + if(p) { + alGetSourcefv((ALuint)source, (ALenum)pname, p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourcefvNative__II_3F + (JNIEnv *env, jobject obj, jint source, jint pname, jfloatArray value) { + ALfloat *p = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,value,0); + if(p) { + alGetSourcefv((ALuint)source, (ALenum)pname, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,value,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourceiNative__II_3I + (JNIEnv *env, jobject obj, jint source, jint pname, jintArray rv) { + ALint *p = (ALint*)(*env)->GetPrimitiveArrayCritical(env,rv,0); + if(p) { + alGetSourcei((ALuint)source, (ALenum)pname, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,rv,p,0); +} + +/* + * Class: net_java_games_joal_AL + * Method: alGetSourcei + * Signature: (IILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourceiNative__IILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint source, jint pname, jobject rv) { + ALint *p = (ALint*)(*env)->GetDirectBufferAddress(env,rv); + if(p) { + alGetSourcei((ALuint)source, (ALenum)pname, p); + } +} + +/* + * Class: net_java_games_joal_AL + * Method: alGetSourcei + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetSourcei__II + (JNIEnv *env, jobject obj, jint source, jint pname) { + ALint result; + alGetSourcei((ALuint)source, (ALenum)pname, &result); + return (jint)result; +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePlay + (JNIEnv *env, jobject obj, jint source) { + alSourcePlay((ALuint)source); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePlayvNative__I_3I + (JNIEnv *env, jobject obj, jint numSources, jintArray sources) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,sources,0); + if(p) { + alSourcePlayv((ALsizei)numSources,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,sources,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePlayvNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint numSources, jobject sources) { + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,sources); + if(p) { + alSourcePlayv((ALsizei)numSources,p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePause + (JNIEnv *env, jobject obj, jint source) { + alSourcePause((ALuint)source); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePausevNative__I_3I + (JNIEnv *env, jobject obj, jint numSources, jintArray sources) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,sources,0); + if(p) { + alSourcePausev((ALsizei)numSources,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,sources,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePausevNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint numSources, jobject sources) { + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,sources); + if(p) { + alSourcePausev((ALsizei)numSources,p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceStop + (JNIEnv *env, jobject obj, jint source) { + alSourceStop((ALuint)source); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceStopvNative__I_3I + (JNIEnv *env, jobject obj, jint numSources, jintArray sources) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,sources,0); + if(p) { + alSourceStopv((ALsizei)numSources,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,sources,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceStopvNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint numSources, jobject sources) { + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,sources); + if(p) { + alSourceStopv((ALsizei)numSources,p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceRewind + (JNIEnv *env, jobject obj, jint source) { + alSourceRewind((ALuint)source); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceRewindvNative__I_3I + (JNIEnv *env, jobject obj, jint numSources, jintArray sources) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,sources,0); + if(p) { + alSourceRewindv((ALsizei)numSources,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,sources,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceRewindvNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint numSources, jobject sources) { + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,sources); + if(p) { + alSourceRewindv((ALsizei)numSources,p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceQueueBuffersNative__IILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint source, jint numBuffers, jobject buffers) { + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,buffers); + if(p) { + alSourceQueueBuffers((ALuint)source, (ALsizei)numBuffers, p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceQueueBuffersNative__II_3I + (JNIEnv *env, jobject obj, jint source, jint numBuffers, jintArray buffers) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,buffers,0); + if(p) { + alSourceQueueBuffers((ALuint)source, (ALsizei)numBuffers, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,buffers,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceUnqueueBuffersNative__II_3I + (JNIEnv *env, jobject obj, jint source, jint numBuffers, jintArray buffers) { + ALuint *p = (ALuint*)(*env)->GetPrimitiveArrayCritical(env,buffers,0); + if(p) { + alSourceUnqueueBuffers((ALuint)source, (ALsizei)numBuffers, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,buffers,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceUnqueueBuffersNative__IILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint source, jint numBuffers, jobject buffers) { + ALuint *p = (ALuint*)(*env)->GetDirectBufferAddress(env,buffers); + if(p) { + alSourceUnqueueBuffers((ALuint)source, (ALsizei)numBuffers, p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alListenerf + (JNIEnv *env, jobject obj, jint pname, jfloat value) { + alListenerf((ALenum)pname,(ALfloat)value); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alListener3f + (JNIEnv *env, jobject obj, jint pname, jfloat v1, jfloat v2, jfloat v3) { + alListener3f((ALenum)pname, (ALfloat)v1, (ALfloat)v2, (ALfloat)v3); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alListenerfvNative__I_3F + (JNIEnv *env, jobject obj, jint pname, jfloatArray rv) { + ALfloat *p = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,rv,0); + alListenerfv((ALenum)pname, p); + (*env)->ReleasePrimitiveArrayCritical(env,rv,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alListenerfvNative__ILjava_nio_FloatBuffer_2 + (JNIEnv *env, jobject obj, jint pname, jobject value) { + ALfloat *p = (ALfloat*)(*env)->GetDirectBufferAddress(env,value); + alListenerfv((ALenum)pname, p); +} + + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListenerfNative__I_3F + (JNIEnv *env, jobject obj, jint pname, jfloatArray rv) { + ALfloat *p = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,rv,0); + if(p) { + alGetListenerf((ALenum)pname, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,rv,p,0); +} + +/* + * Class: net_java_games_joal_AL + * Method: alGetListenerf + * Signature: (ILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListenerfNative__ILjava_nio_FloatBuffer_2 + (JNIEnv *env, jobject obj, jint pname, jobject rv) { + ALfloat *p = (ALfloat*)(*env)->GetDirectBufferAddress(env,rv); + if(p) { + alGetListenerf((ALenum)pname, p); + } +} + +/* + * Class: net_java_games_joal_AL + * Method: alGetListenerf + * Signature: (I)F + */ +JNIEXPORT jfloat JNICALL Java_net_java_games_joal_ALImpl_alGetListenerf__I + (JNIEnv *env, jobject object, jint pname) { + jfloat result; + alGetListenerf((ALenum)pname, &result); + return result; +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListener3fNative__I_3F_3F_3F + (JNIEnv *env, jobject obj, jint pname, jfloatArray v1, jfloatArray v2, jfloatArray v3) { + ALfloat *p1 = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,v1,0); + ALfloat *p2 = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,v2,0); + ALfloat *p3 = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,v3,0); + if(p1 && p2 && p3) { + alGetListener3f((ALenum)pname, p1, p2, p3); + } + (*env)->ReleasePrimitiveArrayCritical(env,v3,p3,0); + (*env)->ReleasePrimitiveArrayCritical(env,v2,p2,0); + (*env)->ReleasePrimitiveArrayCritical(env,v1,p1,0); +} + + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListener3fNative__ILjava_nio_FloatBuffer_2Ljava_nio_FloatBuffer_2Ljava_nio_FloatBuffer_2 + (JNIEnv *env, jobject obj, jint pname, jobject v1, jobject v2, jobject v3) { + ALfloat *p1 = (ALfloat*)(*env)->GetDirectBufferAddress(env,v1); + ALfloat *p2 = (ALfloat*)(*env)->GetDirectBufferAddress(env,v2); + ALfloat *p3 = (ALfloat*)(*env)->GetDirectBufferAddress(env,v3); + if(p1 && p2 && p3) { + alGetListener3f((ALenum)pname, p1, p2, p3); + } +} + + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListenerfvNative__I_3F + (JNIEnv *env, jobject obj, jint pname, jfloatArray value) { + ALfloat *p = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,value,0); + if(p) { + alGetListenerfv((ALenum)pname, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,value,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListenerfvNative__ILjava_nio_FloatBuffer_2 + (JNIEnv *env, jobject obj, jint pname, jobject value) { + ALfloat *p = (ALfloat*)(*env)->GetDirectBufferAddress(env,value); + if(p) { + alGetListenerfv((ALenum)pname, p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListeneriNative__I_3I + (JNIEnv *env, jobject obj, jint pname, jintArray value) { + ALint *p = (ALint*)(*env)->GetPrimitiveArrayCritical(env,value,0); + if(p) { + alGetListeneri((ALenum)pname, p); + } + (*env)->ReleasePrimitiveArrayCritical(env,value,p,0); + +} + +/* + * Class: net_java_games_joal_AL + * Method: alGetListeneri + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListeneriNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint pname, jobject value) { + ALint *p = (ALint*)(*env)->GetDirectBufferAddress(env,value); + if(p) { + alGetListeneri((ALenum)pname, p); + } +} + +/* + * Class: net_java_games_joal_AL + * Method: alGetListeneri + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetListeneri__I + (JNIEnv *env, jobject obj, jint pname) { + ALint result; + alGetListeneri((ALenum)pname, &result); + return (jint)result; +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alEnable + (JNIEnv *env, jobject obj, jint capability) { + alEnable((ALenum)capability); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDisable + (JNIEnv *env, jobject obj, jint capability) { + alDisable((ALenum)capability); +} + +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alIsEnabled + (JNIEnv *env, jobject obj, jint pname) { + return alIsEnabled((ALenum)pname); +} + +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alGetBoolean + (JNIEnv *env, jobject obj, jint pname) { + return alGetBoolean((ALenum)pname); +} + +JNIEXPORT jdouble JNICALL Java_net_java_games_joal_ALImpl_alGetDouble + (JNIEnv *env, jobject obj, jint pname) { + return alGetDouble((ALenum)pname); +} + +JNIEXPORT jfloat JNICALL Java_net_java_games_joal_ALImpl_alGetFloat + (JNIEnv *env, jobject obj, jint pname) { + return alGetFloat((ALenum)pname); +} + +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetInteger + (JNIEnv *env, jobject obj, jint pname) { + return alGetInteger((ALenum)pname); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetDoublevNative__I_3D + (JNIEnv *env, jobject obj, jint pname, jdoubleArray value) { + ALdouble *p = (ALdouble*)(*env)->GetPrimitiveArrayCritical(env,value,0); + if(p) { + alGetDoublev((ALenum)pname,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,value,p,0); + +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetDoublevNative__ILjava_nio_DoubleBuffer_2 + (JNIEnv *env, jobject obj, jint pname, jobject value) { + ALdouble *p = (ALdouble*)(*env)->GetDirectBufferAddress(env,value); + if(p) { + alGetDoublev((ALenum)pname,p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetFloatvNative__I_3F + (JNIEnv *env, jobject obj, jint pname, jfloatArray value) { + ALfloat *p = (ALfloat*)(*env)->GetPrimitiveArrayCritical(env,value,0); + if(p) { + alGetFloatv((ALenum)pname,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,value,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetFloatvNative__ILjava_nio_FloatBuffer_2 + (JNIEnv *env, jobject obj, jint pname, jobject value) { + ALfloat *p = (ALfloat*)(*env)->GetDirectBufferAddress(env,value); + if(p) { + alGetFloatv((ALenum)pname,p); + } +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetIntegervNative__I_3I + (JNIEnv *env, jobject obj, jint pname, jintArray value) { + ALint *p = (ALint*)(*env)->GetPrimitiveArrayCritical(env,value,0); + if(p) { + alGetIntegerv((ALenum)pname,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,value,p,0); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetIntegervNative__ILjava_nio_IntBuffer_2 + (JNIEnv *env, jobject obj, jint pname, jobject value) { + ALint *p = (ALint*)(*env)->GetDirectBufferAddress(env,value); + if(p) { + alGetIntegerv((ALenum)pname,p); + } +} + + +JNIEXPORT jstring JNICALL Java_net_java_games_joal_ALImpl_alGetString + (JNIEnv *env, jobject obj, jint pname) { + ALubyte* p = alGetString((ALenum)pname); + return (*env)->NewStringUTF(env, p); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDistanceModel + (JNIEnv *env, jobject obj, jint value) { + alDistanceModel((ALenum)value); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDopplerFactor + (JNIEnv *env, jobject obj, jfloat value) { + alDopplerFactor((ALfloat)value); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDopplerVelocity + (JNIEnv *env, jobject obj, jfloat value) { + alDopplerVelocity((ALfloat)value); +} + +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetError + (JNIEnv *env, jobject obj) { + return alGetError(); +} + +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alIsExtensionPresent + (JNIEnv *env, jobject obj, jstring extName) { + ALubyte *str; + str = (ALubyte*)(*env)->GetStringUTFChars(env, extName, NULL); + if(!str) { + return 0; + } + return alIsExtensionPresent(str); +} diff --git a/src/native/albind.h b/src/native/albind.h new file mode 100644 index 0000000..fd64846 --- /dev/null +++ b/src/native/albind.h @@ -0,0 +1,703 @@ +/** +* 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. +*/ + + +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class net_java_games_joal_ALImpl */ + +#ifndef _Included_net_java_games_joal_ALImpl +#define _Included_net_java_games_joal_ALImpl +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: net_java_games_joal_ALImpl + * Method: alGenBuffersNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGenBuffersNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGenBuffersNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGenBuffersNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alDeleteBuffersNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDeleteBuffersNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alDeleteBuffersNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDeleteBuffersNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alIsBuffer + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alIsBuffer + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alBufferDataNative + * Signature: (II[BII)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alBufferDataNative__II_3BII + (JNIEnv *, jobject, jint, jint, jbyteArray, jint, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alBufferDataNative + * Signature: (IILjava/nio/ByteBuffer;II)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alBufferDataNative__IILjava_nio_ByteBuffer_2II + (JNIEnv *, jobject, jint, jint, jobject, jint, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetBufferfNative + * Signature: (II[F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetBufferfNative__II_3F + (JNIEnv *, jobject, jint, jint, jfloatArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetBufferfNative + * Signature: (IILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetBufferfNative__IILjava_nio_FloatBuffer_2 + (JNIEnv *, jobject, jint, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetBufferf + * Signature: (II)F + */ +JNIEXPORT jfloat JNICALL Java_net_java_games_joal_ALImpl_alGetBufferf + (JNIEnv *, jobject, jint, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetBufferiNative + * Signature: (II[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetBufferiNative__II_3I + (JNIEnv *, jobject, jint, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetBufferiNative + * Signature: (IILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetBufferiNative__IILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetBufferi + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetBufferi + (JNIEnv *, jobject, jint, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGenSourcesNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGenSourcesNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGenSourcesNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGenSourcesNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alDeleteSourcesNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDeleteSourcesNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alDeleteSourcesNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDeleteSourcesNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alIsSource + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alIsSource + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcei + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcei + (JNIEnv *, jobject, jint, jint, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcef + * Signature: (IIF)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcef + (JNIEnv *, jobject, jint, jint, jfloat); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcefv + * Signature: (II[F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcefv + (JNIEnv *, jobject, jint, jint, jfloatArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcefvNative + * Signature: (IILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcefvNative + (JNIEnv *, jobject, jint, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSource3f + * Signature: (IIFFF)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSource3f + (JNIEnv *, jobject, jint, jint, jfloat, jfloat, jfloat); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetSourcefNative + * Signature: (II[F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourcefNative__II_3F + (JNIEnv *, jobject, jint, jint, jfloatArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetSourcefNative + * Signature: (IILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourcefNative__IILjava_nio_FloatBuffer_2 + (JNIEnv *, jobject, jint, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetSourcef + * Signature: (II)F + */ +JNIEXPORT jfloat JNICALL Java_net_java_games_joal_ALImpl_alGetSourcef + (JNIEnv *, jobject, jint, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetSourcefvNative + * Signature: (IILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourcefvNative__IILjava_nio_FloatBuffer_2 + (JNIEnv *, jobject, jint, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetSourcefvNative + * Signature: (II[F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourcefvNative__II_3F + (JNIEnv *, jobject, jint, jint, jfloatArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetSourceiNative + * Signature: (II[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourceiNative__II_3I + (JNIEnv *, jobject, jint, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetSourceiNative + * Signature: (IILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetSourceiNative__IILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetSourcei + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetSourcei + (JNIEnv *, jobject, jint, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcePlay + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePlay + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcePlayvNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePlayvNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcePlayvNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePlayvNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcePause + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePause + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcePausevNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePausevNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourcePausevNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourcePausevNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceStop + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceStop + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceStopvNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceStopvNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceStopvNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceStopvNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceRewind + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceRewind + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceRewindvNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceRewindvNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceRewindvNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceRewindvNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceQueueBuffersNative + * Signature: (II[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceQueueBuffersNative__II_3I + (JNIEnv *, jobject, jint, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceQueueBuffersNative + * Signature: (IILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceQueueBuffersNative__IILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceUnqueueBuffersNative + * Signature: (II[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceUnqueueBuffersNative__II_3I + (JNIEnv *, jobject, jint, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alSourceUnqueueBuffersNative + * Signature: (IILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alSourceUnqueueBuffersNative__IILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alListenerf + * Signature: (IF)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alListenerf + (JNIEnv *, jobject, jint, jfloat); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alListener3f + * Signature: (IFFF)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alListener3f + (JNIEnv *, jobject, jint, jfloat, jfloat, jfloat); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alListenerfv + * Signature: (I[F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alListenerfv__I_3F + (JNIEnv *, jobject, jint, jfloatArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alListenerfv + * Signature: (ILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alListenerfv__ILjava_nio_FloatBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alListeneri + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alListeneri + (JNIEnv *, jobject, jint, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListenerfNative + * Signature: (I[F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListenerfNative__I_3F + (JNIEnv *, jobject, jint, jfloatArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListenerfNative + * Signature: (ILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListenerfNative__ILjava_nio_FloatBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListenerf + * Signature: (I)F + */ +JNIEXPORT jfloat JNICALL Java_net_java_games_joal_ALImpl_alGetListenerf + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListener3fNative + * Signature: (ILjava/nio/FloatBuffer;Ljava/nio/FloatBuffer;Ljava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListener3fNative__ILjava_nio_FloatBuffer_2Ljava_nio_FloatBuffer_2Ljava_nio_FloatBuffer_2 + (JNIEnv *, jobject, jint, jobject, jobject, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListener3fNative + * Signature: (I[F[F[F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListener3fNative__I_3F_3F_3F + (JNIEnv *, jobject, jint, jfloatArray, jfloatArray, jfloatArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListenerfvNative + * Signature: (I[F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListenerfvNative__I_3F + (JNIEnv *, jobject, jint, jfloatArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListenerfvNative + * Signature: (ILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListenerfvNative__ILjava_nio_FloatBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListeneriNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListeneriNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListeneriNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetListeneriNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetListeneri + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetListeneri + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alEnable + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alEnable + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alDisable + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDisable + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alIsEnabled + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alIsEnabled + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetBoolean + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alGetBoolean + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetDouble + * Signature: (I)D + */ +JNIEXPORT jdouble JNICALL Java_net_java_games_joal_ALImpl_alGetDouble + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetFloat + * Signature: (I)F + */ +JNIEXPORT jfloat JNICALL Java_net_java_games_joal_ALImpl_alGetFloat + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetInteger + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetInteger + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetDoublevNative + * Signature: (I[D)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetDoublevNative__I_3D + (JNIEnv *, jobject, jint, jdoubleArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetDoublevNative + * Signature: (ILjava/nio/DoubleBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetDoublevNative__ILjava_nio_DoubleBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetFloatvNative + * Signature: (I[F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetFloatvNative__I_3F + (JNIEnv *, jobject, jint, jfloatArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetFloatvNative + * Signature: (ILjava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetFloatvNative__ILjava_nio_FloatBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetIntegervNative + * Signature: (I[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetIntegervNative__I_3I + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetIntegervNative + * Signature: (ILjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alGetIntegervNative__ILjava_nio_IntBuffer_2 + (JNIEnv *, jobject, jint, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetString + * Signature: (I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_games_joal_ALImpl_alGetString + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alDistanceModel + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDistanceModel + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alDopplerFactor + * Signature: (F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDopplerFactor + (JNIEnv *, jobject, jfloat); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alDopplerVelocity + * Signature: (F)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALImpl_alDopplerVelocity + (JNIEnv *, jobject, jfloat); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetError + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetError + (JNIEnv *, jobject); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alIsExtensionPresent + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALImpl_alIsExtensionPresent + (JNIEnv *, jobject, jstring); + +/* + * Class: net_java_games_joal_ALImpl + * Method: alGetEnumValue + * Signature: (Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALImpl_alGetEnumValue + (JNIEnv *, jobject, jstring); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/native/alcbind.c b/src/native/alcbind.c new file mode 100644 index 0000000..e9a64a8 --- /dev/null +++ b/src/native/alcbind.c @@ -0,0 +1,140 @@ +/** +* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + + +#include "alcbind.h" +#include "extal.h" + + +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_openDeviceNative + (JNIEnv *env, jobject obj, jstring deviceName) { + jint result; + ALubyte *str; + str = (ALubyte*)(*env)->GetStringUTFChars(env,deviceName,NULL); + ALCdevice *device; + device = alcOpenDevice(str); + (*env)->ReleaseStringUTFChars(env,deviceName,str); + result = (jint)device; + return result; +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_closeDeviceNative + (JNIEnv *env, jobject obj, jint pointer) { + ALCdevice* device = (ALCdevice*)pointer; + alcCloseDevice(device); +} + +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_createContextNative + (JNIEnv *env, jobject obj, jint pointer, jintArray attrs) { + ALCdevice* device = (ALCdevice*)pointer; + ALint* attrList = NULL; + if(attrs != NULL) { + attrList = (ALint*)(*env)->GetPrimitiveArrayCritical(env,attrs,0); + } + jint ctxPtr = (jint)alcCreateContext(device,attrList); + (*env)->ReleasePrimitiveArrayCritical(env,attrs,attrList,0); + return ctxPtr; +} + +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_makeContextCurrentNative + (JNIEnv *env, jobject obj, jint pointer) { + ALvoid* alcHandle = (ALvoid*)pointer; + alcMakeContextCurrent(alcHandle); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_processContextNative + (JNIEnv *env, jobject obj, jint pointer) { + ALvoid* alcHandle = (ALvoid*)pointer; + alcProcessContext(alcHandle); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_suspendContextNative + (JNIEnv *env, jobject obj, jint pointer) { + ALvoid* alcHandle = (ALvoid*)pointer; + alcSuspendContext(alcHandle); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_destroyContextNative + (JNIEnv *env, jobject obj, jint pointer) { + ALvoid* alcHandle = (ALvoid*)pointer; + alcDestroyContext(alcHandle); +} +/* +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_getError + (JNIEnv *env, jobject obj) { + jint result = 0; +// result = alcGetError(); + return result; +} +*/ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_getCurrentContextNative + (JNIEnv *env, jobject obj) { + jint result; + result = (jint)alcGetCurrentContext(); + return result; +} + +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_getEnumValueNative + (JNIEnv *env, jobject obj, jint pointer, jstring enumName) { + jint result; + ALCdevice* device = (ALCdevice*)pointer; + ALubyte* str; + str = (ALubyte*)(*env)->GetStringUTFChars(env,enumName,NULL); + result = alcGetEnumValue(device, str); + (*env)->ReleaseStringUTFChars(env,enumName,str); + return result; +} + +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_getContextsDeviceNative + (JNIEnv *env, jobject obj, jint ptr) { + jint result; + ALvoid* alcHandle = (ALvoid*)ptr; + result = (jint)alcGetContextsDevice(alcHandle); + return result; +} +JNIEXPORT jstring JNICALL Java_net_java_games_joal_ALCImpl_alcGetStringNative + (JNIEnv *env, jobject obj, jint ptr, jint pname) { + ALCdevice *device = (ALCdevice*)ptr; + ALubyte* p = alcGetString(device,(ALenum)pname); + return (*env)->NewStringUTF(env, p); +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_alcGetIntegervNative + (JNIEnv *env, jobject obj, jint ptr, jint pname, jint size, jintArray data) { + ALint *p = (ALint*)(*env)->GetPrimitiveArrayCritical(env,data,0); + ALCdevice *device = (ALCdevice*)ptr; + if(p) { + alcGetIntegerv(device,(ALenum)pname,(ALsizei)size,p); + } + (*env)->ReleasePrimitiveArrayCritical(env,data,p,0); +} diff --git a/src/native/alcbind.h b/src/native/alcbind.h new file mode 100644 index 0000000..27ceffe --- /dev/null +++ b/src/native/alcbind.h @@ -0,0 +1,148 @@ +/** +* 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. +*/ +#include +/* Header for class net_java_games_joal_ALCImpl */ + +#ifndef _Included_net_java_games_joal_ALCImpl +#define _Included_net_java_games_joal_ALCImpl +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: net_java_games_joal_ALCImpl + * Method: openDeviceNative + * Signature: (Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_openDeviceNative + (JNIEnv *, jobject, jstring); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: closeDeviceNative + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_closeDeviceNative + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: createContextNative + * Signature: (I[I)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_createContextNative + (JNIEnv *, jobject, jint, jintArray); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: makeContextCurrentNative + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_makeContextCurrentNative + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: processContextNative + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_processContextNative + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: suspendContextNative + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_suspendContextNative + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: destroyContextNative + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_destroyContextNative + (JNIEnv *, jobject, jint); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: alcGetError + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_alcGetError + (JNIEnv *, jobject); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: getCurrentContextNative + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_getCurrentContextNative + (JNIEnv *, jobject); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: getEnumValueNative + * Signature: (ILjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_getEnumValueNative + (JNIEnv *, jobject, jint, jstring); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: alcGetStringNative + * Signature: (II)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_games_joal_ALCImpl_alcGetStringNative + (JNIEnv *, jobject, jint, jint); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: alcGetIntegervNative + * Signature: (III[I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_ALCImpl_alcGetIntegervNative + (JNIEnv *, jobject, jint, jint, jint, jintArray); + +/* + * Class: net_java_games_joal_ALCImpl + * Method: getContextDeviceNative + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_getContextDeviceNative + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/native/alfactory.c b/src/native/alfactory.c new file mode 100644 index 0000000..f38f358 --- /dev/null +++ b/src/native/alfactory.c @@ -0,0 +1,47 @@ +/** +* 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. +*/ + +#include "alfactory.h" +#include "extal.h" +#include + +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALFactory_init + (JNIEnv *env , jclass clazz, jobjectArray oalPaths) { + return InitializeOpenAL(env,oalPaths); +} + +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALFactory_deinitialize + (JNIEnv *env, jclass clazz) { + DeInitializeOpenAL(); + return 1; +} diff --git a/src/native/alfactory.h b/src/native/alfactory.h new file mode 100644 index 0000000..48c301c --- /dev/null +++ b/src/native/alfactory.h @@ -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 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. +*/ + + +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class net_java_games_joal_ALFactory */ + +#ifndef _Included_net_java_games_joal_ALFactory +#define _Included_net_java_games_joal_ALFactory +#ifdef __cplusplus +extern "C" { +#endif +/* Inaccessible static: isInitialized */ +/* Inaccessible static: al */ +/* Inaccessible static: alc */ +/* + * Class: net_java_games_joal_ALFactory + * Method: initialize + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALFactory_init + (JNIEnv *, jclass, jobjectArray); + +/* + * Class: net_java_games_joal_ALFactory + * Method: deinitialize + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALFactory_deinitialize + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/native/build.xml b/src/native/build.xml new file mode 100644 index 0000000..531da19 --- /dev/null +++ b/src/native/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/native/eaxbind.c b/src/native/eaxbind.c new file mode 100644 index 0000000..da1b285 --- /dev/null +++ b/src/native/eaxbind.c @@ -0,0 +1,85 @@ +/** +* 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. +*/ + + +#include "eaxbind.h" +#include "extal.h" +#ifdef _WIN32 +const GUID DSPROPSETID_EAX20_ListenerProperties + = { 0x306a6a8, 0xb224, 0x11d2, { 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22 } }; + +const GUID DSPROPSETID_EAX20_BufferProperties + = { 0x306a6a7, 0xb224, 0x11d2, {0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22 } }; +#endif + +JNIEXPORT void JNICALL Java_net_java_games_joal_eax_EAX_EAXSet + (JNIEnv *env, + jobject obj, + jint gflag, + jint pname, + jint source, + jobject buff, + jint size) { +#ifdef _WIN32 + ALvoid* p = (ALvoid*)(*env)->GetDirectBufferAddress(env,buff); + + const GUID* guid = (gflag == 0 ? &DSPROPSETID_EAX20_ListenerProperties : + &DSPROPSETID_EAX20_BufferProperties); + eaxSet(guid, + (ALuint) pname, + (ALuint)source, + p, + (ALuint)size); +#endif +} + +JNIEXPORT void JNICALL Java_net_java_games_joal_eax_EAX_EAXGet + (JNIEnv *env, + jobject obj, + jint gflag, + jint pname, + jint source, + jobject buff, + jint size) { +#ifdef _WIN32 + ALvoid* p = (ALvoid*)(*env)->GetDirectBufferAddress(env,buff); + const GUID* guid = (gflag == 0 ? &DSPROPSETID_EAX20_ListenerProperties : + &DSPROPSETID_EAX20_BufferProperties); + eaxGet(guid, + (ALuint) pname, + (ALuint) source, + p, + (ALuint) size); +#endif +} + diff --git a/src/native/eaxbind.h b/src/native/eaxbind.h new file mode 100644 index 0000000..9450313 --- /dev/null +++ b/src/native/eaxbind.h @@ -0,0 +1,63 @@ +/** +* 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. +*/ + + +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class net_java_games_joal_eax_EAX */ + +#ifndef _Included_net_java_games_joal_eax_EAX +#define _Included_net_java_games_joal_eax_EAX +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: net_java_games_joal_eax_EAX + * Method: _eaxSet + * Signature: (IIILjava/nio/ByteBuffer;I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_eax_EAX_EAXSet + (JNIEnv *, jobject, jint, jint, jint, jobject, jint); + +/* + * Class: net_java_games_joal_eax_EAX + * Method: _eaxGet + * Signature: (IIILjava/nio/ByteBuffer;I)V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_eax_EAX_EAXGet + (JNIEnv *, jobject, jint, jint, jint, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/native/eaxfactory.c b/src/native/eaxfactory.c new file mode 100644 index 0000000..708ddda --- /dev/null +++ b/src/native/eaxfactory.c @@ -0,0 +1,50 @@ +/** +* 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. +*/ + + +#include "eaxfactory.h" +#include "extal.h" + +/* + * had some problems getting this from extal.h + */ + +JNIEXPORT void JNICALL Java_net_java_games_joal_eax_EAXFactory_init + (JNIEnv *env, jclass clazz) { +#ifdef _WIN32 + if(alIsExtensionPresent("EAX2.0")) { + eaxSet = alGetProcAddress((ALubyte*)"EAXSet"); + eaxGet = alGetProcAddress((ALubyte*)"EAXGet"); + } +#endif +} diff --git a/src/native/eaxfactory.h b/src/native/eaxfactory.h new file mode 100644 index 0000000..1a58cd8 --- /dev/null +++ b/src/native/eaxfactory.h @@ -0,0 +1,58 @@ +/** +* 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. +*/ + + +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class net_java_games_joal_eax_EAXFactory */ + +#ifndef _Included_net_java_games_joal_eax_EAXFactory +#define _Included_net_java_games_joal_eax_EAXFactory +#ifdef __cplusplus +extern "C" { +#endif +/* Inaccessible static: SOURCE_GUID */ +/* Inaccessible static: LISTENER_GUID */ +/* Inaccessible static: eax */ +/* + * Class: net_java_games_joal_eax_EAXFactory + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_net_java_games_joal_eax_EAXFactory_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/native/extal.c b/src/native/extal.c new file mode 100644 index 0000000..f7998cc --- /dev/null +++ b/src/native/extal.c @@ -0,0 +1,416 @@ +/* + * Copyright (c) 2002 Light Weight Java Game Library Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions 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 'Light Weight Java Game Library' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "extal.h" + +#ifdef _X11 +#include +#endif + +/** + * $Id$ + * + * This file contains the AL extension assigning mechanism + * + * @author Brian Matzon + * @version $Revision$ + */ +alEnablePROC alEnable = NULL; +alDisablePROC alDisable = NULL; +alIsEnabledPROC alIsEnabled = NULL; +alHintPROC alHint = NULL; +alGetBooleanPROC alGetBoolean = NULL; +alGetIntegerPROC alGetInteger = NULL; +alGetFloatPROC alGetFloat = NULL; +alGetDoublePROC alGetDouble = NULL; +alGetBooleanvPROC alGetBooleanv = NULL; +alGetIntegervPROC alGetIntegerv = NULL; +alGetFloatvPROC alGetFloatv = NULL; +alGetDoublevPROC alGetDoublev = NULL; +alGetStringPROC alGetString = NULL; +alGetErrorPROC alGetError = NULL; +alIsExtensionPresentPROC alIsExtensionPresent = NULL; +alGetProcAddressPROC alGetProcAddress = NULL; +alGetEnumValuePROC alGetEnumValue = NULL; +alListeneriPROC alListeneri = NULL; +alListenerfPROC alListenerf = NULL; +alListener3fPROC alListener3f = NULL; +alListenerfvPROC alListenerfv = NULL; +alGetListeneriPROC alGetListeneri = NULL; +alGetListenerfPROC alGetListenerf = NULL; +alGetListener3fPROC alGetListener3f = NULL; +alGetListenerfvPROC alGetListenerfv = NULL; +alGenSourcesPROC alGenSources = NULL; +alDeleteSourcesPROC alDeleteSources = NULL; +alIsSourcePROC alIsSource = NULL; +alSourceiPROC alSourcei = NULL; +alSourcefPROC alSourcef = NULL; +alSource3fPROC alSource3f = NULL; +alSourcefvPROC alSourcefv = NULL; +alGetSourceiPROC alGetSourcei = NULL; +alGetSourcefPROC alGetSourcef = NULL; +alGetSource3fPROC alGetSource3f = NULL; +alGetSourcefvPROC alGetSourcefv = NULL; +alSourcePlayvPROC alSourcePlayv = NULL; +alSourcePausevPROC alSourcePausev = NULL; +alSourceStopvPROC alSourceStopv = NULL; +alSourceRewindvPROC alSourceRewindv = NULL; +alSourcePlayPROC alSourcePlay = NULL; +alSourcePausePROC alSourcePause = NULL; +alSourceStopPROC alSourceStop = NULL; +alSourceRewindPROC alSourceRewind = NULL; +alGenBuffersPROC alGenBuffers = NULL; +alDeleteBuffersPROC alDeleteBuffers = NULL; +alIsBufferPROC alIsBuffer = NULL; +alBufferDataPROC alBufferData = NULL; +alGetBufferiPROC alGetBufferi = NULL; +alGetBufferfPROC alGetBufferf = NULL; +alSourceQueueBuffersPROC alSourceQueueBuffers = NULL; +alSourceUnqueueBuffersPROC alSourceUnqueueBuffers = NULL; +alDistanceModelPROC alDistanceModel = NULL; +alDopplerFactorPROC alDopplerFactor = NULL; +alDopplerVelocityPROC alDopplerVelocity = NULL; +alcGetStringPROC alcGetString = NULL; +alcGetIntegervPROC alcGetIntegerv = NULL; +alcOpenDevicePROC alcOpenDevice = NULL; +alcCloseDevicePROC alcCloseDevice = NULL; +alcCreateContextPROC alcCreateContext = NULL; +alcMakeContextCurrentPROC alcMakeContextCurrent = NULL; +alcProcessContextPROC alcProcessContext = NULL; +alcGetCurrentContextPROC alcGetCurrentContext = NULL; +alcGetContextsDevicePROC alcGetContextsDevice = NULL; +alcSuspendContextPROC alcSuspendContext = NULL; +alcDestroyContextPROC alcDestroyContext = NULL; +alcGetErrorPROC alcGetError = NULL; +alcIsExtensionPresentPROC alcIsExtensionPresent = NULL; +alcGetProcAddressPROC alcGetProcAddress = NULL; +alcGetEnumValuePROC alcGetEnumValue = NULL; + +#ifdef _WIN32 +EAXSet eaxSet; // EAXSet function, ret$ +EAXGet eaxGet; // EAXGet function, ret$ + +/* Handle to OpenAL Library */ +HMODULE handleOAL; +#else +void* handleOAL; +#endif + +/* Loads OpenAL */ +void LoadOpenAL(); + +/* Unloads OpenAL */ +void UnLoadOpenAL(); + +/* Gets a pointer to the named function */ +void* GetFunctionPointer(const char* function); + +/* Loads OpenAL basic functions */ +int LoadAL(); + +/* Loads OpenAL ALC functions */ +int LoadALC(); + +/* Loads any extensions to OpenAL */ +int LoadALExtensions(); + +/** + * Retrieves a pointer to the named function + * + * @param function Name of function + * @return pointer to named function, or NULL if not found + */ +void* GetFunctionPointer(const char* function) { +#ifdef _WIN32 + return GetProcAddress(handleOAL, function); +#endif +#ifdef _X11 + return dlsym(handleOAL, function); +#endif +} + +/** + * Loads the OpenAL Library + */ +void LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { + jsize pathcount = (*env)->GetArrayLength(env,oalPaths); +#ifdef _DEBUG + printf("Found %d OpenAL paths\n", pathcount); +#endif + int i; + for(i=0;iGetObjectArrayElement(env,oalPaths, i); + const char *path_str = (*env)->GetStringUTFChars(env,path, NULL); +#ifdef _DEBUG + printf("Testing '%s'\n", path_str); +#endif +#ifdef _WIN32 + handleOAL = LoadLibrary(path_str); +#endif +#ifdef _X11 + handleOAL = dlopen(path_str, RTLD_LAZY); +#endif + if (handleOAL != NULL) { +#ifdef _DEBUG + printf("Found OpenAL at '%s'\n", path_str); +#endif + break; + } + (*env)->ReleaseStringUTFChars(env, path, path_str); + } +} + +/** + * Unloads the OpenAL Library + */ +void UnLoadOpenAL() { +#ifdef _WIN32 + FreeLibrary(handleOAL); +#endif +#ifdef _X11 + dlclose(handleOAL); +#endif +} + +/** + * Initializes OpenAL by loading the library + */ +int InitializeOpenAL(JNIEnv *env, jobjectArray oalPaths) { + if(handleOAL != 0) { + return JNI_TRUE; + } + + //load our library + LoadOpenAL(env, oalPaths); + + // if we couldn't load the library, get out + if(handleOAL == 0) { + return JNI_FALSE; + } + + //load basic OpenAL functions + if(!LoadAL()) { + return JNI_FALSE; + } + + //load OpenAL context functions + if(!LoadALC()) { + return JNI_FALSE; + } + + //load OpenAL extensions + if(!LoadALExtensions()) { + return JNI_FALSE; + } + + return JNI_TRUE; +} + +/** + * Called to deinitialize OpenAL + */ +void DeInitializeOpenAL() { + UnLoadOpenAL(); + handleOAL = 0; +} + +/** + * Loads the basic OpenAL functions + * + * @return true if all methods were loaded, false if one of the methods could not be loaded + */ +int LoadAL() { + alEnable = (alEnablePROC) GetFunctionPointer("alEnable"); + alDisable = (alDisablePROC) GetFunctionPointer("alDisable"); + alIsEnabled = (alIsEnabledPROC) GetFunctionPointer("alIsEnabled"); + //alHint = (alHintPROC) GetFunctionPointer("alHint"); + alGetBoolean = (alGetBooleanPROC) GetFunctionPointer("alGetBoolean"); + alGetInteger = (alGetIntegerPROC) GetFunctionPointer("alGetInteger"); + alGetFloat = (alGetFloatPROC) GetFunctionPointer("alGetFloat"); + alGetDouble = (alGetDoublePROC) GetFunctionPointer("alGetDouble"); + alGetBooleanv = (alGetBooleanvPROC) GetFunctionPointer("alGetBooleanv"); + alGetIntegerv = (alGetIntegervPROC) GetFunctionPointer("alGetIntegerv"); + alGetFloatv = (alGetFloatvPROC) GetFunctionPointer("alGetFloatv"); + alGetDoublev = (alGetDoublevPROC) GetFunctionPointer("alGetDoublev"); + alGetString = (alGetStringPROC) GetFunctionPointer("alGetString"); + alGetError = (alGetErrorPROC) GetFunctionPointer("alGetError"); + alIsExtensionPresent = (alIsExtensionPresentPROC) GetFunctionPointer("alIsExtensionPresent"); + alGetProcAddress = (alGetProcAddressPROC) GetFunctionPointer("alGetProcAddress"); + alGetEnumValue = (alGetEnumValuePROC) GetFunctionPointer("alGetEnumValue"); + alListeneri = (alListeneriPROC) GetFunctionPointer("alListeneri"); + alListenerf = (alListenerfPROC) GetFunctionPointer("alListenerf"); + alListener3f = (alListener3fPROC) GetFunctionPointer("alListener3f"); + alListenerfv = (alListenerfvPROC) GetFunctionPointer("alListenerfv"); + alGetListeneri = (alGetListeneriPROC) GetFunctionPointer("alGetListeneri"); + alGetListenerf = (alGetListenerfPROC) GetFunctionPointer("alGetListenerf"); + alGetListener3f = (alGetListener3fPROC) GetFunctionPointer("alGetListener3f"); + alGetListenerfv = (alGetListenerfvPROC) GetFunctionPointer("alGetListenerfv"); + alGenSources = (alGenSourcesPROC) GetFunctionPointer("alGenSources"); + alDeleteSources = (alDeleteSourcesPROC) GetFunctionPointer("alDeleteSources"); + alIsSource = (alIsSourcePROC) GetFunctionPointer("alIsSource"); + alSourcei = (alSourceiPROC) GetFunctionPointer("alSourcei"); + alSourcef = (alSourcefPROC) GetFunctionPointer("alSourcef"); + alSource3f = (alSource3fPROC) GetFunctionPointer("alSource3f"); + alSourcefv = (alSourcefvPROC) GetFunctionPointer("alSourcefv"); + alGetSourcei = (alGetSourceiPROC) GetFunctionPointer("alGetSourcei"); + alGetSourcef = (alGetSourcefPROC) GetFunctionPointer("alGetSourcef"); + alGetSource3f = (alGetSource3fPROC) GetFunctionPointer("alGetSource3f"); + alGetSourcefv = (alGetSourcefvPROC) GetFunctionPointer("alGetSourcefv"); + alSourcePlayv = (alSourcePlayvPROC) GetFunctionPointer("alSourcePlayv"); + alSourcePausev = (alSourcePausevPROC) GetFunctionPointer("alSourcePausev"); + alSourceStopv = (alSourceStopvPROC) GetFunctionPointer("alSourceStopv"); + alSourceRewindv = (alSourceRewindvPROC) GetFunctionPointer("alSourceRewindv"); + alSourcePlay = (alSourcePlayPROC) GetFunctionPointer("alSourcePlay"); + alSourcePause = (alSourcePausePROC) GetFunctionPointer("alSourcePause"); + alSourceStop = (alSourceStopPROC) GetFunctionPointer("alSourceStop"); + alSourceRewind = (alSourceRewindPROC) GetFunctionPointer("alSourceRewind"); + alGenBuffers = (alGenBuffersPROC) GetFunctionPointer("alGenBuffers"); + alDeleteBuffers = (alDeleteBuffersPROC) GetFunctionPointer("alDeleteBuffers"); + alIsBuffer = (alIsBufferPROC) GetFunctionPointer("alIsBuffer"); + alBufferData = (alBufferDataPROC) GetFunctionPointer("alBufferData"); + alGetBufferi = (alGetBufferiPROC) GetFunctionPointer("alGetBufferi"); + alGetBufferf = (alGetBufferfPROC) GetFunctionPointer("alGetBufferf"); + alSourceQueueBuffers = (alSourceQueueBuffersPROC) GetFunctionPointer("alSourceQueueBuffers"); + alSourceUnqueueBuffers = (alSourceUnqueueBuffersPROC) GetFunctionPointer("alSourceUnqueueBuffers"); + alDistanceModel = (alDistanceModelPROC) GetFunctionPointer("alDistanceModel"); + alDopplerFactor = (alDopplerFactorPROC) GetFunctionPointer("alDopplerFactor"); + alDopplerVelocity = (alDopplerVelocityPROC) GetFunctionPointer("alDopplerVelocity"); + + return + alEnable != NULL && + alDisable != NULL && + alIsEnabled != NULL && + //alHint != NULL && + alGetBoolean != NULL && + alGetInteger != NULL && + alGetFloat != NULL && + alGetDouble != NULL && + alGetBooleanv != NULL && + alGetIntegerv != NULL && + alGetFloatv != NULL && + alGetDoublev != NULL && + alGetString != NULL && + alGetError != NULL && + alIsExtensionPresent != NULL && + alGetProcAddress != NULL && + alGetEnumValue != NULL && + alListeneri != NULL && + alListenerf != NULL && + alListener3f != NULL && + alListenerfv != NULL && + alGetListeneri != NULL && + alGetListenerf != NULL && + alGetListener3f != NULL && + alGetListenerfv != NULL && + alGenSources != NULL && + alDeleteSources != NULL && + alIsSource != NULL && + alSourcei != NULL && + alSourcef != NULL && + alSource3f != NULL && + alSourcefv != NULL && + alGetSourcei != NULL && + alGetSourcef != NULL && + alGetSource3f != NULL && + alGetSourcefv != NULL && + alSourcePlayv != NULL && + alSourcePausev != NULL && + alSourceStopv != NULL && + alSourceRewindv != NULL && + alSourcePlay != NULL && + alSourcePause != NULL && + alSourceStop != NULL && + alSourceRewind != NULL && + alGenBuffers != NULL && + alDeleteBuffers != NULL && + alIsBuffer != NULL && + alBufferData != NULL && + alGetBufferi != NULL && + alGetBufferf != NULL && + alSourceQueueBuffers != NULL && + alSourceUnqueueBuffers != NULL && + alDistanceModel != NULL && + alDopplerFactor != NULL && + alDopplerVelocity != NULL; +} + +/** + * Loads the context OpenAL functions + * + * @return true if all methods were loaded, false if one of the methods could not be loaded + */ +int LoadALC() { + alcGetString = (alcGetStringPROC) GetFunctionPointer("alcGetString"); + alcGetIntegerv = (alcGetIntegervPROC) GetFunctionPointer("alcGetIntegerv"); + alcOpenDevice = (alcOpenDevicePROC) GetFunctionPointer("alcOpenDevice"); + alcCloseDevice = (alcCloseDevicePROC) GetFunctionPointer("alcCloseDevice"); + alcCreateContext = (alcCreateContextPROC) GetFunctionPointer("alcCreateContext"); + alcMakeContextCurrent = (alcMakeContextCurrentPROC) GetFunctionPointer("alcMakeContextCurrent"); + alcProcessContext = (alcProcessContextPROC) GetFunctionPointer("alcProcessContext"); + alcGetCurrentContext = (alcGetCurrentContextPROC) GetFunctionPointer("alcGetCurrentContext"); + alcGetContextsDevice = (alcGetContextsDevicePROC) GetFunctionPointer("alcGetContextsDevice"); + alcSuspendContext = (alcSuspendContextPROC) GetFunctionPointer("alcSuspendContext"); + alcDestroyContext = (alcDestroyContextPROC) GetFunctionPointer("alcDestroyContext"); + alcGetError = (alcGetErrorPROC) GetFunctionPointer("alcGetError"); + alcIsExtensionPresent = (alcIsExtensionPresentPROC) GetFunctionPointer("alcIsExtensionPresent"); + alcGetProcAddress = (alcGetProcAddressPROC) GetFunctionPointer("alcGetProcAddress"); + alcGetEnumValue = (alcGetEnumValuePROC) GetFunctionPointer("alcGetEnumValue"); + + return + alcGetString != NULL && + alcGetIntegerv != NULL && + alcOpenDevice != NULL && + alcCloseDevice != NULL && + alcCreateContext != NULL && + alcMakeContextCurrent != NULL && + alcProcessContext != NULL && + alcGetCurrentContext != NULL && + alcGetContextsDevice != NULL && + alcSuspendContext != NULL && + alcDestroyContext != NULL && + alcGetError != NULL && + alcIsExtensionPresent != NULL && + alcGetProcAddress != NULL && + alcGetEnumValue != NULL; +} + +/** + * Loads the OpenAL extensions functions + * + * @return true if all methods were loaded, false if one of the methods could not be loaded + */ +int LoadALExtensions() { + return JNI_TRUE; +} + diff --git a/src/native/extal.h b/src/native/extal.h new file mode 100644 index 0000000..ae84ac8 --- /dev/null +++ b/src/native/extal.h @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2002 Light Weight Java Game Library Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions 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 'Light Weight Java Game Library' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _EXTAL_H +#define _EXTAL_H + +#ifdef _WIN32 +#include +#endif +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN32 + #ifdef _OPENAL32LIB + #define ALCAPI __declspec(dllexport) + #else + #define ALCAPI __declspec(dllimport) + #endif + + typedef struct ALCdevice_struct ALCdevice; + typedef struct ALCcontext_struct ALCcontext; + + #define ALCAPIENTRY __cdecl +#else + #ifdef TARGET_OS_MAC + #if TARGET_OS_MAC + + #pragma export on + #endif + #endif + #define ALCAPI + #define ALCAPIENTRY + +/** ALC boolean type. */ +typedef char ALCboolean; + +/** ALC 8bit signed byte. */ +typedef char ALCbyte; + +/** ALC 8bit unsigned byte. */ +typedef unsigned char ALCubyte; + +/** ALC 16bit signed short integer type. */ +typedef short ALCshort; + +/** ALC 16bit unsigned short integer type. */ +typedef unsigned short ALCushort; + +/** ALC 32bit unsigned integer type. */ +typedef unsigned ALCuint; + +/** ALC 32bit signed integer type. */ +typedef int ALCint; + +/** ALC 32bit floating point type. */ +typedef float ALCfloat; + +/** ALC 64bit double point type. */ +typedef double ALCdouble; + +/** ALC 32bit type. */ +typedef unsigned int ALCsizei; + +/** ALC void type */ +typedef void ALCvoid; + +#endif + +#ifdef _WIN32 + #ifdef _OPENAL32LIB + #define ALAPI __declspec(dllexport) + #else + #define ALAPI __declspec(dllimport) + #endif + #define ALAPIENTRY __cdecl + #define AL_CALLBACK +#else + #ifdef TARGET_OS_MAC + #if TARGET_OS_MAC + #pragma export on + #endif + #endif + #define ALAPI + #define ALAPIENTRY + #define AL_CALLBACK +#endif +#define INITGUID +#define OPENAL + +#ifdef _WIN32 +/* +* EAX 2.0 listener property set {0306A6A8-B224-11d2-99E5-0000E8D8C722} +*/ +/* +const GUID DSPROPSETID_EAX20_ListenerProperties + = { 0x306a6a8, 0xb224, 0x11d2, { 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22 } }; + +const GUID DSPROPSETID_EAX20_BufferProperties + = { 0x306a6a7, 0xb224, 0x11d2, {0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22 } }; +*/ +#endif +/* +DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties, + 0x306a6a8, + 0xb224, + 0x11d2, + 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22); + +DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties, + 0x306a6a7, + 0xb224, + 0x11d2, + 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22); +*/ +void DeInitializeOpenAL(); + +int InitializeOpenAL(JNIEnv *env, jobjectArray oalPaths); + +//alc +typedef ALCubyte* (ALCAPIENTRY *alcGetStringPROC)(ALCdevice *device,ALCenum param); +typedef ALCvoid (ALCAPIENTRY *alcGetIntegervPROC)(ALCdevice *device,ALCenum param,ALCsizei size,ALCint *data); +typedef ALCdevice* (ALCAPIENTRY *alcOpenDevicePROC)(ALCubyte *deviceName); +typedef ALCvoid (ALCAPIENTRY *alcCloseDevicePROC)(ALCdevice *device); +typedef ALCcontext* (ALCAPIENTRY *alcCreateContextPROC)(ALCdevice *device,ALCint *attrList); +typedef ALCboolean (ALCAPIENTRY *alcMakeContextCurrentPROC)(ALCcontext *context); +typedef ALCvoid (ALCAPIENTRY *alcProcessContextPROC)(ALCcontext *context); +typedef ALCcontext* (ALCAPIENTRY *alcGetCurrentContextPROC)(ALCvoid); +typedef ALCdevice* (ALCAPIENTRY *alcGetContextsDevicePROC)(ALCcontext *context); +typedef ALCvoid (ALCAPIENTRY *alcSuspendContextPROC)(ALCcontext *context); +typedef ALCvoid (ALCAPIENTRY *alcDestroyContextPROC)(ALCcontext *context); +typedef ALCenum (ALCAPIENTRY *alcGetErrorPROC)(ALCdevice *device); +typedef ALCboolean (ALCAPIENTRY *alcIsExtensionPresentPROC)(ALCdevice *device,ALCubyte *extName); +typedef ALCvoid* (ALCAPIENTRY *alcGetProcAddressPROC)(ALCdevice *device,ALCubyte *funcName); +typedef ALCenum (ALCAPIENTRY *alcGetEnumValuePROC)(ALCdevice *device,ALCubyte *enumName); + +//al +typedef ALvoid (ALAPIENTRY *alEnablePROC)( ALenum capability ); +typedef ALvoid (ALAPIENTRY *alDisablePROC)( ALenum capability ); +typedef ALboolean (ALAPIENTRY *alIsEnabledPROC)( ALenum capability ); +typedef ALvoid (ALAPIENTRY *alHintPROC)( ALenum target, ALenum mode ); +typedef ALboolean (ALAPIENTRY *alGetBooleanPROC)( ALenum param ); +typedef ALint (ALAPIENTRY *alGetIntegerPROC)( ALenum param ); +typedef ALfloat (ALAPIENTRY *alGetFloatPROC)( ALenum param ); +typedef ALdouble (ALAPIENTRY *alGetDoublePROC)( ALenum param ); +typedef ALvoid (ALAPIENTRY *alGetBooleanvPROC)( ALenum param, ALboolean* data ); +typedef ALvoid (ALAPIENTRY *alGetIntegervPROC)( ALenum param, ALint* data ); +typedef ALvoid (ALAPIENTRY *alGetFloatvPROC)( ALenum param, ALfloat* data ); +typedef ALvoid (ALAPIENTRY *alGetDoublevPROC)( ALenum param, ALdouble* data ); +typedef ALubyte* (ALAPIENTRY *alGetStringPROC)( ALenum param ); +typedef ALenum (ALAPIENTRY *alGetErrorPROC)( ALvoid ); +typedef ALboolean (ALAPIENTRY *alIsExtensionPresentPROC)( ALubyte* fname ); +typedef ALvoid* (ALAPIENTRY *alGetProcAddressPROC)( ALubyte* fname ); +typedef ALenum (ALAPIENTRY *alGetEnumValuePROC)( ALubyte* ename ); +typedef ALvoid (ALAPIENTRY *alListeneriPROC)( ALenum param, ALint value ); +typedef ALvoid (ALAPIENTRY *alListenerfPROC)( ALenum param, ALfloat value ); +typedef ALvoid (ALAPIENTRY *alListener3fPROC)( ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 ); +typedef ALvoid (ALAPIENTRY *alListenerfvPROC)( ALenum param, ALfloat* values ); +typedef ALvoid (ALAPIENTRY *alGetListeneriPROC)( ALenum param, ALint* value ); +typedef ALvoid (ALAPIENTRY *alGetListenerfPROC)( ALenum param, ALfloat* value ); +typedef ALvoid (ALAPIENTRY *alGetListener3fPROC)( ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 ); +typedef ALvoid (ALAPIENTRY *alGetListenerfvPROC)( ALenum param, ALfloat* values ); +typedef ALvoid (ALAPIENTRY *alGenSourcesPROC)( ALsizei n, ALuint* sources ); +typedef ALvoid (ALAPIENTRY *alDeleteSourcesPROC)( ALsizei n, ALuint* sources ); +typedef ALboolean (ALAPIENTRY *alIsSourcePROC)( ALuint id ); +typedef ALvoid (ALAPIENTRY *alSourceiPROC)( ALuint source, ALenum param, ALint value ); +typedef ALvoid (ALAPIENTRY *alSourcefPROC)( ALuint source, ALenum param, ALfloat value ); +typedef ALvoid (ALAPIENTRY *alSource3fPROC)( ALuint source, ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 ); +typedef ALvoid (ALAPIENTRY *alSourcefvPROC)( ALuint source, ALenum param, ALfloat* values ); +typedef ALvoid (ALAPIENTRY *alGetSourceiPROC)( ALuint source, ALenum param, ALint* value ); +typedef ALvoid (ALAPIENTRY *alGetSourcefPROC)( ALuint source, ALenum param, ALfloat* value ); +typedef ALvoid (ALAPIENTRY *alGetSource3fPROC)( ALuint source, ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 ); +typedef ALvoid (ALAPIENTRY *alGetSourcefvPROC)( ALuint source, ALenum param, ALfloat* values ); +typedef ALvoid (ALAPIENTRY *alSourcePlayvPROC)( ALsizei n, ALuint *sources ); +typedef ALvoid (ALAPIENTRY *alSourcePausevPROC)( ALsizei n, ALuint *sources ); +typedef ALvoid (ALAPIENTRY *alSourceStopvPROC)( ALsizei n, ALuint *sources ); +typedef ALvoid (ALAPIENTRY *alSourceRewindvPROC)(ALsizei n,ALuint *sources); +typedef ALvoid (ALAPIENTRY *alSourcePlayPROC)( ALuint source ); +typedef ALvoid (ALAPIENTRY *alSourcePausePROC)( ALuint source ); +typedef ALvoid (ALAPIENTRY *alSourceStopPROC)( ALuint source ); +typedef ALvoid (ALAPIENTRY *alSourceRewindPROC)( ALuint source ); +typedef ALvoid (ALAPIENTRY *alGenBuffersPROC)( ALsizei n, ALuint* buffers ); +typedef ALvoid (ALAPIENTRY *alDeleteBuffersPROC)( ALsizei n, ALuint* buffers ); +typedef ALboolean (ALAPIENTRY *alIsBufferPROC)( ALuint buffer ); +typedef ALvoid (ALAPIENTRY *alBufferDataPROC)( ALuint buffer, + ALenum format, + ALvoid* data, + ALsizei size, + ALsizei freq ); +typedef ALvoid (ALAPIENTRY *alGetBufferiPROC)( ALuint buffer, ALenum param, ALint* value ); +typedef ALvoid (ALAPIENTRY *alGetBufferfPROC)( ALuint buffer, ALenum param, ALfloat* value ); +typedef ALvoid (ALAPIENTRY *alSourceQueueBuffersPROC)( ALuint source, ALsizei n, ALuint* buffers ); +typedef ALvoid (ALAPIENTRY *alSourceUnqueueBuffersPROC)( ALuint source, ALsizei n, ALuint* buffers ); +typedef ALvoid (ALAPIENTRY *alDistanceModelPROC)( ALenum value ); +typedef ALvoid (ALAPIENTRY *alDopplerFactorPROC)( ALfloat value ); +typedef ALvoid (ALAPIENTRY *alDopplerVelocityPROC)( ALfloat value ); + +extern alcGetStringPROC alcGetString; +extern alcGetIntegervPROC alcGetIntegerv; +extern alcOpenDevicePROC alcOpenDevice; +extern alcCloseDevicePROC alcCloseDevice; +extern alcCreateContextPROC alcCreateContext; +extern alcMakeContextCurrentPROC alcMakeContextCurrent; +extern alcProcessContextPROC alcProcessContext; +extern alcGetCurrentContextPROC alcGetCurrentContext; +extern alcGetContextsDevicePROC alcGetContextsDevice; +extern alcSuspendContextPROC alcSuspendContext; +extern alcDestroyContextPROC alcDestroyContext; +extern alcGetErrorPROC alcGetError; +extern alcIsExtensionPresentPROC alcIsExtensionPresent; +extern alcGetProcAddressPROC alcGetProcAddress; +extern alcGetEnumValuePROC alcGetEnumValue; + +extern alEnablePROC alEnable; +extern alDisablePROC alDisable; +extern alIsEnabledPROC alIsEnabled; +extern alHintPROC alHint; +extern alGetBooleanPROC alGetBoolean; +extern alGetIntegerPROC alGetInteger; +extern alGetFloatPROC alGetFloat; +extern alGetDoublePROC alGetDouble; +extern alGetBooleanvPROC alGetBooleanv; +extern alGetIntegervPROC alGetIntegerv; +extern alGetFloatvPROC alGetFloatv; +extern alGetDoublevPROC alGetDoublev; +extern alGetStringPROC alGetString; +extern alGetErrorPROC alGetError; +extern alIsExtensionPresentPROC alIsExtensionPresent; +extern alGetProcAddressPROC alGetProcAddress; +extern alGetEnumValuePROC alGetEnumValue; +extern alListeneriPROC alListeneri; +extern alListenerfPROC alListenerf; +extern alListener3fPROC alListener3f; +extern alListenerfvPROC alListenerfv; +extern alGetListeneriPROC alGetListeneri; +extern alGetListenerfPROC alGetListenerf; +extern alGetListener3fPROC alGetListener3f; +extern alGetListenerfvPROC alGetListenerfv; +extern alGenSourcesPROC alGenSources; +extern alDeleteSourcesPROC alDeleteSources; +extern alIsSourcePROC alIsSource; +extern alSourceiPROC alSourcei; +extern alSourcefPROC alSourcef; +extern alSource3fPROC alSource3f; +extern alSourcefvPROC alSourcefv; +extern alGetSourceiPROC alGetSourcei; +extern alGetSourcefPROC alGetSourcef; +extern alGetSource3fPROC alGetSource3f; +extern alGetSourcefvPROC alGetSourcefv; +extern alSourcePlayvPROC alSourcePlayv; +extern alSourcePausevPROC alSourcePausev; +extern alSourceStopvPROC alSourceStopv; +extern alSourceRewindvPROC alSourceRewindv; +extern alSourcePlayPROC alSourcePlay; +extern alSourcePausePROC alSourcePause; +extern alSourceStopPROC alSourceStop; +extern alSourceRewindPROC alSourceRewind; +extern alGenBuffersPROC alGenBuffers; +extern alDeleteBuffersPROC alDeleteBuffers; +extern alIsBufferPROC alIsBuffer; +extern alBufferDataPROC alBufferData; +extern alGetBufferiPROC alGetBufferi; +extern alGetBufferfPROC alGetBufferf; +extern alSourceQueueBuffersPROC alSourceQueueBuffers; +extern alSourceUnqueueBuffersPROC alSourceUnqueueBuffers; +extern alDistanceModelPROC alDistanceModel; +extern alDopplerFactorPROC alDopplerFactor; +extern alDopplerVelocityPROC alDopplerVelocity; + +#ifdef _WIN32 +typedef ALenum (*EAXSet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint); +typedef ALenum (*EAXGet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint); + +extern EAXSet eaxSet; +extern EAXGet eaxGet; +#endif + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3