From 94da74c81232da0582aa5b2720c5ea3d88a6bf61 Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Mon, 19 Aug 2002 01:10:00 +0000 Subject: [PATCH] add: more al methods (work in progress) --- src/java/org/lwjgl/openal/CoreAL.java | 332 +++++++++++++++++++++++--- 1 file changed, 303 insertions(+), 29 deletions(-) diff --git a/src/java/org/lwjgl/openal/CoreAL.java b/src/java/org/lwjgl/openal/CoreAL.java index db0bf03f..2c01c9c6 100644 --- a/src/java/org/lwjgl/openal/CoreAL.java +++ b/src/java/org/lwjgl/openal/CoreAL.java @@ -47,11 +47,58 @@ public class CoreAL extends BaseAL implements BaseALConstants { } /** - * Retrieve the current error state and then clears the error state. + * Enables a feature of the OpenAL driver. * - * @return current error state + * @param capability name of a capability to enable */ - public native int getError(); + public native void enable(int capability); + + /** + * Disables a feature of the OpenAL driver. + * + * @param capability name of a capability to disable + */ + public native void disable(int capability); + + /** + * Checks if a specific feature is enabled in the OpenAL driver. + * + * @param capability name of a capability to check + * @return true if named feature is enabled + */ + public native boolean isEnabled(int capability); + + /** + * Returns a boolean OpenAL state. + * + * @param parameter state to be queried + * @return boolean state described by pname will be returned. + */ + public native boolean getBoolean(int pname); + + /** + * Returns an int OpenAL state. + * + * @param parameter state to be queried + * @return int state described by pname will be returned. + */ + public native int getInteger(int pname); + + /** + * Returns a float OpenAL state. + * + * @param parameter state to be queried + * @return float state described by pname will be returned. + */ + public native float getFloat(int pname); + + /** + * Returns a double OpenAL state. + * + * @param parameter state to be queried + * @return double state described by pname will be returned. + */ + public native double getDouble(int pname); /** * Retrieve an OpenAL string property. @@ -59,8 +106,212 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param param The property to be returned * @return OpenAL String property */ - public native String getString(int param); + public native String getString(int param); + /** + * Retrieve the current error state and then clears the error state. + * + * @return current error state + */ + public native int getError(); + + /** + * Test if a specific extension is available for the OpenAL driver. + * + * @param fname String describing the desired extension + * @return true if extension is available, false if not + */ + public native boolean isExtensionPresent(String fname); + + /** + * Returns the address of an OpenAL extension function. + * + * @param fname String containing the function name + * @return int specifying offset of extension + */ + public native int getProcAddress(String fname); + + /** + * Returns the enumeration value of an OpenAL enum described by a string. + * + * @param ename String describing an OpenAL enum + * @return Actual int for the described enumeration name + */ + public native int getEnumValue(String ename); + + /** + * Sets an integer property of the listener + * + * @param pname name of the attribute to be set + * @param integer value to set the attribute to + */ + public native void listeneri(int pname, int value); + + /** + * Sets a floating point property of the listener + * + * @param pname name of the attribute to be set + * @param value floating point value to set the attribute to + */ + public native void listenerf(int pname, float value); + + /** + * Sets a floating point property of the listener + * + * @param pname name of the attribute to be set + * @param v1 value value 1 + * @param v2 value value 2 + * @param v3 float value 3 + */ + public native void listener3f(int pname, float v1, float v2, float v3); + + /** + * Gets an integer property of the listener. + * + * @param pname name of the attribute to be retrieved + * @return integer value of property + */ + public native int getListeneri(int pname); + + /** + * Gets a floating point property of the listener. + * + * @param pname name of the attribute to be retrieved + * @return floating point value of property + */ + public native float getListenerf(int pname); + + /** + * Generate one or more sources. + * + * @param n number of sources to generate + * @param sources array holding sources + */ + public native void genSources(int n, int[] sources); + + /** + * Delete one or more sources. + * + * @param n Number of sources to delete + * @param source Source array to delete from + */ + public native void deleteSources(int n, int[] source); + + /** + * Tests if a source is valid. + * + * @param id id of source to be testes for validity + * @return true if id is valid, false if not + */ + public native boolean isSource(int id); + + /** + * Set an integer property of a source. + * + * @param source Source to det property on + * @param param property to set + * @param value value of property + */ + public native void sourcei(int source, int param, int value); + + /** + * Set a floating point property of a source. + * + * @param source Source to det property on + * @param param property to set + * @param value value of property + */ + public native void sourcef(int source, int param, float value); + + /** + * Sets a source property requiring three floating point values. + * + * @param source Source to det property on + * @param param property to set + * @param v1 value 1 of property + * @param v2 value 2 of property + * @param v3 value 3 of property + */ + public native void source3f(int source, int param, float v1, float v2, float v3); + + /** + * Retrieves an integer property of a source. + * + * @param source source to get property from + * @param pname name of property + * @return integer value of pname + */ + public native int getSourcei(int source, int param); + + /** + * Retrieves a floating point property of a source. + * + * @param source source to get property from + * @param pname name of property + * @return integer value of pname + */ + public native float getSourcef(int source, int param); + + /** + * Plays a set of sources. + * + * @param n number of sources to play + * @param source array of sources to play + */ + public native void sourcePlayv(int n, int[] sources); + + /** + * Pauses a set of sources. + * + * @param n number of sources to pause + * @param source array of sources to pause + */ + public native void sourcePausev(int n, int[] sources); + + /** + * Stops a set of sources. + * + * @param n number of sources to stop + * @param source array of sources to stop + */ + public native void sourceStopv(int n, int[] sources); + + /** + * Rewinds a set of sources. + * + * @param n number of sources to rewind + * @param source array of sources to rewind + */ + public native void sourceRewindv(int n, int[] sources); + + /** + * Play a source. + * + * @param source Source to play + */ + public native void sourcePlay(int source); + + /** + * Pauses a source. + * + * @param source Source to pause + */ + public native void sourcePause(int source); + + /** + * Stops a source. + * + * @param source Source to stop + */ + public native void sourceStop(int source); + + /** + * Rewinds a source. + * + * @param source Source to rewind + */ + public native void sourceRewind(int source); + /** * Generate one or more buffers. * @@ -70,12 +321,20 @@ public class CoreAL extends BaseAL implements BaseALConstants { public native void genBuffers(int n, int[] buffers); /** - * Generate one or more sources. + * Delete one or more buffers. * - * @param n number of sources to generate - * @param sources array holding sources + * @param n Number of buffers to delete + * @param buffers Buffer array to delete from */ - public native void genSources(int n, int[] sources); + public native void deleteBuffers(int n, int[] buffers); + + /** + * Tests if buffer is valid. + * + * @param buffer buffer to be tested for validity + * @return true if supplied buffer is valid, false if not + */ + public native boolean isBuffer(int buffer); /** * Fill a buffer with audio data. @@ -89,42 +348,57 @@ public class CoreAL extends BaseAL implements BaseALConstants { public native void bufferData(int buffer, int format, int data, int size, int freq); /** - * Set an integer property of a source. + * Queues a set of buffers on a source. * - * @param source Source to det property on - * @param param property to set - * @param value value of property + * @param source source to queue buffers onto + * @param n number of buffers to be queued + * @param buffers buffers to be queued */ - public native void sourcei(int source, int param, int value); + public native void sourceQueueBuffers(int source, int n, int[] buffers); /** - * Play a source. + * Unqueues a set of buffers attached to a source. * - * @param source Source to play - */ - public native void sourcePlay(int source); + * @param source source to unqueue buffers from + * @param n number of buffers to be unqueued + * @param buffers buffers to be unqueued + */ + public native void sourceUnqueueBuffers(int source, int n, int[] buffers); /** - * Stops a source. + * Selects the OpenAL distance model. * - * @param source Source to stop + * @param value distance model to be set */ - public native void sourceStop(int source); + public native void distanceModel(int value); /** - * Delete one or more sources. + * Selects the OpenAL Doppler factor value. * - * @param n Number of sources to delete - * @param source Source array to delete from + * @param value Doppler scale value to set */ - public native void deleteSources(int n, int[] source); - + public native void dopplerFactor(float value); /** - * Delete one or more buffers. + * Selects the OpenAL Doppler velocity value. * - * @param n Number of buffers to delete - * @param buffers Buffer array to delete from + * @param value Doppler velocity value to set */ - public native void deleteBuffers(int n, int[] buffers); + public native void dopplerVelocity(float value); + + //non implemented methods: + //=========================================== + //public native void getBooleanv(int pname, boolean* data); + //public native void fetIntegerv(int pname, int* data); + //public native void getFloatv(int pname, float* data); + //public native void getDoublev(int pname, double* data); + //public native float listenerfv(int pname, float* values); + //public native void getListener3f(int pname, ALfloat* v1, ALfloat* v2, ALfloat* v3); + //public native void getListenerfv(int pname, ALfloat* values); + //public native void hint(int target, int mode); + //public native void sourcefv(int source, int param, ALfloat* values); + //public native void getSource3f(int source, int param, ALfloat* v1, ALfloat* v2, ALfloat* v3 ; + //public native void getSourcefv(int source, int param, ALfloat* values); + //public native void getBufferi(int buffer, int param, ALint* value); + //public native void getBufferf(int buffer, int param, ALfloat* value); }