From 1a0b7c61155813ac0bf3c6d58b4dac15f0225101 Mon Sep 17 00:00:00 2001 From: kbr Date: Tue, 10 Jan 2006 11:07:30 +0000 Subject: Merged gluegen-branch-1-0 on to the main JOAL trunk. JOAL is now built using GlueGen and currently requires a built JOGL workspace as a sibling workspace of the JOAL workspace. git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@101 03bf7f67-59de-4072-a415-9a990d468a3f --- src/java/net/java/games/joal/AL.java | 1260 -------------------- src/java/net/java/games/joal/ALC.java | 263 ---- src/java/net/java/games/joal/ALCConstants.java | 95 -- src/java/net/java/games/joal/ALCImpl.java | 224 ---- src/java/net/java/games/joal/ALConstants.java | 348 ------ src/java/net/java/games/joal/ALException.java | 62 + src/java/net/java/games/joal/ALFactory.java | 168 ++- src/java/net/java/games/joal/ALImpl.java | 921 -------------- src/java/net/java/games/joal/NativeLibLoader.java | 66 + src/java/net/java/games/joal/OpenALException.java | 50 - src/java/net/java/games/joal/eax/EAX.java | 2 +- src/java/net/java/games/joal/eax/EAXConstants.java | 2 +- src/java/net/java/games/joal/eax/EAXFactory.java | 2 +- src/java/net/java/games/joal/util/ALut.java | 132 +- src/java/net/java/games/joal/util/BufferUtils.java | 421 ++++--- src/java/net/java/games/joal/util/Version.java | 104 ++ src/java/net/java/games/joal/util/WAVData.java | 2 +- src/java/net/java/games/joal/util/WAVLoader.java | 65 +- src/java/net/java/games/sound3d/AudioSystem3D.java | 398 +++---- src/java/net/java/games/sound3d/Buffer.java | 12 +- src/java/net/java/games/sound3d/Context.java | 8 +- src/java/net/java/games/sound3d/Device.java | 8 +- src/java/net/java/games/sound3d/Listener.java | 12 +- .../net/java/games/sound3d/Sound3DException.java | 50 - src/java/net/java/games/sound3d/Source.java | 38 +- src/java/net/java/games/sound3d/Vec3f.java | 2 +- src/native/albind.c | 720 ----------- src/native/albind.h | 703 ----------- src/native/alcbind.c | 235 ---- src/native/alcbind.h | 160 --- src/native/alfactory.c | 50 - src/native/alfactory.h | 66 - src/native/build.xml | 113 -- src/native/common_tools.c | 106 -- src/native/common_tools.h | 64 - src/native/eaxbind.c | 2 +- src/native/eaxfactory.c | 8 +- src/native/extal.c | 451 ------- src/native/extal.h | 313 ----- 39 files changed, 920 insertions(+), 6786 deletions(-) delete mode 100644 src/java/net/java/games/joal/AL.java delete mode 100644 src/java/net/java/games/joal/ALC.java delete mode 100644 src/java/net/java/games/joal/ALCConstants.java delete mode 100644 src/java/net/java/games/joal/ALCImpl.java delete mode 100644 src/java/net/java/games/joal/ALConstants.java create mode 100755 src/java/net/java/games/joal/ALException.java delete mode 100644 src/java/net/java/games/joal/ALImpl.java create mode 100755 src/java/net/java/games/joal/NativeLibLoader.java delete mode 100644 src/java/net/java/games/joal/OpenALException.java create mode 100755 src/java/net/java/games/joal/util/Version.java delete mode 100644 src/java/net/java/games/sound3d/Sound3DException.java delete mode 100644 src/native/albind.c delete mode 100644 src/native/albind.h delete mode 100644 src/native/alcbind.c delete mode 100644 src/native/alcbind.h delete mode 100644 src/native/alfactory.c delete mode 100644 src/native/alfactory.h delete mode 100644 src/native/build.xml delete mode 100644 src/native/common_tools.c delete mode 100644 src/native/common_tools.h delete mode 100644 src/native/extal.c delete mode 100644 src/native/extal.h (limited to 'src') diff --git a/src/java/net/java/games/joal/AL.java b/src/java/net/java/games/joal/AL.java deleted file mode 100644 index ab1c66b..0000000 --- a/src/java/net/java/games/joal/AL.java +++ /dev/null @@ -1,1260 +0,0 @@ -/* -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - -package net.java.games.joal; - -import java.nio.ByteBuffer; - - -/** - * This class contains the core OpenAL functions - * - * @author Athomas Goldberg - */ -public interface AL extends ALConstants { - // AL_BUFFER RELATED METHODS - - /** - * This method generates one or more buffers.
- *
- * 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 deleted file mode 100644 index f8855c6..0000000 --- a/src/java/net/java/games/joal/ALC.java +++ /dev/null @@ -1,263 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - -package net.java.games.joal; - -/** - * This class contains the context-related OpenAL functions. - * - * @author Athomas Goldberg - */ -public interface ALC extends ALCConstants { - /** - * This method opens a device by name.
- *
- * 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); - - public void alcFreeCurrentContext(); - - /** - * 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(Device device); - - /** - * 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) { - System.out.println("Pointer = " + pointer); - System.out.println("ALC = " + impl); - this.pointer = pointer; - this.alcContext = impl; - } - } -} diff --git a/src/java/net/java/games/joal/ALCConstants.java b/src/java/net/java/games/joal/ALCConstants.java deleted file mode 100644 index 47d0754..0000000 --- a/src/java/net/java/games/joal/ALCConstants.java +++ /dev/null @@ -1,95 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -* -* Created on Jun 6, 2003 -*/ - -package net.java.games.joal; - -/** - * @author Athomas Goldberg - * - */ -public interface ALCConstants { - /* Boolean False. */ - public final static int ALC_FALSE = 0; - - /* Boolean True. */ - public final static int ALC_TRUE = 1; - - /** Errors: No Error. */ - public final static int ALC_NO_ERROR = ALC_FALSE; - - public final static int ALC_MAJOR_VERSION = 0x1000; - public final static int ALC_MINOR_VERSION = 0x1001; - public final static int ALC_ATTRIBUTES_SIZE = 0x1002; - public final static int ALC_ALL_ATTRIBUTES = 0x1003; - - public final static int ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004; - public final static int ALC_DEVICE_SPECIFIER = 0x1005; - public final static int ALC_EXTENSIONS = 0x1006; - - public final static int ALC_FREQUENCY = 0x1007; - public final static int ALC_REFRESH = 0x1008; - public final static int ALC_SYNC = 0x1009; - - /** - * The device argument does not name a valid dvice. - */ - public final static int ALC_INVALID_DEVICE = 0xA001; - - /** - * The context argument does not name a valid context. - */ - public final static int ALC_INVALID_CONTEXT = 0xA002; - - /** - * A function was called at inappropriate time, - * or in an inappropriate way, causing an illegal state. - * This can be an incompatible ALenum, object ID, - * and/or function. - */ - public final static int ALC_INVALID_ENUM = 0xA003; - - /** - * Illegal value passed as an argument to an AL call. - * Applies to parameter values, but not to enumerations. - */ - public final static int ALC_INVALID_VALUE = 0xA004; - - /** - * A function could not be completed, - * because there is not enough memory available. - */ - public final static int ALC_OUT_OF_MEMORY = 0xA005; - -} diff --git a/src/java/net/java/games/joal/ALCImpl.java b/src/java/net/java/games/joal/ALCImpl.java deleted file mode 100644 index e6d9d36..0000000 --- a/src/java/net/java/games/joal/ALCImpl.java +++ /dev/null @@ -1,224 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - -package net.java.games.joal; - -import java.util.HashMap; - -final class ALCImpl implements ALC { - private final HashMap contextMap = new HashMap(); - private static Mutex lock = new Mutex(); - - ALCImpl() { - System.loadLibrary("joal"); - // - // Fix to issue 6: Unable to terminate JOAL program with CRTL-C or kill Pid - // Shouldn't attempt to cleanup before exit, we will let the native driver - // do it. - // - } - - public Device alcOpenDevice(String deviceName) { - return openDeviceNative(deviceName); - } - - private native Device openDeviceNative(String deviceName); - - public void alcCloseDevice(Device device) { - if(device != null) { - closeDeviceNative(device.pointer); - } - } - - private native void closeDeviceNative(int pointer); - - public Context alcCreateContext(Device device, int[] attrs) { - Context result = null; - if(device != null) { - result = createContextNative(device.pointer, attrs); - contextMap.put(new Integer(result.pointer), result); - } - return result; - } - private native Context createContextNative(int pointer, int[] attrs); - - public int alcMakeContextCurrent(Context context) { - int result = 0; - int pointer = 0; - if (context != null) { - pointer = context.pointer; - } - lock.acquire(); - result = makeContextCurrentNative(pointer); - return result; - } - - public void alcFreeCurrentContext() { - makeContextCurrentNative(0); - lock.release(); - } - - private native int makeContextCurrentNative(int pointer); - - public void alcProcessContext(Context context) { - if(context != null) { - processContextNative(context.pointer); - } - } - - private native void processContextNative(int pointer); - - public void alcSuspendContext(Context context) { - if(context != null) { - suspendContextNative(context.pointer); - } - } - - private native void suspendContextNative(int pointer); - - public void alcDestroyContext(Context context) { - if(context != null) { - destroyContextNative(context.pointer); - } - } - - private native void destroyContextNative(int pointer); - - public int alcGetError(Device device) { - int result = 0; - int pointer = 0; - if(device != null) { - pointer = device.pointer; - } - result = alcGetErrorNative(pointer); - return result; - } - private native int alcGetErrorNative(int pointer); - - public Context alcGetCurrentContext() { - Context result = null; - int pointer = getCurrentContextNative(); - if(pointer != 0) { - result = (Context) contextMap.get(new Integer(pointer)); - } - return result; - } - - private native int getCurrentContextNative(); - - public boolean alcIsExtensionPresent(Device device, String extName) { - boolean result = false; - - return result; - } - - // public Method getProcAddress(Device device, String funcName); - public int alcGetEnumValue(Device device, String enumName) { - return getEnumValueNative(device.pointer, enumName); - } - - private native int getEnumValueNative(int pointer, String enumValue); - - public String alcGetString(Device device, int attribute) { - String result = null; - result = alcGetStringNative(device.pointer, attribute); - return result; - } - - private native String alcGetStringNative(int pointer, int attribute); - - public void alcGetIntegerv( - Device device, - int attribute, - int size, - int[] array) { - alcGetIntegervNative(device.pointer, attribute, size, array); - } - - private native void alcGetIntegervNative( - int pointer, - int attr, - int size, - int[] arr); - - public Device alcGetContextsDevice(Context context) { - Device result = null; - if(context != null) { - int devicePtr = getContextsDeviceNative(context.pointer); - if(devicePtr != 0) { - result = new ALC.Device(devicePtr); - } - } - return result; - } - - private native int getContextsDeviceNative(int context); - - private void exit() { - - Context alcContext = alcGetCurrentContext(); - - if (alcContext != null) { - Device alcDevice = alcGetContextsDevice(alcContext); - alcMakeContextCurrent(null); - alcDestroyContext(alcContext); - alcCloseDevice(alcDevice); - } - } - - private static class Mutex { - Thread owner = null; - public synchronized void acquire() { - boolean interrupted = false; - while(owner != null && owner != Thread.currentThread()) { - try { - wait(); - } catch (InterruptedException e) { - interrupted = true; - } - } - owner = Thread.currentThread(); - if(interrupted) { - owner.interrupt(); - } - } - - public synchronized void release() { - if(!owner.equals(Thread.currentThread())) { - throw new IllegalMonitorStateException("Not Owner"); - } - owner = null; - notify(); - } - } -} diff --git a/src/java/net/java/games/joal/ALConstants.java b/src/java/net/java/games/joal/ALConstants.java deleted file mode 100644 index 4ee8e3f..0000000 --- a/src/java/net/java/games/joal/ALConstants.java +++ /dev/null @@ -1,348 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - -package net.java.games.joal; - -/** - * This interface contains the standard constants used by OpenAL - * @author Athomas Goldberg - */ -public interface ALConstants { - - /** Bad value */ - public static final int AL_INVALID = -1; - - /** Disable value */ - public static final int AL_NONE = 0; - - /** Boolean False */ - public static final int AL_FALSE = 0; - - /** Boolean True */ - public static final int AL_TRUE = 1; - - /** - * Indicate the type of SOURCE. - * Sources can be spatialized - */ - public static final int AL_SOURCE_TYPE = 0x200; - - /** Indicate source has absolute coordinates */ - public static final int AL_SOURCE_ABSOLUTE = 0x201; - - /** Indicate Source has listener relative coordinates */ - public static final int AL_SOURCE_RELATIVE = 0x202; - - /** - * Directional source, inner cone angle, in degrees - * Range: [0-360] - * Default: 360 - */ - public static final int AL_CONE_INNER_ANGLE = 0x1001; - - /** - * Directional source, outer cone angle, in degrees. - * Range: [0-360] - * Default: 360 - */ - public static final int AL_CONE_OUTER_ANGLE = 0x1002; - - /** - * Specify the pitch to be applied, either at source, - * or on mixer results, at listener. - * Range: [0.5-2.0] - * Default: 1.0 - */ - public static final int AL_PITCH = 0x1003; - - /** - * Specify the current location in three dimensional space. - * OpenAL, like OpenGL, uses a right handed coordinate system, - * where in a frontal default view X (thumb) points right, - * Y points up (index finger), and Z points towards the - * viewer/camera (middle finger). - * To switch from a left handed coordinate system, flip the - * sign on the Z coordinate. - * Listener position is always in the world coordinate system. - */ - public static final int AL_POSITION = 0x1004; - - /** Specify the current direction as forward vector. */ - public static final int AL_DIRECTION = 0x1005; - - /** Specify the current velocity in three dimensional space. */ - public static final int AL_VELOCITY = 0x1006; - - /** - * Indicate whether source has to loop infinite. - * Type: ALboolean - * Range: [AL_TRUE, AL_FALSE] - * Default: AL_FALSE - */ - public static final int AL_LOOPING = 0x1007; - - /** - * Indicate the buffer to provide sound samples. - * Type: ALuint. - * Range: any valid Buffer id. - */ - public static final int AL_BUFFER = 0x1009; - - /** - * Indicate the gain (volume amplification) applied. - * Type: ALfloat. - * Range: ]0.0- ] - * A value of 1.0 means un-attenuated/unchanged. - * Each division by 2 equals an attenuation of -6dB. - * Each multiplicaton with 2 equals an amplification of +6dB. - * A value of 0.0 is meaningless with respect to a logarithmic - * scale; it is interpreted as zero volume - the channel - * is effectively disabled. - */ - public static final int AL_GAIN = 0x100A; - - /** - * Indicate minimum source attenuation. - * Type: ALfloat - * Range: [0.0 - 1.0] - */ - public static final int AL_MIN_GAIN = 0x100D; - - /** - * Indicate maximum source attenuation. - * Type: ALfloat - * Range: [0.0 - 1.0] - */ - public static final int AL_MAX_GAIN = 0x100E; - - /** - * Specify the current orientation. - * Type: ALfv6 (at/up) - * Range: N/A - */ - public static final int AL_ORIENTATION = 0x100F; - - /* byte offset into source (in canon format). -1 if source - * is not playing. Don't set this, get this. - * - * Type: ALfloat - * Range: [0.0 - ] - * Default: 1.0 - */ - public static final int AL_REFERENCE_DISTANCE = 0x1020; - - /** - * Indicate the rolloff factor for the source. - * Type: ALfloat - * Range: [0.0 - ] - * Default: 1.0 - */ - public static final int AL_ROLLOFF_FACTOR = 0x1021; - - /** - * Indicate the gain (volume amplification) applied. - * Type: ALfloat. - * Range: ]0.0- ] - * A value of 1.0 means un-attenuated/unchanged. - * Each division by 2 equals an attenuation of -6dB. - * Each multiplicaton with 2 equals an amplification of +6dB. - * A value of 0.0 is meaningless with respect to a logarithmic - * scale; it is interpreted as zero volume - the channel - * is effectively disabled. - */ - public static final int AL_CONE_OUTER_GAIN = 0x1022; - - /** - * Specify the maximum distance. - * Type: ALfloat - * Range: [0.0 - ] - */ - public static final int AL_MAX_DISTANCE = 0x1023; - - /** - * Specify the channel mask. (Creative) - * Type: ALuint - * Range: [0 - 255] - */ - public static final int AL_CHANNEL_MASK = 0x3000; - - /** Source state information */ - public static final int AL_SOURCE_STATE = 0x1010; - - /** Source state information */ - public static final int AL_INITIAL = 0x1011; - - /** Source state information */ - public static final int AL_PLAYING = 0x1012; - - /** Source state information */ - public static final int AL_PAUSED = 0x1013; - - /** Source state information */ - public static final int AL_STOPPED = 0x1014; - - /** Buffer Queue params */ - public static final int AL_BUFFERS_QUEUED = 0x1015; - - /** Buffer Queue params */ - public static final int AL_BUFFERS_PROCESSED = 0x1016; - - /** Sound buffers: format specifier. */ - public static final int AL_FORMAT_MONO8 = 0x1100; - - /** Sound buffers: format specifier. */ - public static final int AL_FORMAT_MONO16 = 0x1101; - - /** Sound buffers: format specifier. */ - public static final int AL_FORMAT_STEREO8 = 0x1102; - - /** Sound buffers: format specifier. */ - public static final int AL_FORMAT_STEREO16 = 0x1103; - - /** - * Sound buffers: frequency, in units of Hertz [Hz]. - * This is the number of samples per second. Half of the - * sample frequency marks the maximum significant - * frequency component. - */ - public static final int AL_FREQUENCY = 0x2001; - - /** - * Sound buffers: frequency, in units of Hertz [Hz]. - * This is the number of samples per second. Half of the - * sample frequency marks the maximum significant - * frequency component. - */ - public static final int AL_BITS = 0x2002; - - /** - * Sound buffers: frequency, in units of Hertz [Hz]. - * This is the number of samples per second. Half of the - * sample frequency marks the maximum significant - * frequency component. - */ - public static final int AL_CHANNELS = 0x2003; - - /** - * Sound buffers: frequency, in units of Hertz [Hz]. - * This is the number of samples per second. Half of the - * sample frequency marks the maximum significant - * frequency component. - */ - public static final int AL_SIZE = 0x2004; - - /** - * Sound buffers: frequency, in units of Hertz [Hz]. - * This is the number of samples per second. Half of the - * sample frequency marks the maximum significant - * frequency component. - */ - public static final int AL_DATA = 0x2005; - - /** - * Buffer state. - * - * Not supported for public use (yet). - */ - public static final int AL_UNUSED = 0x2010; - - /** - * Buffer state. - * - * Not supported for public use (yet). - */ - public static final int AL_PENDING = 0x2011; - - /** - * Buffer state. - * - * Not supported for public use (yet). - */ - public static final int AL_PROCESSED = 0x2012; - - /** Errors: No Error. */ - public static final int AL_NO_ERROR = AL_FALSE; - - /** Illegal name passed as an argument to an AL call. */ - public static final int AL_INVALID_NAME = 0xA001; - - /** Illegal enum passed as an argument to an AL call. */ - public static final int AL_INVALID_ENUM = 0xA002; - - /** - * Illegal value passed as an argument to an AL call. - * Applies to parameter values, but not to enumerations. - */ - public static final int AL_INVALID_VALUE = 0xA003; - - /** - * A function was called at inappropriate time, - * or in an inappropriate way, causing an illegal state. - * This can be an incompatible ALenum, object ID, - * and/or function. - */ - public static final int AL_INVALID_OPERATION = 0xA004; - - /** - * A function could not be completed, - * because there is not enough memory available. - */ - public static final int AL_OUT_OF_MEMORY = 0xA005; - - /** Context strings: Vendor */ - public static final int AL_VENDOR = 0xB001; - - /** Context strings: Version */ - public static final int AL_VERSION = 0xB002; - - /** Context strings: Renderer */ - public static final int AL_RENDERER = 0xB003; - - /** Context strings: Extensions */ - public static final int AL_EXTENSIONS = 0xB004; - - /** Doppler scale. Default 1.0 */ - public static final int AL_DOPPLER_FACTOR = 0xC000; - - /** Doppler velocity. Default 1.0 */ - public static final int AL_DOPPLER_VELOCITY = 0xC001; - - /** Distance model. Default AL_INVERSE_DISTANCE_CLAMPED */ - public static final int AL_DISTANCE_MODEL = 0xD000; - - /** Distance model */ - public static final int AL_INVERSE_DISTANCE = 0xD001; - - /** Distance model */ - public static final int AL_INVERSE_DISTANCE_CLAMPED = 0xD002; -} \ No newline at end of file diff --git a/src/java/net/java/games/joal/ALException.java b/src/java/net/java/games/joal/ALException.java new file mode 100755 index 0000000..75c6944 --- /dev/null +++ b/src/java/net/java/games/joal/ALException.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * -Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * -Redistribution in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING + * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR + * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS + * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A + * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT + * OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS + * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use in the + * design, construction, operation or maintenance of any nuclear facility. + */ + +package net.java.games.joal; + +/** A generic exception for OpenAL errors used throughout the binding + as a substitute for {@link RuntimeException}. */ + +public class ALException extends RuntimeException { + /** Constructs an ALException object. */ + public ALException() { + super(); + } + + /** Constructs an ALException object with the specified detail + message. */ + public ALException(String message) { + super(message); + } + + /** Constructs an ALException object with the specified detail + message and root cause. */ + public ALException(String message, Throwable cause) { + super(message, cause); + } + + /** Constructs an ALException object with the specified root + cause. */ + public ALException(Throwable cause) { + super(cause); + } +} diff --git a/src/java/net/java/games/joal/ALFactory.java b/src/java/net/java/games/joal/ALFactory.java index ae9f906..d500a83 100644 --- a/src/java/net/java/games/joal/ALFactory.java +++ b/src/java/net/java/games/joal/ALFactory.java @@ -1,111 +1,89 @@ /** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ + * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * -Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * -Redistribution in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING + * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR + * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS + * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A + * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT + * OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS + * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use in the + * design, construction, operation or maintenance of any nuclear facility. + */ package net.java.games.joal; +import net.java.games.joal.impl.*; + +import com.sun.gluegen.runtime.*; + /** - * This class provides factory methods for generating AL and ALC objects. The - * class must be initialized before use, and should be deinitialized when OpenAL - * functionality is no longer needed to free up native resources. + * This class provides factory methods for generating AL and ALC objects. * * @author Athomas Goldberg + * @author Kenneth Russell */ public class ALFactory { - static { - System.loadLibrary("joal"); - } + private static boolean initialized = false; + private static AL al; + private static ALC alc; - private static boolean isInitialized = false; - private static ALImpl al; - private static ALC alc; - - /** - * Initialize the OpenAL environment - * - * @return true is OpenAL was able to initialize, - * false if OpenAL was not able to intialize - */ - public static boolean initialize() throws OpenALException { - String osProperty = System.getProperty("os.name"); - if(osProperty.startsWith("Win")) { - isInitialized = init(new String[] { "OpenAL32.dll" }); - } else if(osProperty.startsWith("Linux")) { - isInitialized = init(new String[] { "libopenal.so" }); - } else { - isInitialized = init(new String[] { "/Library/Frameworks/OpenAL.framework/Versions/Current/OpenAL"}); - } - return isInitialized; + private static synchronized void initialize() throws ALException { + try { + if (!initialized) { + NativeLibLoader.load(); + initialized = true; + } + } catch (UnsatisfiedLinkError e) { + throw new ALException(e); } + } - private static native boolean init(String[] oalPaths) throws OpenALException; - - /** - * Deinitialize the OpenAL environment - * - * @return true if OpenAL was able to be deinitialized, - * false if OpenAL uas unable to be deinitialized - */ - public static native boolean deinitialize(); - - /** - * Get the default AL object. This object is used to access most of the - * OpenAL functionality. - * - * @return the AL object - */ - public static AL getAL() throws OpenALException { - if(!isInitialized) { - initialize(); - } - if (isInitialized && al == null) { - al = new ALImpl(); - } - return al; + /** + * Get the default AL object. This object is used to access most of the + * OpenAL functionality. + * + * @return the AL object + */ + public static AL getAL() throws ALException { + initialize(); + if (al == null) { + al = new ALImpl(); } + return al; + } - /** - * Get the default ALC object. This object is used to access most of the - * OpenAL context functionality. - * - * @return the ALC object - */ - public static ALC getALC() throws OpenALException{ - if(!isInitialized) { - initialize(); - } - if (isInitialized && alc == null) { - alc = new ALCImpl(); - } - return alc; + /** + * Get the default ALC object. This object is used to access most of the + * OpenAL context functionality. + * + * @return the ALC object + */ + public static ALC getALC() throws ALException{ + initialize(); + if (alc == null) { + alc = new ALCImpl(); } + return alc; + } } diff --git a/src/java/net/java/games/joal/ALImpl.java b/src/java/net/java/games/joal/ALImpl.java deleted file mode 100644 index 14362de..0000000 --- a/src/java/net/java/games/joal/ALImpl.java +++ /dev/null @@ -1,921 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - -package net.java.games.joal; - -import java.nio.ByteBuffer; -import java.nio.DoubleBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; - - -final class ALImpl implements AL { - ALImpl() { - System.loadLibrary("joal"); - } - - // AL_BUFFER RELATED METHODS - - public void alGenBuffers(int n, IntBuffer buffers) { - if ( - (buffers == null) || - !buffers.isDirect() || - (n > buffers.capacity()) - ) { - throw new IllegalArgumentException( - "buffers must be direct, can not be null" + - " and buffer capacity must be greater than requested number of " + - "buffers." - ); - } else { - alGenBuffersNative(n, buffers); - } - } - - private native void alGenBuffersNative(int n, IntBuffer buffers); - - public void alGenBuffers(int n, int[] buffers) { - if ((buffers == null) || (n > buffers.length)) { - throw new IllegalArgumentException( - "buffers can not be null" + - " and array length must be greater than requested number of " + - "buffers." - ); - } else { - alGenBuffersNative(n, buffers); - } - } - - private native void alGenBuffersNative(int n, int[] buffers); - - public void alDeleteBuffers(int n, IntBuffer buffers) { - if ( - (buffers == null) || - !buffers.isDirect() || - (n > buffers.capacity()) - ) { - throw new IllegalArgumentException( - "buffers must be direct, can not be null" + - " and buffer capacity must be greater than requested number of " + - "buffers." - ); - } else { - alDeleteBuffersNative(n, buffers); - } - } - - private native void alDeleteBuffersNative(int n, IntBuffer buffers); - - public void alDeleteBuffers(int n, int[] buffers) { - if ((buffers == null) || (n > buffers.length)) { - throw new IllegalArgumentException( - "buffers can not be null" + - " and array length must be greater than requested number of " + - "buffers." - ); - } else { - alDeleteBuffersNative(n, buffers); - } - } - - private native void alDeleteBuffersNative(int n, int[] buffers); - - public native boolean alIsBuffer(int bufferName); - - public void alBufferData( - int buffername, - int format, - byte[] data, - int size, - int frequency - ) { - if (data == null) { - throw new IllegalArgumentException("data must not be null"); - } else { - alBufferDataNative(buffername, format, data, size, frequency); - } - } - - private native void alBufferDataNative( - int buffername, - int format, - byte[] data, - int size, - int frequency - ); - - public void alBufferData( - int buffername, - int format, - ByteBuffer data, - int size, - int frequency - ) { - if ((data == null) || !data.isDirect()) { - throw new IllegalArgumentException( - "data must be a direct, non-null buffer" - ); - } else { - alBufferDataNative(buffername, format, data, size, frequency); - } - } - - private native void alBufferDataNative( - int buffername, - int format, - ByteBuffer data, - int size, - int frequency - ); - - public void alGetBufferf(int bufferName, int pname, float[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException( - "Return Value argument must not be null." - ); - } else { - alGetBufferfNative(bufferName, pname, retValue); - } - } - - private native void alGetBufferfNative( - int bufferName, - int pname, - float[] retValue - ); - - public void alGetBufferf(int bufferName, int pname, FloatBuffer retValue) { - if ((retValue == null) || !retValue.isDirect()) { - throw new IllegalArgumentException( - "Return Value argument must be a direct, non-null buffer" - ); - } else { - alGetBufferfNative(bufferName, pname, retValue); - } - } - - private native void alGetBufferfNative( - int bufferName, - int pname, - FloatBuffer retValue - ); - - public native float alGetBufferf(int bufferName, int pname); - - public void alGetBufferi(int bufferName, int pname, int[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException( - "Return Value argument must not be null" - ); - } else { - alGetBufferiNative(bufferName, pname, retValue); - } - } - - private native void alGetBufferiNative( - int bufferName, - int pname, - int[] retValue - ); - - public void alGetBufferi(int bufferName, int pname, IntBuffer retValue) { - if ((retValue == null) || !retValue.isDirect()) { - throw new IllegalArgumentException( - "Return Value argument must be a direct, non-null IntBuffer" - ); - } else { - alGetBufferiNative(bufferName, pname, retValue); - } - } - - private native void alGetBufferiNative( - int bufferName, - int pname, - IntBuffer retValue - ); - - public native int alGetBufferi(int bufferName, int pname); - - // SOURCE RELATED METHODS - public void alGenSources(int numSources, int[] sources) { - if ((sources == null) || (numSources > sources.length)) { - throw new IllegalArgumentException( - "sources can not be null" + - " and array length must be greater than requested number of " + - "sources." - ); - } else { - alGenSourcesNative(numSources, sources); - } - } - - private native void alGenSourcesNative(int numSources, int[] sources); - - public void alGenSources(int numSources, IntBuffer sources) { - if ( - (sources == null) || - !sources.isDirect() || - (numSources > sources.capacity()) - ) { - throw new IllegalArgumentException( - "sources buffer must be direct, can not be null" + - " and capacity must be greater than requested number of " + - "sources." - ); - } else { - alGenSourcesNative(numSources, sources); - } - } - - private native void alGenSourcesNative(int numSources, IntBuffer sources); - - public void alDeleteSources(int numSources, int[] sources) { - if ((sources == null) || (numSources > sources.length)) { - throw new IllegalArgumentException( - "sources can not be null" + - " and array length must be greater than requested number of " + - "sources." - ); - } else { - alDeleteSourcesNative(numSources, sources); - } - } - - private native void alDeleteSourcesNative(int numSources, int[] sources); - - public void alDeleteSources(int numSources, IntBuffer sources) { - if ( - (sources == null) || - !sources.isDirect() || - (numSources > sources.capacity()) - ) { - throw new IllegalArgumentException( - "sources buffer must be direct, can not be null" + - " and capacity must be greater than requested number of " + - "sources." - ); - } else { - alDeleteSourcesNative(numSources, sources); - } - } - - private native void alDeleteSourcesNative( - int numSources, - IntBuffer sources - ); - - public native boolean alIsSource(int sourceName); - - public native void alSourcei(int sourcename, int pname, int value); - - public native void alSourcef(int sourcename, int pname, float value); - - public void alSourcefv(int sourcename, int pname, float[] value) { - alSourcefvNative(sourcename,pname,value); - } - - private native void alSourcefvNative(int sourcename, int pname, float[] value); - - public void alSourcefv(int sourcename, int pname, FloatBuffer value) { - if ((value != null) && !value.isDirect()) { - throw new IllegalArgumentException("buffer must be direct"); - } else { - alSourcefvNative(sourcename, pname, value); - } - } - - private native void alSourcefvNative( - int sourcename, - int pname, - FloatBuffer value - ); - - public native void alSource3f( - int sourcename, - int pname, - float v1, - float v2, - float v3 - ); - - public void alGetSourcef(int sourcename, int pname, float[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException("retValue must not be null"); - } else { - alGetSourcefNative(sourcename, pname, retValue); - } - } - - private native void alGetSourcefNative( - int sourcename, - int pname, - float[] retValue - ); - - public void alGetSourcef(int sourceName, int pname, FloatBuffer buffer) { - if ((buffer == null) || !buffer.isDirect()) { - throw new IllegalArgumentException( - "Buffer must be direct and non-null" - ); - } else { - alGetSourcefNative(sourceName, pname, buffer); - } - } - - private native void alGetSourcefNative( - int sourceName, - int pname, - FloatBuffer buffer - ); - - public native float alGetSourcef(int sourceName, int pname); - - public void alGetSourcefv(int sourcename, int pname, FloatBuffer value) { - if ((value == null) || !value.isDirect()) { - throw new IllegalArgumentException( - "Buffer must be direct and non-null" - ); - } else { - alGetSourcefvNative(sourcename, pname, value); - } - } - - private native void alGetSourcefvNative( - int sourcename, - int pname, - FloatBuffer value - ); - - - public void alGetSourcefv(int sourcename, int pname, float[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException( - "retValue arg array must not be null" - ); - } else { - alGetSourcefvNative(sourcename, pname, retValue); - } - } - - private native void alGetSourcefvNative( - int sourcename, - int pname, - float[] retValue - ); - - - public void alGetSourcei(int sourcename, int pname, int[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException( - "retValue arg array must not be null" - ); - } else { - alGetSourceiNative(sourcename, pname, retValue); - } - } - - private native void alGetSourceiNative( - int sourcename, - int pname, - int[] retValue - ); - - public void alGetSourcei(int sourcename, int pname, IntBuffer value) { - if ((value == null) || !value.isDirect()) { - throw new IllegalArgumentException( - "Buffer must be direct and non-null" - ); - } else { - alGetSourceiNative(sourcename, pname, value); - } - } - - private native void alGetSourceiNative( - int sourcename, - int pname, - IntBuffer retValue - ); - - public native int alGetSourcei(int sourcename, int pname); - - - public native void alSourcePlay(int sourcename); - - public void alSourcePlayv(int numSources, int[] sourcenames) { - if ((sourcenames == null) || (numSources > sourcenames.length)) { - throw new IllegalArgumentException( - "sourcenames must be non-null" + - " and at least as large as the number of sources requested" - ); - } else { - alSourcePlayvNative(numSources, sourcenames); - } - } - - private native void alSourcePlayvNative(int numSources, int[] sourcenames); - - public void alSourcePlayv(int numSources, IntBuffer sourcenames) { - if ( - (sourcenames == null) || - (numSources > sourcenames.capacity()) || - !sourcenames.isDirect() - ) { - throw new IllegalArgumentException( - "sourcenames buffer must be direct, non-null and have a" + - " equals or greater capacity than the number of sources" + - " requested" - ); - } else { - alSourcePlayvNative(numSources, sourcenames); - } - } - - private native void alSourcePlayvNative( - int numSources, - IntBuffer sourcenames - ); - - public native void alSourcePause(int sourcename); - - public void alSourcePausev(int numSources, int[] sourcenames) { - if ((sourcenames == null) || (numSources > sourcenames.length)) { - throw new IllegalArgumentException( - "sourcenames must be non-null" + - " and at least as large as the number of sources requested" - ); - } else { - alSourcePausevNative(numSources, sourcenames); - } - } - - private native void alSourcePausevNative(int numSources, int[] sourcenames); - - public void alSourcePausev(int numSources, IntBuffer sourcenames) { - if ( - (sourcenames == null) || - (numSources > sourcenames.capacity()) || - !sourcenames.isDirect() - ) { - throw new IllegalArgumentException( - "sourcenames buffer must be direct, non-null and have a" + - " equals or greater capacity than the number of sources" + - " requested" - ); - } else { - alSourcePausevNative(numSources, sourcenames); - } - } - - private native void alSourcePausevNative( - int numSources, - IntBuffer sourcenames - ); - - public native void alSourceStop(int sourcename); - - public void alSourceStopv(int numSources, int[] sourcenames) { - if ((sourcenames == null) || (numSources > sourcenames.length)) { - throw new IllegalArgumentException( - "sourcenames must be non-null" + - " and at least as large as the number of sources requested" - ); - } else { - alSourceStopvNative(numSources, sourcenames); - } - } - - private native void alSourceStopvNative(int numSources, int[] sourcenames); - - public void alSourceStopv(int numSources, IntBuffer sourcenames) { - if ( - (sourcenames == null) || - (numSources > sourcenames.capacity()) || - !sourcenames.isDirect() - ) { - throw new IllegalArgumentException( - "sourcenames buffer must be direct, non-null and have a" + - " equals or greater capacity than the number of sources" + - " requested" - ); - } else { - alSourcePlayvNative(numSources, sourcenames); - } - } - - private native void alSourceStopvNative( - int numSources, - IntBuffer sourcenames - ); - - public native void alSourceRewind(int sourcename); - - public void alSourceRewindv(int numSources, int[] sourcenames) { - if ((sourcenames == null) || (numSources > sourcenames.length)) { - throw new IllegalArgumentException( - "sourcenames must be non-null" + - " and at least as large as the number of sources requested" - ); - } else { - alSourceRewindvNative(numSources, sourcenames); - } - } - - private native void alSourceRewindvNative( - int numSources, - int[] sourcenames - ); - - public void alSourceRewindv(int numSources, IntBuffer sourcenames) { - if ( - (sourcenames == null) || - (numSources > sourcenames.capacity()) || - !sourcenames.isDirect() - ) { - throw new IllegalArgumentException( - "sourcenames buffer must be direct, non-null and have a" + - " equals or greater capacity than the number of sources" + - " requested" - ); - } else { - alSourceRewindvNative(numSources, sourcenames); - } - } - - private native void alSourceRewindvNative( - int numSources, - IntBuffer sourcenames - ); - - public void alSourceQueueBuffers( - int sourcename, - int numBuffers, - int[] buffernames - ) { - if ((buffernames == null) || (numBuffers > buffernames.length)) { - throw new IllegalArgumentException( - "buffernames must be non-null and equal or greater " + - "than the numBuffers specified" - ); - } else { - alSourceQueueBuffersNative(sourcename, numBuffers, buffernames); - } - } - - private native void alSourceQueueBuffersNative( - int sourcename, - int numBuffers, - int[] buffernames - ); - - public void alSourceQueueBuffers( - int sourcename, - int numBuffers, - IntBuffer buffernames - ) { - if ( - (buffernames == null) || - !buffernames.isDirect() || - (numBuffers > buffernames.capacity()) - ) { - throw new IllegalArgumentException( - "only non-null, direct buffers of numBuffers capacity" + - " or greater may be used." - ); - } else { - alSourceQueueBuffersNative(sourcename, numBuffers, buffernames); - } - } - - private native void alSourceQueueBuffersNative( - int sourcename, - int numBuffers, - IntBuffer buffernames - ); - - public void alSourceUnqueueBuffers( - int sourcename, - int numBuffers, - int[] buffernames - ) { - if ((buffernames == null) || (numBuffers > buffernames.length)) { - throw new IllegalArgumentException( - "buffernames must be non-null and equal or greater " + - "than the numBuffers specified" - ); - } else { - alSourceUnqueueBuffersNative(sourcename, numBuffers, buffernames); - } - } - - private native void alSourceUnqueueBuffersNative( - int sourcename, - int numBuffers, - int[] buffernames - ); - - public void alSourceUnqueueBuffers( - int sourcename, - int numBuffers, - IntBuffer buffernames - ) { - if ( - (buffernames == null) || - !buffernames.isDirect() || - (numBuffers > buffernames.capacity()) - ) { - throw new IllegalArgumentException( - "only non-null, direct buffers of numBuffers capacity" + - " or greater may be used." - ); - } else { - alSourceUnqueueBuffersNative(sourcename, numBuffers, buffernames); - } - } - - private native void alSourceUnqueueBuffersNative( - int sourcename, - int numBuffers, - IntBuffer buffernames - ); - - // LISTENER RELATED METHODS - public native void alListenerf(int pname, float value); - - public native void alListener3f(int pname, float v1, float v2, float v3); - - public void alListenerfv(int pname, float[] values) { - alListenerfvNative(pname,values); - } - - private native void alListenerfvNative(int pname, float[] value); - - public void alListenerfv(int pname, FloatBuffer value) { - if ((value != null) && !value.isDirect()) { - throw new IllegalArgumentException("buffer must be direct"); - } else { - alListenerfvNative(pname, value); - } - } - - private native void alListenerfvNative(int pname, FloatBuffer value); - - public native void alListeneri(int pname, int value); - - public void alGetListenerf(int pname, float[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException( - "retValue must be non-null array" - ); - } - } - - private native void alGetListenerfNative(int pname, float[] retValue); - - public void alGetListenerf(int pname, FloatBuffer retValue) { - if ((retValue == null) || !retValue.isDirect()) { - throw new IllegalArgumentException( - "retValue must be a non-null direct buffer" - ); - } else { - alGetListenerfNative(pname, retValue); - } - } - - private native void alGetListenerfNative(int pname, FloatBuffer retValue); - - public native float alGetListenerf(int pname); - - public void alGetListener3f( - int pname, - FloatBuffer v1, - FloatBuffer v2, - FloatBuffer v3 - ) { - if ( - ((v1 == null) || !v1.isDirect()) || - ((v2 == null) || !v2.isDirect()) || - ((v3 == null) || !v3.isDirect()) - ) { - throw new IllegalArgumentException( - "buffers must be non-null and direct" - ); - } else { - alGetListener3fNative(pname, v1, v2, v3); - } - } - - private native void alGetListener3fNative( - int pname, - FloatBuffer v1, - FloatBuffer v2, - FloatBuffer v3 - ); - - public void alGetListener3f(int pname, float[] v1, float[] v2, float[] v3) { - if ((v1 == null) || (v2 == null) || (v3 == null)) { - throw new IllegalArgumentException("Arrays must be non-null"); - } else { - alGetListener3fNative(pname, v1, v2, v3); - } - } - - private native void alGetListener3fNative( - int pname, - float[] v1, - float[] v2, - float[] v3 - ); - - public void alGetListenerfv(int pname, float[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException("Array must be non-null"); - } else { - alGetListenerfvNative(pname, retValue); - } - } - - private native void alGetListenerfvNative(int pname, float[] retValue); - - public void alGetListenerfv(int pname, FloatBuffer retValue) { - if ((retValue == null) || !retValue.isDirect()) { - throw new IllegalArgumentException( - "Buffer must be non-null and direct" - ); - } else { - alGetListenerfvNative(pname, retValue); - } - } - - private native void alGetListenerfvNative(int pname, FloatBuffer retValue); - - public void alGetListeneri(int pname, int[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException("Array must be non-null"); - } else { - alGetListeneriNative(pname, retValue); - } - } - - private native void alGetListeneriNative(int pname, int[] retValue); - - public void alGetListeneri(int pname, IntBuffer retValue) { - if ((retValue == null) || !retValue.isDirect()) { - throw new IllegalArgumentException( - "Buffer must be non-null and direct" - ); - } else { - alGetListeneriNative(pname, retValue); - } - } - - private native void alGetListeneriNative(int pname, IntBuffer retValue); - - public native int alGetListeneri(int pname); - - // STATE RELATED METHODS - public native void alEnable(int capability); - - public native void alDisable(int capability); - - public native boolean alIsEnabled(int capability); - - public native boolean alGetBoolean(int pname); - - public native double alGetDouble(int pname); - - public native float alGetFloat(int pname); - - public native int alGetInteger(int pname); - - // No Boolean Array states at the moment - // public native void getBooleanv(int pname, ByteBuffer value); - - public void alGetBooleanv(int pname, boolean[] value) { - if (value == null) { - throw new IllegalArgumentException("Array must be non-null"); - } else { - value[0] = false; - // do nothing for now, there are no boolean vector props - // alGetBooleanvNative(pname, value); - } - } - - private native void alGetBooleanvNative(int pname, boolean[] value); - - public void alGetDoublev(int pname, double[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException("Array must be non-null"); - } else { - alGetDoublevNative(pname, retValue); - } - } - - private native void alGetDoublevNative(int pname, double[] retValue); - - public void alGetDoublev(int pname, DoubleBuffer value) { - if ((value == null) || !value.isDirect()) { - throw new IllegalArgumentException( - "Buffer must be non-null and direct" - ); - } else { - alGetDoublevNative(pname, value); - } - } - - private native void alGetDoublevNative(int pname, DoubleBuffer value); - - public void alGetFloatv(int pname, float[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException("Array must be non-null"); - } else { - alGetFloatvNative(pname, retValue); - } - } - - private native void alGetFloatvNative(int pname, float[] retValue); - - public void alGetFloatv(int pname, FloatBuffer value) { - if ((value == null) || !value.isDirect()) { - throw new IllegalArgumentException( - "Buffer must be non-null and direct" - ); - } else { - alGetFloatvNative(pname, value); - } - } - - private native void alGetFloatvNative(int pname, FloatBuffer value); - - public void alGetIntegerv(int pname, int[] retValue) { - if (retValue == null) { - throw new IllegalArgumentException("Array must be non-null"); - } else { - alGetIntegervNative(pname, retValue); - } - } - - private native void alGetIntegervNative(int pname, int[] retValue); - - public void alGetIntegerv(int pname, IntBuffer value) { - if ((value == null) || !value.isDirect()) { - throw new IllegalArgumentException( - "Buffer must be non-null and direct" - ); - } else { - alGetIntegervNative(pname, value); - } - } - - private native void alGetIntegervNative(int pname, IntBuffer value); - - public native String alGetString(int pname); - - public native void alDistanceModel(int model); - - public native void alDopplerFactor(float value); - - public native void alDopplerVelocity(float value); - - // ERROR RELATED METHODS - public native int alGetError(); - - // EXTENSION RELATED METHODS - public native boolean alIsExtensionPresent(String extName); - - // public native Method getProcAddress(String methodName); - public native int alGetEnumValue(String enumName); - /* (non-Javadoc) - * @see net.java.games.joal.AL#alGetBooleanv(int, boolean[]) - */ - -} diff --git a/src/java/net/java/games/joal/NativeLibLoader.java b/src/java/net/java/games/joal/NativeLibLoader.java new file mode 100755 index 0000000..394d1b4 --- /dev/null +++ b/src/java/net/java/games/joal/NativeLibLoader.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +package net.java.games.joal; + +import java.security.*; + +class NativeLibLoader { + static { + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + // Workaround for problem in OpenAL32.dll, which is actually + // the "wrapper" DLL which looks for real OpenAL + // implementations like nvopenal.dll and "*oal.dll". + // joal.dll matches this wildcard and a bug in OpenAL32.dll + // causes a call through a null function pointer. + System.loadLibrary("joal_native"); + + // Workaround for 4845371. + // Make sure the first reference to the JNI GetDirectBufferAddress is done + // from a privileged context so the VM's internal class lookups will succeed. + // FIXME: need to figure out an appropriate entry point to call + // JAWT jawt = new JAWT(); + // JAWTFactory.JAWT_GetAWT(jawt); + + return null; + } + }); + } + + public static void load() { + } +} diff --git a/src/java/net/java/games/joal/OpenALException.java b/src/java/net/java/games/joal/OpenALException.java deleted file mode 100644 index f8a7732..0000000 --- a/src/java/net/java/games/joal/OpenALException.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Created on Nov 22, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package net.java.games.joal; - -/** - * @author athomas - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class OpenALException extends Exception { - - /** - * - */ - public OpenALException() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @param arg0 - */ - public OpenALException(String arg0) { - super(arg0); - // TODO Auto-generated constructor stub - } - - /** - * @param arg0 - */ - public OpenALException(Throwable arg0) { - super(arg0); - // TODO Auto-generated constructor stub - } - - /** - * @param arg0 - * @param arg1 - */ - public OpenALException(String arg0, Throwable arg1) { - super(arg0, arg1); - // TODO Auto-generated constructor stub - } - -} diff --git a/src/java/net/java/games/joal/eax/EAX.java b/src/java/net/java/games/joal/eax/EAX.java index 5ce2a9b..72c7cbf 100644 --- a/src/java/net/java/games/joal/eax/EAX.java +++ b/src/java/net/java/games/joal/eax/EAX.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT diff --git a/src/java/net/java/games/joal/eax/EAXConstants.java b/src/java/net/java/games/joal/eax/EAXConstants.java index 23c3400..44f1bee 100644 --- a/src/java/net/java/games/joal/eax/EAXConstants.java +++ b/src/java/net/java/games/joal/eax/EAXConstants.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT diff --git a/src/java/net/java/games/joal/eax/EAXFactory.java b/src/java/net/java/games/joal/eax/EAXFactory.java index 2547ed7..c700ce6 100644 --- a/src/java/net/java/games/joal/eax/EAXFactory.java +++ b/src/java/net/java/games/joal/eax/EAXFactory.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT diff --git a/src/java/net/java/games/joal/util/ALut.java b/src/java/net/java/games/joal/util/ALut.java index cd89e0c..71673b0 100644 --- a/src/java/net/java/games/joal/util/ALut.java +++ b/src/java/net/java/games/joal/util/ALut.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT @@ -35,15 +35,12 @@ package net.java.games.joal.util; -import java.io.IOException; +import java.io.*; import java.nio.ByteBuffer; import javax.sound.sampled.UnsupportedAudioFileException; -import net.java.games.joal.AL; -import net.java.games.joal.ALC; -import net.java.games.joal.ALFactory; -import net.java.games.joal.OpenALException; +import net.java.games.joal.*; /** * @author Athomas Goldberg @@ -51,80 +48,67 @@ import net.java.games.joal.OpenALException; */ public final class ALut { - private static ALC alc; + private static ALC alc; - private ALut() { } + private ALut() { } - public static void alutInit() throws OpenALException { - System.out.println("Go TEAM!"); - System.out.println("Entering alutInit()"); - ALFactory.initialize(); - alc = ALFactory.getALC(); - //String deviceName = null; - String deviceName = null; - /* - String os = System.getProperty("os.name"); - if (os.startsWith("Windows")) { - deviceName = "DirectSound3D"; - } - if (deviceName != null) { - */ - ALC.Context context; - ALC.Device device; - System.out.println("In alutInit(): Device Name = " + deviceName); - device = alc.alcOpenDevice(deviceName); - System.out.println("In alutInit(): Device = " + device); - context = alc.alcCreateContext(device, null); - alc.alcMakeContextCurrent(context); - /* - } else { - System.out.println( - "alutInit does not currently support " - + os - + ". " - + "You'll need to construct your device and context" - + "using the ALC functions for the time being. We apologize " - + "for the inconvenience."); - } - */ - System.out.println("Exiting alutInit()"); + /** Initializes the OpenAL Utility Toolkit, creates an OpenAL + context and makes it current on the current thread. */ + public static void alutInit() throws ALException { + alc = ALFactory.getALC(); + String deviceName = null; + ALCcontext context; + ALCdevice device; + device = alc.alcOpenDevice(deviceName); + if (device == null) { + throw new ALException("Error opening default OpenAL device"); } - - public static void alutLoadWAVFile( - String fileName, - int[] format, - ByteBuffer[] data, - int[] size, - int[] freq, - int[] loop) { - try { - WAVData wd = WAVLoader.loadFromFile(fileName); - format[0] = wd.format; - data[0] = wd.data; - size[0] = wd.size; - freq[0] = wd.freq; - loop[0] = wd.loop ? AL.AL_TRUE : AL.AL_FALSE; - } catch (IOException e) { - e.printStackTrace(); - } catch (UnsupportedAudioFileException e) { - e.printStackTrace(); - } + context = alc.alcCreateContext(device, null); + if (context == null) { + throw new ALException("Error creating OpenAL context"); + } + alc.alcMakeContextCurrent(context); + if (alc.alcGetError(device) != 0) { + throw new ALException("Error making OpenAL context current"); } + } - public static void alutUnloadWAV( - int format, - ByteBuffer data, - int size, - int freq) { - // unneeded. here for completeness. + public static void alutLoadWAVFile(String fileName, + int[] format, + ByteBuffer[] data, + int[] size, + int[] freq, + int[] loop) throws ALException { + try { + WAVData wd = WAVLoader.loadFromFile(fileName); + format[0] = wd.format; + data[0] = wd.data; + size[0] = wd.size; + freq[0] = wd.freq; + loop[0] = wd.loop ? AL.AL_TRUE : AL.AL_FALSE; + } catch (Exception e) { + throw new ALException(e); } + } - public static void alutExit() { - - ALC.Context context = alc.alcGetCurrentContext(); - ALC.Device device = alc.alcGetContextsDevice(context); - alc.alcFreeCurrentContext(); - alc.alcDestroyContext(context); - alc.alcCloseDevice(device); + public static void alutLoadWAVFile(InputStream stream, + int[] format, + ByteBuffer[] data, + int[] size, + int[] freq, + int[] loop) throws ALException { + try { + if (!(stream instanceof BufferedInputStream)) { + stream = new BufferedInputStream(stream); + } + WAVData wd = WAVLoader.loadFromStream(stream); + format[0] = wd.format; + data[0] = wd.data; + size[0] = wd.size; + freq[0] = wd.freq; + loop[0] = wd.loop ? AL.AL_TRUE : AL.AL_FALSE; + } catch (Exception e) { + throw new ALException(e); } + } } diff --git a/src/java/net/java/games/joal/util/BufferUtils.java b/src/java/net/java/games/joal/util/BufferUtils.java index 47bf3bc..05de65a 100644 --- a/src/java/net/java/games/joal/util/BufferUtils.java +++ b/src/java/net/java/games/joal/util/BufferUtils.java @@ -1,165 +1,266 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ package net.java.games.joal.util; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.CharBuffer; -import java.nio.DoubleBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.nio.LongBuffer; -import java.nio.ShortBuffer; - - -/** - * Provides a collection of methods for generating direct Buffers of various - * types. - * - * @author Athomas Goldberg - */ +import java.nio.*; +import java.util.*; + +/** Utility routines for dealing with direct buffers. */ + public class BufferUtils { - private static final int CHAR = 2; - private static final int SHORT = 2; - private static final int INT = 4; - private static final int LONG = 8; - private static final int FLOAT = 4; - private static final int DOUBLE = 8; - - private BufferUtils() { - } - - /** - * Create a new direct ByteBuffer of the specified size. - * - * @param size (in bytes) of the returned ByteBuffer - * - * @return a new direct ByteBuffer of the specified size - */ - public static ByteBuffer newByteBuffer(int size) { - ByteBuffer result = null; - result = ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); - - return result; - } - - /** - * Create a new direct CharBuffer of the specified size. - * - * @param size (in chars) of the returned CharBuffer - * - * @return a new direct CharBuffer of the specified size - */ - public static CharBuffer newCharBuffer(int size) { - CharBuffer result = null; - ByteBuffer temp = newByteBuffer(size * CHAR); - result = temp.asCharBuffer(); - - return result; - } - - /** - * Create a new direct ShortBuffer of the specified size. - * - * @param size (in shorts) of the returned ShortBuffer - * - * @return a new direct ShortBuffer of the specified size - */ - public static ShortBuffer newShortBuffer(int size) { - ShortBuffer result = null; - ByteBuffer temp = newByteBuffer(size * SHORT); - result = temp.asShortBuffer(); - - return result; - } - - /** - * Create a new direct IntBuffer of the specified size. - * - * @param size (in ints) of the returned IntBuffer - * - * @return a new direct IntBuffer of the specified size - */ - public static IntBuffer newIntBuffer(int size) { - IntBuffer result = null; - ByteBuffer temp = newByteBuffer(size * INT); - result = temp.asIntBuffer(); - - return result; - } - - /** - * Create a new direct LongBuffer of the specified size. - * - * @param size (in longs) of the returned LongBuffer - * - * @return a new direct LongsBuffer of the specified size - */ - public static LongBuffer newLongBuffer(int size) { - LongBuffer result = null; - ByteBuffer temp = newByteBuffer(size * LONG); - result = temp.asLongBuffer(); - - return result; - } - - /** - * Create a new direct FloatBuffer of the specified size. - * - * @param size (in floats) of the returned FloatBuffer - * - * @return a new direct FloatBuffer of the specified size - */ - public static FloatBuffer newFloatBuffer(int size) { - FloatBuffer result = null; - ByteBuffer temp = newByteBuffer(size * FLOAT); - result = temp.asFloatBuffer(); - - return result; - } - - /** - * Create a new direct DoubleBuffer of the specified size. - * - * @param size (in doubles) of the returned DoubleBuffer - * - * @return a new direct DoubleBuffer of the specified size - */ - public static DoubleBuffer newDoubleBuffer(int size) { - DoubleBuffer result = null; - ByteBuffer temp = newByteBuffer(size * DOUBLE); - result = temp.asDoubleBuffer(); - return result; - } + public static final int SIZEOF_BYTE = 1; + public static final int SIZEOF_SHORT = 2; + public static final int SIZEOF_INT = 4; + public static final int SIZEOF_FLOAT = 4; + public static final int SIZEOF_LONG = 8; + public static final int SIZEOF_DOUBLE = 8; + + //---------------------------------------------------------------------- + // Allocation routines + // + + /** Allocates a new direct ByteBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static ByteBuffer newByteBuffer(int numElements) { + ByteBuffer bb = ByteBuffer.allocateDirect(numElements); + bb.order(ByteOrder.nativeOrder()); + return bb; + } + + /** Allocates a new direct DoubleBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static DoubleBuffer newDoubleBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_DOUBLE); + return bb.asDoubleBuffer(); + } + + /** Allocates a new direct FloatBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static FloatBuffer newFloatBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT); + return bb.asFloatBuffer(); + } + + /** Allocates a new direct IntBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static IntBuffer newIntBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT); + return bb.asIntBuffer(); + } + + /** Allocates a new direct LongBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static LongBuffer newLongBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_LONG); + return bb.asLongBuffer(); + } + + /** Allocates a new direct ShortBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static ShortBuffer newShortBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT); + return bb.asShortBuffer(); + } + + //---------------------------------------------------------------------- + // Copy routines (type-to-type) + // + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed ByteBuffer into + a newly-allocated direct ByteBuffer. The returned buffer will + have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyByteBuffer(ByteBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining()); + orig.mark(); + dest.put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed DoubleBuffer + into a newly-allocated direct DoubleBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static DoubleBuffer copyDoubleBuffer(DoubleBuffer orig) { + return copyDoubleBufferAsByteBuffer(orig).asDoubleBuffer(); + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed FloatBuffer + into a newly-allocated direct FloatBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static FloatBuffer copyFloatBuffer(FloatBuffer orig) { + return copyFloatBufferAsByteBuffer(orig).asFloatBuffer(); + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed IntBuffer + into a newly-allocated direct IntBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static IntBuffer copyIntBuffer(IntBuffer orig) { + return copyIntBufferAsByteBuffer(orig).asIntBuffer(); + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed LongBuffer + into a newly-allocated direct LongBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static LongBuffer copyLongBuffer(LongBuffer orig) { + return copyLongBufferAsByteBuffer(orig).asLongBuffer(); + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed ShortBuffer + into a newly-allocated direct ShortBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ShortBuffer copyShortBuffer(ShortBuffer orig) { + return copyShortBufferAsByteBuffer(orig).asShortBuffer(); + } + + //---------------------------------------------------------------------- + // Copy routines (type-to-ByteBuffer) + // + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed DoubleBuffer + into a newly-allocated direct ByteBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyDoubleBufferAsByteBuffer(DoubleBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_DOUBLE); + orig.mark(); + dest.asDoubleBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed FloatBuffer + into a newly-allocated direct ByteBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT); + orig.mark(); + dest.asFloatBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed IntBuffer into + a newly-allocated direct ByteBuffer. The returned buffer will + have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT); + orig.mark(); + dest.asIntBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed LongBuffer into + a newly-allocated direct ByteBuffer. The returned buffer will + have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyLongBufferAsByteBuffer(LongBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_LONG); + orig.mark(); + dest.asLongBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } + + /** Copies the remaining elements (as defined by + limit() - position()) in the passed ShortBuffer + into a newly-allocated direct ByteBuffer. The returned buffer + will have its byte order set to the host platform's native byte + order. The position of the newly-allocated buffer will be zero, + and the position of the passed buffer is unchanged (though its + mark is changed). */ + public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) { + ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT); + orig.mark(); + dest.asShortBuffer().put(orig); + orig.reset(); + dest.rewind(); + return dest; + } } diff --git a/src/java/net/java/games/joal/util/Version.java b/src/java/net/java/games/joal/util/Version.java new file mode 100755 index 0000000..51cff25 --- /dev/null +++ b/src/java/net/java/games/joal/util/Version.java @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* -Redistribution of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* -Redistribution in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* This software is provided "AS IS," without a warranty of any kind. +* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING +* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS +* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A +* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. +* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT +* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR +* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS +* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +* +* You acknowledge that this software is not designed or intended for use in the +* design, construction, operation or maintenance of any nuclear facility. +*/ + +package net.java.games.joal.util; + +/** + * The version and build number of this implementation. + * Version numbers for a release are of the form: w.x.y[-a]-z, where: + * + * + * For example, the following are all valid version strings: + * + * + */ +public final class Version { + + /** + * Private constructor - no need for user to create + * an instance of this class. + */ + private Version() { + } + + /** + * Version string of this build. + */ + private static final String version = "1.1.0-b01"; + + /** + * Returns the version string and build number of + * this implementation. See the class description + * for the version string format. + * + * @return The version string of this implementation. + */ + public static String getVersion() { + return version; + } +} diff --git a/src/java/net/java/games/joal/util/WAVData.java b/src/java/net/java/games/joal/util/WAVData.java index 9ab9e46..c0584e9 100644 --- a/src/java/net/java/games/joal/util/WAVData.java +++ b/src/java/net/java/games/joal/util/WAVData.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT diff --git a/src/java/net/java/games/joal/util/WAVLoader.java b/src/java/net/java/games/joal/util/WAVLoader.java index 4cb2836..e7a5257 100644 --- a/src/java/net/java/games/joal/util/WAVLoader.java +++ b/src/java/net/java/games/joal/util/WAVLoader.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT @@ -33,20 +33,12 @@ package net.java.games.joal.util; -import net.java.games.joal.ALConstants; - -import java.io.File; -import java.io.IOException; - -import java.nio.ByteBuffer; -import java.nio.channels.Channels; -import java.nio.channels.ReadableByteChannel; - -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.UnsupportedAudioFileException; +import java.io.*; +import java.nio.*; +import java.nio.channels.*; +import javax.sound.sampled.*; +import net.java.games.joal.*; /** * A Loader utility for (.wav) files. Creates a WAVData object containing the @@ -74,6 +66,31 @@ public class WAVLoader implements ALConstants { WAVData result = null; File soundFile = new File(filename); AudioInputStream aIn = AudioSystem.getAudioInputStream(soundFile); + return readFromStream(aIn); + } + + /** + * This method loads a (.wav) file into a WAVData object. + * + * @param stream An InputStream for the .WAV file. + * + * @return a WAVData object containing the audio data + * + * @throws UnsupportedAudioFileException if the format of the audio if not + * supported. + * @throws IOException If the file can no be found or some other IO error + * occurs + */ + public static WAVData loadFromStream(InputStream stream) + throws UnsupportedAudioFileException, IOException { + WAVData result = null; + AudioInputStream aIn = AudioSystem.getAudioInputStream(stream); + return readFromStream(aIn); + } + + + private static WAVData readFromStream(AudioInputStream aIn) + throws UnsupportedAudioFileException, IOException { ReadableByteChannel aChannel = Channels.newChannel(aIn); AudioFormat fmt = aIn.getFormat(); int numChannels = fmt.getChannels(); @@ -93,8 +110,24 @@ public class WAVLoader implements ALConstants { int freq = Math.round(fmt.getSampleRate()); int size = aIn.available(); ByteBuffer buffer = ByteBuffer.allocateDirect(size); - aChannel.read(buffer); - result = new WAVData(buffer, format, size, freq, false); + while (buffer.remaining() > 0) { + aChannel.read(buffer); + } + buffer.rewind(); + + // Must byte swap on big endian platforms + // Thanks to swpalmer on javagaming.org forums for hint at fix + if ((bits == 16) && (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN)) { + int len = buffer.remaining(); + for (int i = 0; i < len; i += 2) { + byte a = buffer.get(i); + byte b = buffer.get(i+1); + buffer.put(i, b); + buffer.put(i+1, a); + } + } + + WAVData result = new WAVData(buffer, format, size, freq, false); aIn.close(); return result; diff --git a/src/java/net/java/games/sound3d/AudioSystem3D.java b/src/java/net/java/games/sound3d/AudioSystem3D.java index 8dc4ba3..ea1affa 100644 --- a/src/java/net/java/games/sound3d/AudioSystem3D.java +++ b/src/java/net/java/games/sound3d/AudioSystem3D.java @@ -1,42 +1,39 @@ /** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * -Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * -Redistribution in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. + * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING + * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR + * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS + * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A + * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. + * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT + * OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR + * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS + * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use in the + * design, construction, operation or maintenance of any nuclear facility. + */ package net.java.games.sound3d; -import net.java.games.joal.AL; -import net.java.games.joal.ALC; -import net.java.games.joal.ALFactory; -import net.java.games.joal.OpenALException; +import net.java.games.joal.*; import net.java.games.joal.util.WAVData; import net.java.games.joal.util.WAVLoader; @@ -52,180 +49,175 @@ import javax.sound.sampled.UnsupportedAudioFileException; * @author Athomas Goldberg */ public class AudioSystem3D { - private static AL al; - private static ALC alc; - private static Listener listener; - - /** - * Iniitalize the Sound3D environment. This must be called before - * other methods in the class can be used. - */ - public static void init() throws Sound3DException { - try { - ALFactory.initialize(); - al = ALFactory.getAL(); - alc = ALFactory.getALC(); - } catch (OpenALException e) { - throw new Sound3DException("Could not initialize AudioSystem3D: ",e); - } - } - - /** - * Creates a new Sound3D Context for a specified device. - * - * @param device The device the Context is being created for. - * - * @return The new Sound3D context. - */ - public static Context createContext(Device device) { - Context result = null; - ALC.Context realContext = alc.alcCreateContext(device.realDevice, null); - result = new Context(alc, realContext, device); - return result; + private static AL al; + private static ALC alc; + private static Listener listener; + + /** + * Iniitalize the Sound3D environment. This must be called before + * other methods in the class can be used. + */ + public static void init() throws ALException { + al = ALFactory.getAL(); + alc = ALFactory.getALC(); + } + + /** + * Creates a new Sound3D Context for a specified device. + * + * @param device The device the Context is being created for. + * + * @return The new Sound3D context. + */ + public static Context createContext(Device device) { + Context result = null; + ALCcontext realContext = alc.alcCreateContext(device.realDevice, null); + result = new Context(alc, realContext, device); + return result; + } + + /** + * Makes the specified context the current context. + * + * @param context the context to make current. + */ + public static void makeContextCurrent(Context context) { + ALCcontext realContext = null; + + if (context != null) { + realContext = context.realContext; } - /** - * Makes the specified context the current context. - * - * @param context the context to make current. - */ - public static void makeContextCurrent(Context context) { - ALC.Context realContext = null; - - if (context != null) { - realContext = context.realContext; - } - - alc.alcMakeContextCurrent(realContext); + alc.alcMakeContextCurrent(realContext); + } + + /** + * Opens the specifified audio device. + * + * @param deviceName The specified device name, On windows this will be + * DirectSound3D. We will be automating device discovery in upcoming versions + * of this class. + * + * @return The device described by the specifed name. + */ + public static Device openDevice(String deviceName) { + Device result = null; + ALCdevice realDevice = alc.alcOpenDevice(deviceName); + result = new Device(alc, realDevice); + + return result; + } + + /** + * Generate an array of Sound3D buffers. + * + * @param numBuffers The number of Sound3D buffers to generate. + * + * @return an array of (initially enpty) Sound3D buffers. + */ + public static Buffer[] generateBuffers(int numBuffers) { + Buffer[] result = new Buffer[numBuffers]; + int[] arr = new int[numBuffers]; + al.alGenBuffers(numBuffers, arr, 0); + + for (int i = 0; i < numBuffers; i++) { + result[i] = new Buffer(al, arr[i]); } - /** - * Opens the specifified audio device. - * - * @param deviceName The specified device name, On windows this will be - * DirectSound3D. We will be automating device discovery in upcoming versions - * of this class. - * - * @return The device described by the specifed name. - */ - public static Device openDevice(String deviceName) { - Device result = null; - ALC.Device realDevice = alc.alcOpenDevice(deviceName); - result = new Device(alc, realDevice); - - return result; + return result; + } + + /** + * Loads a Sound3D buffer with the specified audio file. + * + * @param filename the name of the file to load. + * + * @return a new Sound3D buffer containing the audio data from the + * specified file. + * + * @throws IOException If the file cannot be found or some other IO error + * occurs. + * @throws UnsupportedAudioFileException If the format of the sudio data is + * not supported + */ + public static Buffer loadBuffer(String filename) + throws IOException, UnsupportedAudioFileException { + Buffer result; + Buffer[] tmp = generateBuffers(1); + result = tmp[0]; + + WAVData wd = WAVLoader.loadFromFile(filename); + result.configure(wd.data, wd.format, wd.freq); + + return result; + } + + /** + * Loads a Sound3D Source with the specified audio file. This is + * functionally equivelant to generateSource(loadBuffer(fileName)); + * + * @param filename the name of the file to load. + * + * @return a new Sound3D Source containing the audio data from the + * specified file. + * + * @throws IOException If the file cannot be found or some other IO error + * occurs. + * @throws UnsupportedAudioFileException If the format of the sudio data is + * not supported + */ + public static Source loadSource(String filename) + throws IOException, UnsupportedAudioFileException { + Buffer buffer = loadBuffer(filename); + + return generateSource(buffer); + } + + /** + * Generates a set of uninitialized Source3D sources + * + * @param numSources the number of Sound3D sources to generate. + * + * @return an array of uninitialized sources. + */ + public static Source[] generateSources(int numSources) { + Source[] result = new Source[numSources]; + int[] arr = new int[numSources]; + al.alGenSources(numSources, arr, 0); + + for (int i = 0; i < numSources; i++) { + result[i] = new Source(al, arr[i]); } - /** - * Generate an array of Sound3D buffers. - * - * @param numBuffers The number of Sound3D buffers to generate. - * - * @return an array of (initially enpty) Sound3D buffers. - */ - public static Buffer[] generateBuffers(int numBuffers) { - Buffer[] result = new Buffer[numBuffers]; - int[] arr = new int[numBuffers]; - al.alGenBuffers(numBuffers, arr); - - for (int i = 0; i < numBuffers; i++) { - result[i] = new Buffer(al, arr[i]); - } - - return result; + return result; + } + + /** + * Generate a Sound3D source from an initialized Buffer. + * + * @param buff The buffer to generate the source from. + * + * @return the newly generated Source. + */ + public static Source generateSource(Buffer buff) { + Source result = null; + Source[] tmp = generateSources(1); + result = tmp[0]; + result.setBuffer(buff); + + return result; + } + + /** + * Get the listener object associated with this Sound3D environment. + * + * @return The listener object. + */ + public static Listener getListener() { + if (listener == null) { + listener = new Listener(al); } - /** - * Loads a Sound3D buffer with the specified audio file. - * - * @param filename the name of the file to load. - * - * @return a new Sound3D buffer containing the audio data from the - * specified file. - * - * @throws IOException If the file cannot be found or some other IO error - * occurs. - * @throws UnsupportedAudioFileException If the format of the sudio data is - * not supported - */ - public static Buffer loadBuffer(String filename) - throws IOException, UnsupportedAudioFileException { - Buffer result; - Buffer[] tmp = generateBuffers(1); - result = tmp[0]; - - WAVData wd = WAVLoader.loadFromFile(filename); - result.configure(wd.data, wd.format, wd.freq); - - return result; - } - - /** - * Loads a Sound3D Source with the specified audio file. This is - * functionally equivelant to generateSource(loadBuffer(fileName)); - * - * @param filename the name of the file to load. - * - * @return a new Sound3D Source containing the audio data from the - * specified file. - * - * @throws IOException If the file cannot be found or some other IO error - * occurs. - * @throws UnsupportedAudioFileException If the format of the sudio data is - * not supported - */ - public static Source loadSource(String filename) - throws IOException, UnsupportedAudioFileException { - Buffer buffer = loadBuffer(filename); - - return generateSource(buffer); - } - - /** - * Generates a set of uninitialized Source3D sources - * - * @param numSources the number of Sound3D sources to generate. - * - * @return an array of uninitialized sources. - */ - public static Source[] generateSources(int numSources) { - Source[] result = new Source[numSources]; - int[] arr = new int[numSources]; - al.alGenSources(numSources, arr); - - for (int i = 0; i < numSources; i++) { - result[i] = new Source(al, arr[i]); - } - - return result; - } - - /** - * Generate a Sound3D source from an initialized Buffer. - * - * @param buff The buffer to generate the source from. - * - * @return the newly generated Source. - */ - public static Source generateSource(Buffer buff) { - Source result = null; - Source[] tmp = generateSources(1); - result = tmp[0]; - result.setBuffer(buff); - - return result; - } - - /** - * Get the listener object associated with this Sound3D environment. - * - * @return The listener object. - */ - public static Listener getListener() { - if (listener == null) { - listener = new Listener(al); - } - - return listener; - } + return listener; + } } diff --git a/src/java/net/java/games/sound3d/Buffer.java b/src/java/net/java/games/sound3d/Buffer.java index cd666ae..70ad188 100644 --- a/src/java/net/java/games/sound3d/Buffer.java +++ b/src/java/net/java/games/sound3d/Buffer.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT @@ -81,7 +81,7 @@ public class Buffer { */ public void delete() { data = null; - al.alDeleteBuffers(1, new int[] { bufferID }); + al.alDeleteBuffers(1, new int[] { bufferID }, 0); } /** @@ -91,7 +91,7 @@ public class Buffer { */ public int getBitDepth() { int[] i = new int[1]; - al.alGetBufferi(bufferID, AL.AL_BITS, i); + al.alGetBufferi(bufferID, AL.AL_BITS, i, 0); return i[0]; } @@ -103,7 +103,7 @@ public class Buffer { */ public int getNumChannels() { int[] i = new int[1]; - al.alGetBufferi(bufferID, AL.AL_CHANNELS, i); + al.alGetBufferi(bufferID, AL.AL_CHANNELS, i, 0); return i[0]; } @@ -124,7 +124,7 @@ public class Buffer { */ public int getFrequency() { int[] i = new int[1]; - al.alGetBufferi(bufferID, AL.AL_FREQUENCY, i); + al.alGetBufferi(bufferID, AL.AL_FREQUENCY, i, 0); return i[0]; } @@ -136,7 +136,7 @@ public class Buffer { */ public int getSize() { int[] i = new int[1]; - al.alGetBufferi(bufferID, AL.AL_SIZE, i); + al.alGetBufferi(bufferID, AL.AL_SIZE, i, 0); return i[0]; } diff --git a/src/java/net/java/games/sound3d/Context.java b/src/java/net/java/games/sound3d/Context.java index 8b442a6..49344cd 100644 --- a/src/java/net/java/games/sound3d/Context.java +++ b/src/java/net/java/games/sound3d/Context.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT @@ -33,7 +33,7 @@ package net.java.games.sound3d; -import net.java.games.joal.ALC; +import net.java.games.joal.*; /** @@ -43,10 +43,10 @@ import net.java.games.joal.ALC; */ public class Context { private final ALC alc; - final ALC.Context realContext; + final ALCcontext realContext; final Device device; - Context(ALC alc, ALC.Context realContext, Device device) { + Context(ALC alc, ALCcontext realContext, Device device) { this.alc = alc; this.realContext = realContext; this.device = device; diff --git a/src/java/net/java/games/sound3d/Device.java b/src/java/net/java/games/sound3d/Device.java index 44879a3..96c352b 100644 --- a/src/java/net/java/games/sound3d/Device.java +++ b/src/java/net/java/games/sound3d/Device.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT @@ -33,7 +33,7 @@ package net.java.games.sound3d; -import net.java.games.joal.ALC; +import net.java.games.joal.*; /** @@ -43,9 +43,9 @@ import net.java.games.joal.ALC; */ public class Device { private final ALC alc; - final ALC.Device realDevice; + final ALCdevice realDevice; - Device(ALC alc, ALC.Device realDevice) { + Device(ALC alc, ALCdevice realDevice) { this.alc = alc; this.realDevice = realDevice; } diff --git a/src/java/net/java/games/sound3d/Listener.java b/src/java/net/java/games/sound3d/Listener.java index d80c8d0..b25320c 100644 --- a/src/java/net/java/games/sound3d/Listener.java +++ b/src/java/net/java/games/sound3d/Listener.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT @@ -68,7 +68,7 @@ public class Listener { */ public float getGain() { float[] f = new float[1]; - al.alGetListenerf(AL.AL_GAIN, f); + al.alGetListenerf(AL.AL_GAIN, f, 0); return f[0]; } @@ -109,7 +109,7 @@ public class Listener { public Vec3f getPosition() { Vec3f result = null; float[] tmp = new float[3]; - al.alGetListenerfv(AL.AL_POSITION, tmp); + al.alGetListenerfv(AL.AL_POSITION, tmp, 0); result = new Vec3f(tmp[0], tmp[1], tmp[2]); return result; @@ -136,7 +136,7 @@ public class Listener { public Vec3f getVelocity() { Vec3f result = null; float[] tmp = new float[3]; - al.alGetListenerfv(AL.AL_VELOCITY, tmp); + al.alGetListenerfv(AL.AL_VELOCITY, tmp, 0); result = new Vec3f(tmp[0], tmp[1], tmp[2]); return result; @@ -151,7 +151,7 @@ public class Listener { * look-at vector. */ public void setOrientation(float[] orientation) { - al.alListenerfv(AL.AL_ORIENTATION, orientation); + al.alListenerfv(AL.AL_ORIENTATION, orientation, 0); } /** @@ -165,7 +165,7 @@ public class Listener { */ public float[] getOrientation() { float[] tmp = new float[6]; - al.alGetListenerfv(AL.AL_ORIENTATION, tmp); + al.alGetListenerfv(AL.AL_ORIENTATION, tmp, 0); return tmp; } } diff --git a/src/java/net/java/games/sound3d/Sound3DException.java b/src/java/net/java/games/sound3d/Sound3DException.java deleted file mode 100644 index 6b927ca..0000000 --- a/src/java/net/java/games/sound3d/Sound3DException.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Created on Nov 22, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package net.java.games.sound3d; - -/** - * @author athomas - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class Sound3DException extends Exception { - - /** - * - */ - public Sound3DException() { - super(); - // TODO Auto-generated constructor stub - } - - /** - * @param arg0 - */ - public Sound3DException(String arg0) { - super(arg0); - // TODO Auto-generated constructor stub - } - - /** - * @param arg0 - */ - public Sound3DException(Throwable arg0) { - super(arg0); - // TODO Auto-generated constructor stub - } - - /** - * @param arg0 - * @param arg1 - */ - public Sound3DException(String arg0, Throwable arg1) { - super(arg0, arg1); - // TODO Auto-generated constructor stub - } - -} diff --git a/src/java/net/java/games/sound3d/Source.java b/src/java/net/java/games/sound3d/Source.java index 5e4183d..f5655be 100644 --- a/src/java/net/java/games/sound3d/Source.java +++ b/src/java/net/java/games/sound3d/Source.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT @@ -85,7 +85,7 @@ public final class Source { * Delete this source, freeing its resources. */ public void delete() { - al.alDeleteSources(1, new int[] { sourceID }); + al.alDeleteSources(1, new int[] { sourceID }, 0); } /** @@ -106,7 +106,7 @@ public final class Source { */ public float getPitch() { float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_PITCH, result); + al.alGetSourcef(sourceID, AL.AL_PITCH, result, 0); return result[0]; } @@ -129,7 +129,7 @@ public final class Source { */ public float getGain() { float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_GAIN, result); + al.alGetSourcef(sourceID, AL.AL_GAIN, result, 0); return result[0]; } @@ -152,7 +152,7 @@ public final class Source { */ public float getMaxDistance() { float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_MAX_DISTANCE, result); + al.alGetSourcef(sourceID, AL.AL_MAX_DISTANCE, result, 0); return result[0]; } @@ -173,7 +173,7 @@ public final class Source { */ public float getRolloffFactor() { float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_ROLLOFF_FACTOR, result); + al.alGetSourcef(sourceID, AL.AL_ROLLOFF_FACTOR, result, 0); return result[0]; } @@ -196,7 +196,7 @@ public final class Source { */ public float getReferenceDistance() { float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_REFERENCE_DISTANCE, result); + al.alGetSourcef(sourceID, AL.AL_REFERENCE_DISTANCE, result, 0); return result[0]; } @@ -217,7 +217,7 @@ public final class Source { */ public float getMinGain() { float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_MIN_GAIN, result); + al.alGetSourcef(sourceID, AL.AL_MIN_GAIN, result, 0); return result[0]; } @@ -238,7 +238,7 @@ public final class Source { */ public float getMaxGain() { float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_MAX_GAIN, result); + al.alGetSourcef(sourceID, AL.AL_MAX_GAIN, result, 0); return result[0]; } @@ -259,7 +259,7 @@ public final class Source { */ public float getConeOuterGain() { float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_CONE_OUTER_GAIN, result); + al.alGetSourcef(sourceID, AL.AL_CONE_OUTER_GAIN, result, 0); return result[0]; } @@ -299,7 +299,7 @@ public final class Source { public Vec3f getPosition() { Vec3f result = null; float[] pos = new float[3]; - al.alGetSourcefv(sourceID, AL.AL_POSITION, pos); + al.alGetSourcefv(sourceID, AL.AL_POSITION, pos, 0); result = new Vec3f(pos[0], pos[1], pos[2]); return result; @@ -338,7 +338,7 @@ public final class Source { public Vec3f getVelocity() { Vec3f result = null; float[] vel = new float[3]; - al.alGetSourcefv(sourceID, AL.AL_VELOCITY, vel); + al.alGetSourcefv(sourceID, AL.AL_VELOCITY, vel, 0); result = new Vec3f(vel[0], vel[1], vel[2]); return result; @@ -377,7 +377,7 @@ public final class Source { public Vec3f getDirection() { Vec3f result = null; float[] dir = new float[3]; - al.alGetSourcefv(sourceID, AL.AL_DIRECTION, dir); + al.alGetSourcefv(sourceID, AL.AL_DIRECTION, dir, 0); result = new Vec3f(dir[0], dir[1], dir[2]); return result; @@ -404,7 +404,7 @@ public final class Source { */ public boolean isSourceRelative() { int[] result = new int[1]; - al.alGetSourcei(sourceID, AL.AL_SOURCE_RELATIVE, result); + al.alGetSourcei(sourceID, AL.AL_SOURCE_RELATIVE, result, 0); return result[0] == 1; } @@ -427,7 +427,7 @@ public final class Source { public boolean getLooping() { boolean result = false; int[] tmp = new int[1]; - al.alGetSourcei(sourceID, AL.AL_LOOPING, tmp); + al.alGetSourcei(sourceID, AL.AL_LOOPING, tmp, 0); return tmp[0] == AL.AL_TRUE; } @@ -438,7 +438,7 @@ public final class Source { */ public int getBuffersQueued() { int[] result = new int[1]; - al.alGetSourcei(sourceID, AL.AL_BUFFERS_QUEUED, result); + al.alGetSourcei(sourceID, AL.AL_BUFFERS_QUEUED, result, 0); return result[0]; } @@ -449,7 +449,7 @@ public final class Source { */ public int getBuffersProcessed() { int[] result = new int[1]; - al.alGetSourcei(sourceID, AL.AL_BUFFERS_PROCESSED, result); + al.alGetSourcei(sourceID, AL.AL_BUFFERS_PROCESSED, result, 0); return result[0]; } @@ -487,7 +487,7 @@ public final class Source { arr[i] = buffers[i].bufferID; } - al.alSourceQueueBuffers(sourceID, numBuffers, arr); + al.alSourceQueueBuffers(sourceID, numBuffers, arr, 0); } /** @@ -503,6 +503,6 @@ public final class Source { arr[i] = buffers[i].bufferID; } - al.alSourceUnqueueBuffers(sourceID, numBuffers, arr); + al.alSourceUnqueueBuffers(sourceID, numBuffers, arr, 0); } } diff --git a/src/java/net/java/games/sound3d/Vec3f.java b/src/java/net/java/games/sound3d/Vec3f.java index f6f494b..71b1d92 100644 --- a/src/java/net/java/games/sound3d/Vec3f.java +++ b/src/java/net/java/games/sound3d/Vec3f.java @@ -18,7 +18,7 @@ * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS +* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT diff --git a/src/native/albind.c b/src/native/albind.c deleted file mode 100644 index 023f235..0000000 --- a/src/native/albind.c +++ /dev/null @@ -1,720 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - - -#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 deleted file mode 100644 index fd64846..0000000 --- a/src/native/albind.h +++ /dev/null @@ -1,703 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - - -/* 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 deleted file mode 100644 index af5b2af..0000000 --- a/src/native/alcbind.c +++ /dev/null @@ -1,235 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - - -#include "alcbind.h" -#include "extal.h" - -JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_alcGetErrorNative - (JNIEnv *env, jobject obj, jint pointer) { - return alcGetError((ALCdevice*)pointer); -} - -/* -JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_openDeviceNative - (JNIEnv *env, jobject obj, jstring deviceName) { - printf("Entering openDeviceNative()\n"); - printf("In openDeviceNative() test 1\n"); - jint result; - ALubyte *str; - ALCdevice *device; - if(deviceName != NULL) { - printf("In openDeviceNative() test 2a.1\n"); - str = (ALubyte*)(*env)->GetStringUTFChars(env,deviceName,NULL); - printf("In openDeviceNative() test 2a.2 -- %i\n", *alcOpenDevice); - device = alcOpenDevice(str); - printf("In openDeviceNative() test 2a.3 -- %s - %i\n", str, (jint)device); - (*env)->ReleaseStringUTFChars(env,deviceName,str); - } else { - printf("In openDeviceNative() test 2b.1\n"); - device = alcOpenDevice(NULL); - printf("In openDeviceNative() test 2b.2 -- NULL - %i\n", (jint)device); - } - result = (jint)device; - printf("In openDeviceNative() test 3\n"); - printf("Exiting openDeviceNative()\n"); - return result; -} -*/ -JNIEXPORT jobject JNICALL Java_net_java_games_joal_ALCImpl_openDeviceNative - (JNIEnv *env, jobject obj, jstring deviceName) { - const char * tokenstring; - - jboolean isCopy = JNI_FALSE; - if(deviceName != NULL) { - tokenstring = ((*env)->GetStringUTFChars(env, deviceName, &isCopy)); - } else { - tokenstring = NULL; - } - - /* get device */ - ALCdevice* device = alcOpenDevice((ALubyte *) tokenstring); - - /* if error - cleanup and get out */ - if(device == NULL) { - if(tokenstring != NULL) { - // (*env)->ReleaseStringUTFChars(env, deviceName, tokenstring); - } - return NULL; - } - - /* get ready to create ALCdevice instance */ - jobject alcDevice_object = NULL; - jclass alcDevice_class = NULL; - jmethodID alcDevice_method = NULL; - - /* find class and constructor */ - alcDevice_class = (*env)->FindClass(env, "net/java/games/joal/ALC$Device"); - alcDevice_method = (*env)->GetMethodID(env, alcDevice_class, "", "(I)V"); - - /* create instance */ - alcDevice_object = (*env)->NewObject(env, alcDevice_class, alcDevice_method, (int) device); - - /* clean up */ - if (tokenstring != NULL) - // (*env)->ReleaseStringUTFChars(env, deviceName, tokenstring); - - return alcDevice_object; -} - -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; - } else { - jint ctxPtr = (jint)alcCreateContext(device,NULL); - return ctxPtr; - } -} -*/ - -JNIEXPORT jobject JNICALL Java_net_java_games_joal_ALCImpl_createContextNative - (JNIEnv *env, jobject obj, jint deviceAddress, jintArray attrs) { - ALint* address = NULL; - - if(attrs != NULL) { - address = (ALint*)(*env)->GetPrimitiveArrayCritical(env,attrs,0); - } - ALCcontext* context = alcCreateContext((ALCdevice*)deviceAddress, address); - if(address != NULL) { - (*env)->ReleasePrimitiveArrayCritical(env,attrs,address,0); - } - /* if error - get out */ - if(context == NULL) { - return NULL; - } - - /* get ready to create ALCcontext instance */ - jobject alcContext_object = NULL; - jclass alcContext_class = NULL; - jmethodID alcContext_method = NULL; - - /* find class and constructor */ - alcContext_class = (*env)->FindClass(env, "net/java/games/joal/ALC$Context"); - alcContext_method = (*env)->GetMethodID(env, alcContext_class, "", "(Lnet/java/games/joal/ALC;I)V"); - - /* create instance */ - alcContext_object = (*env)->NewObject(env, alcContext_class, alcContext_method, obj, (int) context); - - return alcContext_object; -} - - -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 deleted file mode 100644 index 911940b..0000000 --- a/src/native/alcbind.h +++ /dev/null @@ -1,160 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ -#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: openDeviceNative - * Signature: (Ljava/lang/String;)I - */ -JNIEXPORT jobject 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); -*/ -JNIEXPORT jobject 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_alcGetErrorNative - (JNIEnv *, jobject, jint pointer); - -/* - * 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 deleted file mode 100644 index a497c0c..0000000 --- a/src/native/alfactory.c +++ /dev/null @@ -1,50 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - -#include "alfactory.h" -#include "extal.h" -#include "jni.h" - -JNIEXPORT jboolean JNICALL Java_net_java_games_joal_ALFactory_init - (JNIEnv *env , jclass clazz, jobjectArray oalPaths) { - printf("ALFactory.init - Native: Enter\n"); - InitializeOpenAL(env,oalPaths); - printf("ALFactory.init - Native: Exit\n"); - return 1; -} - -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 deleted file mode 100644 index 48c301c..0000000 --- a/src/native/alfactory.h +++ /dev/null @@ -1,66 +0,0 @@ -/** -* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* -Redistribution of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* -* -Redistribution in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* -* This software is provided "AS IS," without a warranty of any kind. -* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING -* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS -* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A -* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. -* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT -* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR -* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS -* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -* -* You acknowledge that this software is not designed or intended for use in the -* design, construction, operation or maintenance of any nuclear facility. -*/ - - -/* 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 deleted file mode 100644 index 0d26f42..0000000 --- a/src/native/build.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/native/common_tools.c b/src/native/common_tools.c deleted file mode 100644 index c38b4b3..0000000 --- a/src/native/common_tools.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ - -/** - * $Id$ - * - * @author elias_naur - * @version $Revision$ - */ - -#include "common_tools.h" - -static void incListStart(event_queue_t *queue) { - queue->list_start = (queue->list_start + 1)%EVENT_BUFFER_SIZE; -} - -void initEventQueue(event_queue_t *event_queue) { - event_queue->list_start = 0; - event_queue->list_end = 0; -} - -void putEventElement(event_queue_t *queue, unsigned char byte) { - int next_index = (queue->list_end + 1)%EVENT_BUFFER_SIZE; - if (next_index == queue->list_start) { -#ifdef _DEBUG - printf("Event buffer overflow!\n"); -#endif - return; - } - queue->input_event_buffer[queue->list_end] = byte; - queue->list_end = next_index; -} - -static int hasMoreEvents(event_queue_t *queue) { - return queue->list_start != queue->list_end; -} - -static void copyEvent(event_queue_t *queue, int event_size, int event_index) { - int output_index = event_index*event_size; - int i; - for (i = 0; i < event_size; i++) { - queue->output_event_buffer[output_index] = queue->input_event_buffer[queue->list_start]; - incListStart(queue); - output_index++; - } -} - -int copyEvents(event_queue_t *event_queue, int event_size) { - int num_events = 0; - while (hasMoreEvents(event_queue)) { - copyEvent(event_queue, event_size, num_events); - num_events++; - } - return num_events; -} - -unsigned char *getOutputList(event_queue_t *queue) { - return queue->output_event_buffer; -} - -int getEventBufferSize(event_queue_t *event_queue) { - return EVENT_BUFFER_SIZE; -} - -static void throwGeneralException(JNIEnv * env, const char *exception_name, const char * err) { - jclass cls = (*env)->FindClass(env,exception_name); - (*env)->ThrowNew(env,cls, err); - (*env)->DeleteLocalRef(env,cls); -} - -void throwOpenALException(JNIEnv * env, const char * err) { - throwGeneralException(env, "net/java/games/joal/OpenALException", err); -} - -void throwException(JNIEnv * env, const char * err) { - throwGeneralException(env, "java/lang/Exception", err); -} diff --git a/src/native/common_tools.h b/src/native/common_tools.h deleted file mode 100644 index 2298728..0000000 --- a/src/native/common_tools.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - -/** - * $Id$ - * - * @author elias_naur - * @version $Revision$ - */ - -#ifndef _COMMON_TOOLS_H -#define _COMMON_TOOLS_H - -#include - -// Must be x * max_event_size + 1 -#define EVENT_BUFFER_SIZE (25 * 4 + 1) - -typedef struct { - unsigned char input_event_buffer[EVENT_BUFFER_SIZE]; - unsigned char output_event_buffer[EVENT_BUFFER_SIZE]; - - int list_start; - int list_end; -} event_queue_t; - -extern void initEventQueue(event_queue_t *event_queue); -extern int copyEvents(event_queue_t *event_queue, int event_size); -extern void putEventElement(event_queue_t *queue, unsigned char byte); -extern unsigned char *getOutputList(event_queue_t *queue); -extern int getEventBufferSize(event_queue_t *event_queue); -extern void throwException(JNIEnv *env, const char *msg); -extern void throwOpenALException(JNIEnv * env, const char * err); - -#endif diff --git a/src/native/eaxbind.c b/src/native/eaxbind.c index b0d05e8..6b17a66 100644 --- a/src/native/eaxbind.c +++ b/src/native/eaxbind.c @@ -33,7 +33,7 @@ #include "eaxbind.h" -#include "extal.h" +#include "eax.h" #ifdef _WIN32 const GUID DSPROPSETID_EAX20_ListenerProperties = { 0x306a6a8, 0xb224, 0x11d2, { 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22 } }; diff --git a/src/native/eaxfactory.c b/src/native/eaxfactory.c index 708ddda..d0e3e9d 100644 --- a/src/native/eaxfactory.c +++ b/src/native/eaxfactory.c @@ -33,7 +33,13 @@ #include "eaxfactory.h" -#include "extal.h" +#include "al.h" +#include "eax.h" + +#ifdef _WIN32 +EAXSet eaxSet; // EAXSet function, ret$ +EAXGet eaxGet; // EAXGet function, ret$ +#endif /* * had some problems getting this from extal.h diff --git a/src/native/extal.c b/src/native/extal.c deleted file mode 100644 index 45947dc..0000000 --- a/src/native/extal.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * 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 "stdio.h" -#include "extal.h" -#include "common_tools.h" - -#ifdef _X11 -#include "dlfcn.h" -#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; -#endif -#ifdef _X11 -void* handleOAL; -#endif -#ifdef _AGL -#include "mach-o/dyld.h" -#include "stdlib.h" -#include "string.h" -const struct mach_header* handleOAL; -#endif - -/* Loads OpenAL */ -static int LoadOpenAL(JNIEnv *env, jobjectArray oalPaths); - -/* Unloads OpenAL */ -static void UnLoadOpenAL(void); - -/* Gets a pointer to the named function */ -static void* GetFunctionPointer(const char* function); - -/* Loads OpenAL basic functions */ -static int LoadAL(void); - -/* Loads OpenAL ALC functions */ -static int LoadALC(void); - -/* Loads any extensions to OpenAL */ -static int LoadALExtensions(void); - -static void *NativeGetFunctionPointer(const char *function) { -#ifdef _WIN32 - return GetProcAddress(handleOAL, function); -#endif -#ifdef _X11 - return dlsym(handleOAL, function); -#endif -#ifdef _AGL - char *mac_symbol_name = (char *)malloc((strlen(function) + 2)*sizeof(char)); - if (mac_symbol_name == NULL) - return NULL; - mac_symbol_name[0] = '_'; - strcpy(&(mac_symbol_name[1]), function); - NSSymbol symbol = NSLookupSymbolInImage(handleOAL, mac_symbol_name, NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); - free(mac_symbol_name); - if (symbol == NULL) - return NULL; - return NSAddressOfSymbol(symbol); -#endif -} - -/** - * Retrieves a pointer to the named function - * - * @param function Name of function - * @return pointer to named function, or NULL if not found - */ -static void* GetFunctionPointer(const char* function) { - void *p = NativeGetFunctionPointer(function); - if (p == NULL) { -#ifdef _DEBUG - printf("Could not locate symbol %s\n", function); -#endif - } - return p; -} - -/** - * Loads the OpenAL Library - */ -static int LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { - - jsize pathcount = (*env)->GetArrayLength(env,oalPaths); -#ifdef _DEBUG - printf("Found %d OpenAL paths\n", (int)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 -#ifdef _AGL - handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR); -#endif - if (handleOAL != NULL) { -#ifdef _DEBUG - printf("Found OpenAL at '%s'\n", path_str); -#endif - return 1; - } - (*env)->ReleaseStringUTFChars(env,path, path_str); - } - throwOpenALException(env, "Could not load openal library."); - return 0; -} - -/** - * Unloads the OpenAL Library - */ -static void UnLoadOpenAL() { -#ifdef _WIN32 - FreeLibrary(handleOAL); -#endif -#ifdef _X11 - dlclose(handleOAL); -#endif -#ifdef _AGL - // Cannot remove the image -#endif -} - -/** - * Initializes OpenAL by loading the library - */ -void InitializeOpenAL(JNIEnv *env, jobjectArray oalPaths) { - if(handleOAL != NULL) { - return; - } - - //load our library - if (!LoadOpenAL(env, oalPaths)) { - return; - } - - //load basic OpenAL functions - if(!LoadAL()) { - throwOpenALException(env, "Could not load OpenAL function pointers."); - return; - } - - //load OpenAL context functions - if(!LoadALC()) { - throwOpenALException(env, "Could not load ALC function pointers."); - return; - } - - //load OpenAL extensions - if(!LoadALExtensions()) { - throwOpenALException(env, "Could not load AL extension function pointers."); - return; - } -} - -/** - * 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 - */ -static int LoadAL() { - alEnable = (alEnablePROC) GetFunctionPointer("alEnable"); - alDisable = (alDisablePROC) GetFunctionPointer("alDisable"); - alIsEnabled = (alIsEnabledPROC) GetFunctionPointer("alIsEnabled"); - //alHint = (alHintPROC) GetFunctionPointer("alHint"); - //alGetintean = (alGetinteanPROC) GetFunctionPointer("alGetintean"); - alGetInteger = (alGetIntegerPROC) GetFunctionPointer("alGetInteger"); - alGetFloat = (alGetFloatPROC) GetFunctionPointer("alGetFloat"); - alGetDouble = (alGetDoublePROC) GetFunctionPointer("alGetDouble"); - //alGetinteanv = (alGetinteanvPROC) GetFunctionPointer("alGetinteanv"); - 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 && - //alGetintean != NULL && - alGetInteger != NULL && - alGetFloat != NULL && - alGetDouble != NULL && - //alGetinteanv != 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 - */ -static 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 - */ -static int LoadALExtensions() { - return 1; -} diff --git a/src/native/extal.h b/src/native/extal.h deleted file mode 100644 index 361c2d7..0000000 --- a/src/native/extal.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - * 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 _AL_TEST_H -#define _AL_TEST_H - -#ifdef _WIN32 -#include "windows.h" -#endif - -#ifdef _X11 -#include "AL/altypes.h" -#include "AL/alctypes.h" -#endif -#ifdef _WIN32 -#include "altypes.h" -#include "alctypes.h" -#endif -#ifdef _AGL -#include "OpenAL/alctypes.h" -#include "OpenAL/altypes.h" -#endif - -#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 _AGL - #if _AGL - typedef struct ALCdevice_struct ALCdevice; - typedef struct ALCcontext_struct ALCcontext; - - #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 - #define ALAPI - #define ALAPIENTRY - #define AL_CALLBACK -#endif - -#ifdef _WIN32 -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); -#endif - -#define INITGUID -#define OPENAL - -void InitializeOpenAL(JNIEnv *env, jobjectArray oalPaths); -void DeInitializeOpenAL(); - -//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