Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv21877a/java/org/lwjgl/openal Modified Files: AL.java ALC.java ALCcontext.java ALCdevice.java BaseAL.java BaseALConstants.java CoreAL.java Log Message: New OpenAL programming model: no context/device fiddling easier initialization Index: AL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/AL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/AL.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- AL.java 21 Dec 2002 12:37:19 -0000 1.4 +++ AL.java 27 Apr 2003 18:37:37 -0000 1.5 @@ -13,7 +13,7 @@ * 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 + * * Neither the name of 'Lightweight 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. * @@ -29,7 +29,9 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.openal; +package org.lwjgl.openal; + +import org.lwjgl.Sys; /** * $Id$ @@ -40,10 +42,69 @@ * @version $Revision$ */ public class AL extends CoreAL { + + /** ALC instance. */ + protected ALC alc; + + /** ALCdevice instance. */ + protected ALCdevice device; + + /** Current ALCcontext. */ + protected ALCcontext context; + + /** + * String that requests a certain device or device configuration. + * If null is specified, the implementation will provide an + * implementation specific default. */ + protected String deviceArguments; + + /** Frequency for mixing output buffer, in units of Hz. */ + protected int contextFrequency; + + /** Refresh intervalls, in units of Hz. */ + protected int contextRefresh; + + /** Flag, indicating a synchronous context. */ + protected int contextSynchronized; + + /** + * Creates an OpenAL instance + * + * @param deviceArguments Arguments supplied to native device + * @param contextFrequency Frequency for mixing output buffer, in units of Hz (Common values include 11025, 22050, and 44100). + * @param contextRefresh Refresh intervalls, in units of Hz. + * @param contextSynchronized Flag, indicating a synchronous context.* + */ + public AL(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized) { + this.deviceArguments = deviceArguments; + this.contextFrequency = contextFrequency; + this.contextRefresh = contextRefresh; + this.contextSynchronized = contextSynchronized ? ALC.TRUE : ALC.FALSE; + } + + + /** + * @see org.lwjgl.openal.BaseAL#create() + */ + public void create() throws OpenALException { + super.create(); - /** - * Nothing to se here - please move along - */ - public AL() { - } + alc = new ALC(this); + alc.create(); + + device = alc.openDevice(deviceArguments); + + context = alc.createContext(device.device, + Sys.getDirectBufferAddress( + ALCcontext.createAttributeList(contextFrequency, contextRefresh, contextSynchronized))); + + alc.makeContextCurrent(context.context); + } + + /** + * Retrieves the AL Context class + */ + public ALC getALC() { + return alc; + } } Index: ALC.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALC.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALC.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ALC.java 21 Dec 2002 12:37:19 -0000 1.6 +++ ALC.java 27 Apr 2003 18:37:37 -0000 1.7 @@ -13,7 +13,7 @@ * 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 + * * Neither the name of 'Lightweight 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. * @@ -42,230 +42,251 @@ */ public class ALC { /** Has the ALC object been created? */ - protected static boolean created; - - /** Bad value */ - public static final int INVALID = -1; - - /** Boolean False */ - public static final int FALSE = 0; - - /** Boolean True */ - public static final int TRUE = 1; - - /** Errors: No Error */ - public static final int NO_ERROR = FALSE; - - public static final int MAJOR_VERSION = 0x1000; - public static final int MINOR_VERSION = 0x1001; - public static final int ATTRIBUTES_SIZE = 0x1002; - public static final int ALL_ATTRIBUTES = 0x1003; - - public static final int DEFAULT_DEVICE_SPECIFIER = 0x1004; - public static final int DEVICE_SPECIFIER = 0x1005; - public static final int EXTENSIONS = 0x1006; - - public static final int FREQUENCY = 0x1007; - public static final int REFRESH = 0x1008; - public static final int SYNC = 0x1009; - - /** The device argument does not name a valid device */ - public static final int INVALID_DEVICE = 0xA001; - - /** The context argument does not name a valid context */ - public static final int 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 static final int INVALID_ENUM = 0xA003; - - /** - * Illegal value passed as an argument to an AL call. - * Applies to parameter values, but not to enumerations. - */ - public static final int INVALID_VALUE = 0xA004; - - /** - * A function could not be completed, because there is not enough - * memory available. - */ - public static final int OUT_OF_MEMORY = 0xA005; - + protected static boolean created; + + /** Parent AL instance */ + protected AL al = null; + + /** Bad value */ + public static final int INVALID = -1; + + /** Boolean False */ + public static final int FALSE = 0; + + /** Boolean True */ + public static final int TRUE = 1; + + /** Errors: No Error */ + public static final int NO_ERROR = FALSE; + + public static final int MAJOR_VERSION = 0x1000; + public static final int MINOR_VERSION = 0x1001; + public static final int ATTRIBUTES_SIZE = 0x1002; + public static final int ALL_ATTRIBUTES = 0x1003; + + public static final int DEFAULT_DEVICE_SPECIFIER = 0x1004; + public static final int DEVICE_SPECIFIER = 0x1005; + public static final int EXTENSIONS = 0x1006; + + public static final int FREQUENCY = 0x1007; + public static final int REFRESH = 0x1008; + public static final int SYNC = 0x1009; + + /** The device argument does not name a valid device */ + public static final int INVALID_DEVICE = 0xA001; + + /** The context argument does not name a valid context */ + public static final int 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 static final int INVALID_ENUM = 0xA003; + + /** + * Illegal value passed as an argument to an AL call. + * Applies to parameter values, but not to enumerations. + */ + public static final int INVALID_VALUE = 0xA004; + + /** + * A function could not be completed, because there is not enough + * memory available. + */ + public static final int OUT_OF_MEMORY = 0xA005; + static { initialize(); } - - /** Creates a new instance of ALC */ - public ALC() { - } - - /** - * Override to provide any initialization code after creation. - */ + + /** Creates a new instance of ALC */ + protected ALC(AL al) { + this.al = al; + } + + /** + * Override to provide any initialization code after creation. + */ protected void init() { } - + /** * Static initialization */ private static void initialize() { System.loadLibrary(org.lwjgl.Sys.getLibraryName()); } - - /** - * Creates the ALC instance - * - * @throws Exception if a failiure occured in the ALC creation process - */ - public void create() throws Exception { + + /** + * Creates the ALC instance + * + * @throws Exception if a failiure occured in the ALC creation process + */ + protected void create() throws OpenALException { if (created) { return; - } - + } + if (!nCreate()) { - throw new Exception("ALC instance could not be created."); - } - created = true; - init(); + throw new OpenALException("ALC instance could not be created."); + } + init(); + created = true; } - + /** * Native method to create ALC instance * * @return true if the ALC creation process succeeded */ protected native boolean nCreate(); - + /** * Calls whatever destruction rutines that are needed */ - public void destroy() { + protected void destroy() { if (!created) { return; - } - created = false; - nDestroy(); + } + created = false; + nDestroy(); } - + /** * Native method the destroy the ALC */ - protected native void nDestroy(); - - /** - * Returns strings related to the context. - * - * @param device ALCdevice to query - * @param pname Property to get - * @return String property from device - */ - public native String getString(ALCdevice device, int pname); - - /** - * Returns integers related to the context. - * - * @param device ALCdevice to query - * @param pname Property to get - * @param size Size of destination buffer provided - * @param integerdata address of ByteBuffer to write integers to - */ - public native void getIntegerv(ALCdevice device, int pname, int size, int integerdata); - - /** - * Opens the named device. If null is specied, the implementation will - * provide an implementation specic default. - * - * @param devicename name of device to open - * @return opened device, or null - */ - public native ALCdevice openDevice(String devicename); - - /** - * Closes the supplied device. - * - * @param device ALCdevice to close - */ - public native void closeDevice(ALCdevice device); - - /** - * Creates a context using a specified device. - * - * @param device ALCdevice to associate context to - * @param attrList address of ByteBuffer to read attributes from - * @return New context, or null if creation failed - */ - public native ALCcontext createContext(ALCdevice device, int attrList); - - /** - * Makes the supplied context the current one - * - * @param context ALCcontext to make current - * @return true if successfull, false if not - */ - public native boolean makeContextCurrent(ALCcontext context); - - /** - * Tells a context to begin processing. - * - * @param context context that should begin processing - */ - public native void processContext(ALCcontext context); - - /** - * Gets the current context - * - * @return Current ALCcontext - */ - public native ALCcontext getCurrentContext(); - - /** - * Retrives the device associated with the supplied context - * - * @param context ALCcontext to get device for - * @param ALCdevice associated with context - */ - public native ALCdevice getContextsDevice(ALCcontext context); - - /** - * Suspends processing on supplied context - * - * @param context ALCcontext to suspend - */ - public native void suspendContext(ALCcontext context); - - /** - * Destroys supplied context - * - * @param context ALCcontext to Destroy - */ - public native void destroyContext(ALCcontext context); - - /** - * Retrieves the current context error state. - * - * @param device ALDdevice associated with context - * @return Errorcode from ALC statemachine - */ - public native int getError(ALCdevice device); - - /** - * Query if a specified context extension is available. - * - * @param device device to query for extension - * @param extName name of extension to find - * @return true if extension is available, false if not - */ - public native boolean isExtensionPresent(ALCdevice device, String extName); + protected native void nDestroy(); + + /** + * Returns strings related to the context. + * + * @param pname Property to get + * @return String property from device + */ + public String getString(int pname) { + return nGetString(al.device.device, pname); + } + + native String nGetString(int device, int pname); + + /** + * Returns integers related to the context. + * + * @param pname Property to get + * @param size Size of destination buffer provided + * @param integerdata address of ByteBuffer to write integers to + */ + public void getIntegerv(int pname, int size, int integerdata) { + nGetIntegerv(al.device.device, pname, size, integerdata); + } - /** - * retrieves the enum value for a specified enumeration name. - * - * @param device Device to query - * @param enumName name of enum to find - * @return value of enumeration - */ - public native int getEnumValue(ALCdevice device, String enumName); + native void nGetIntegerv(int device, int pname, int size, int integerdata); + + /** + * Opens the named device. If null is specied, the implementation will + * provide an implementation specic default. + * + * @param devicename name of device to open + * @return opened device, or null + */ + native ALCdevice openDevice(String devicename); + + /** + * Closes the supplied device. + * + * @param device address of native device to close + */ + native void closeDevice(int device); + + /** + * Creates a context using a specified device. + * + * @param device address of device to associate context to + * @param attrList address of ByteBuffer to read attributes from + * @return New context, or null if creation failed + */ + native ALCcontext createContext(int device, int attrList); + + /** + * Makes the supplied context the current one + * + * @param context address of context to make current + * @return true if successfull, false if not + */ + native boolean makeContextCurrent(int context); + + /** + * Tells a context to begin processing. + */ + public void processContext() { + nProcessContext(al.context.context); + } + + native void nProcessContext(int context); + + /** + * Gets the current context + * + * @return Current ALCcontext + */ + native ALCcontext getCurrentContext(); + + /** + * Retrives the device associated with the supplied context + * + * @param context address of context to get device for + * @param ALCdevice associated with context + */ + native ALCdevice getContextsDevice(int context); + + /** + * Suspends processing on supplied context + * + * @param context address of context to suspend + */ + native void suspendContext(int context); + + /** + * Destroys supplied context + * + * @param context address of context to Destroy + */ + native void destroyContext(int context); + + /** + * Retrieves the current context error state. + * + * @return Errorcode from ALC statemachine + */ + public int getError() { + return nGetError(al.device.device); + } + + native int nGetError(int device); + + /** + * Query if a specified context extension is available. + * + * @param extName name of extension to find + * @return true if extension is available, false if not + */ + public boolean isExtensionPresent(String extName) { + return nIsExtensionPresent(al.device.device, extName); + } + + native boolean nIsExtensionPresent(int device, String extName); + + /** + * retrieves the enum value for a specified enumeration name. + * + * @param enumName name of enum to find + * @return value of enumeration + */ + public int getEnumValue(String enumName) { + return nGetEnumValue(al.device.device, enumName); + } + + native int nGetEnumValue(int device, String enumName); } Index: ALCcontext.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ALCcontext.java 21 Dec 2002 12:37:19 -0000 1.2 +++ ALCcontext.java 27 Apr 2003 18:37:37 -0000 1.3 @@ -13,7 +13,7 @@ * 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 + * * Neither the name of 'Lightweight 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. * @@ -29,7 +29,10 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.openal; +package org.lwjgl.openal; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; /** * $Id$ @@ -39,7 +42,7 @@ * @author Brian Matzon <br...@ma...> * @version $Revision$ */ -public class ALCcontext { +class ALCcontext { /** address of actual context */ public final int context; @@ -51,5 +54,19 @@ */ public ALCcontext(int context) { this.context = context; - } -} + } + + public static ByteBuffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) { + ByteBuffer attribList = ByteBuffer.allocateDirect(7*4).order(ByteOrder.nativeOrder()); + + attribList.putInt(ALC.FREQUENCY); + attribList.putInt(contextFrequency); + attribList.putInt(ALC.REFRESH); + attribList.putInt(contextRefresh); + attribList.putInt(ALC.SYNC); + attribList.putInt(contextSynchronized); + attribList.putInt(0); //terminating int + + return attribList; + } +} \ No newline at end of file Index: ALCdevice.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ALCdevice.java 21 Dec 2002 12:37:19 -0000 1.2 +++ ALCdevice.java 27 Apr 2003 18:37:37 -0000 1.3 @@ -13,7 +13,7 @@ * 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 + * * Neither the name of 'Lightweight 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. * @@ -29,7 +29,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.openal; +package org.lwjgl.openal; /** * $Id$ @@ -39,7 +39,7 @@ * @author Brian Matzon <br...@ma...> * @version $Revision$ */ -public class ALCdevice { +class ALCdevice { /** address of actual device */ public final int device; @@ -52,4 +52,4 @@ public ALCdevice(int device) { this.device = device; } -} +} \ No newline at end of file Index: BaseAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- BaseAL.java 7 Apr 2003 15:21:09 -0000 1.8 +++ BaseAL.java 27 Apr 2003 18:37:37 -0000 1.9 @@ -47,83 +47,87 @@ * @version $Revision$ */ public abstract class BaseAL { - /** Has the ALC object been created? */ - protected static boolean created; - - static { - initialize(); - } - - /** - * Override to provide any initialization code after creation. - */ - protected void init() throws Exception { - } - - /** - * Static initialization - */ - private static void initialize() { - System.loadLibrary(org.lwjgl.Sys.getLibraryName()); - } - - /** - * Creates the AL instance - * - * @throws Exception if a failiure occured in the AL creation process - */ - public void create() throws Exception { - if (created) { - return; - } - - // need to pass path of possible locations of OAL to native side - String libpath = System.getProperty("java.library.path"); - String seperator = System.getProperty("path.separator"); - String libname; - - // libname is hardcoded atm - this will change in a near future... - libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) ? "libopenal.so" : "OpenAL32.dll"; - - StringTokenizer st = new StringTokenizer(libpath, seperator); - - //create needed string array - String[] oalPaths = new String[st.countTokens() + 1]; + /** Have we been created? */ + protected static boolean created; + + static { + initialize(); + } + + /** + * Override to provide any initialization code after creation. + */ + protected void init() throws OpenALException { + } + + /** + * Static initialization + */ + private static void initialize() { + System.loadLibrary(org.lwjgl.Sys.getLibraryName()); + } + + /** + * Creates the AL instance + * + * @throws Exception if a failiure occured in the AL creation process + */ + public void create() throws OpenALException { + if (created) { + return; + } - //build paths - for (int i = 0; i < oalPaths.length - 1; i++) { - oalPaths[i] = st.nextToken() + File.separator + libname; - } + // need to pass path of possible locations of OAL to native side + String libpath = System.getProperty("java.library.path"); + String seperator = System.getProperty("path.separator"); + String libname; - //add cwd path - oalPaths[oalPaths.length - 1] = libname; - if (!nCreate(oalPaths)) { - throw new Exception("AL instance could not be created."); - } - init(); - created = true; - } + // libname is hardcoded atm - this will change in a near future... + libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) + ? "libopenal.so" + : "OpenAL32.dll"; - /** - * Native method to create AL instance - * - * @return true if the AL creation process succeeded - */ - protected native boolean nCreate(String[] oalPaths); + StringTokenizer st = new StringTokenizer(libpath, seperator); + + //create needed string array + String[] oalPaths = new String[st.countTokens()+1]; - /** - * Calls whatever destruction rutines that are needed - */ - public void destroy() { - if (!created) { - return; - } - created = false; - nDestroy(); - } + //build paths + for(int i=0;i<oalPaths.length - 1;i++) { + oalPaths[i] = st.nextToken() + File.separator + libname; + } - /** - * Native method the destroy the AL - */ - protected native void nDestroy(); -} + //add cwd path + oalPaths[oalPaths.length-1] = libname; + if (!nCreate(oalPaths)) { + throw new OpenALException("AL instance could not be created."); + } + + init(); + created = true; + } + + /** + * Native method to create AL instance + * + * @param oalPaths Array of strings containing paths to search for OpenAL library + * @return true if the AL creation process succeeded + */ + protected native boolean nCreate(String[] oalPaths); + + /** + * Calls whatever destruction rutines that are needed + */ + public void destroy() { + if (!created) { + return; + } + created = false; + nDestroy(); + } + + /** + * Native method the destroy the AL + */ + protected native void nDestroy(); +} \ No newline at end of file Index: BaseALConstants.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseALConstants.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseALConstants.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- BaseALConstants.java 21 Dec 2002 12:37:19 -0000 1.4 +++ BaseALConstants.java 27 Apr 2003 18:37:37 -0000 1.5 @@ -81,7 +81,7 @@ /** * Specify the pitch to be applied, either at source, - * or on mixer results, at listener. + * or on mixer results, at listener. * Range: [0.5-2.0] * Default: 1.0 */ @@ -90,11 +90,11 @@ /** * 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). + * 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. + * sign on the Z coordinate. * Listener position is always in the world coordinate system. */ public static final int POSITION = 0x1004; @@ -128,8 +128,8 @@ * 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. + * scale; it is interpreted as zero volume - the channel + * is effectively disabled. */ public static final int GAIN = 0x100A; @@ -179,8 +179,8 @@ * 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. + * scale; it is interpreted as zero volume - the channel + * is effectively disabled. */ public static final int CONE_OUTER_GAIN = 0x1022; @@ -234,40 +234,40 @@ /** * 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. + * sample frequency marks the maximum significant + * frequency component. */ public static final int 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. + * sample frequency marks the maximum significant + * frequency component. */ public static final int 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. + * sample frequency marks the maximum significant + * frequency component. */ public static final int 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. + * sample frequency marks the maximum significant + * frequency component. */ public static final int 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. + * sample frequency marks the maximum significant + * frequency component. */ public static final int DATA = 0x2005; @@ -295,14 +295,10 @@ /** Errors: No Error. */ public static final int NO_ERROR = FALSE; - /** - * Illegal name passed as an argument to an AL call. - */ + /** Illegal name passed as an argument to an AL call. */ public static final int INVALID_NAME = 0xA001; - /** - * Illegal enum passed as an argument to an AL call. - */ + /** Illegal enum passed as an argument to an AL call. */ public static final int INVALID_ENUM = 0xA002; /** @@ -337,19 +333,13 @@ /** Context strings: Extensions */ public static final int EXTENSIONS = 0xB004; - /** - * Doppler scale. Default 1.0 - */ + /** Doppler scale. Default 1.0 */ public static final int DOPPLER_FACTOR = 0xC000; - /** - * Doppler velocity. Default 1.0 - */ + /** Doppler velocity. Default 1.0 */ public static final int DOPPLER_VELOCITY = 0xC001; - /** - * Distance model. Default INVERSE_DISTANCE_CLAMPED - */ + /** Distance model. Default INVERSE_DISTANCE_CLAMPED */ public static final int DISTANCE_MODEL = 0xD000; /** Distance model */ Index: CoreAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/CoreAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/CoreAL.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- CoreAL.java 21 Dec 2002 12:37:19 -0000 1.11 +++ CoreAL.java 27 Apr 2003 18:37:37 -0000 1.12 @@ -41,444 +41,455 @@ * @version $Revision$ */ public class CoreAL extends BaseAL implements BaseALConstants { - - /** Creates a new instance of CoreAL */ - public CoreAL() { - } - - /** - * Enables a feature of the OpenAL driver. - * - * @param capability name of a capability to enable - */ - 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); - - /** - * Hinting for implementation - * NOTE: This method is a NOP, but is provided for completeness. - * - * @param target FIXME - * @param mode FIXME - */ - public native void hint(int target, int mode); - - /** - * 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); - - /** - * Returns a boolean OpenAL state. - * - * @param parameter state to be queried - * @param data address of ByteBuffer to place the booleans in - */ - public native void getBooleanv(int pname, int data); - - /** - * Returns an integer OpenAL state. - * - * @param parameter state to be queried - * @param data address of ByteBuffer to place the integers in - */ - public native void getIntegerv(int pname, int data); - - /** - * Returns a floating point OpenAL state. - * - * @param parameter state to be queried - * @param data address of ByteBuffer to place the floats in - */ - public native void getFloatv(int pname, int data); - - /** - * Returns a double OpenAL state. - * - * @param parameter state to be queried - * @param data address of ByteBuffer to place the floats in - */ - public native void getDoublev(int pname, int data); - - /** - * Retrieve an OpenAL string property. - * - * @param pname The property to be returned - * @return OpenAL String property - */ - public native String getString(int pname); - - /** - * Retrieve the current error state and then clears the error state. - * - * @return current error state - */ - public native int getError(); + /** Creates a new instance of CoreAL */ + public CoreAL() { + super(); + } - /** - * 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 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); - - /** - * Sets a floating point vector property of the listener - * - * @param pname name of the attribute to be set - * @param floatdata bytebuffer address to read floats from - */ - public native void listenerfv(int pname, int floatdata); - - /** - * Gets an integer property of the listener. - * - * @param pname name of the attribute to be retrieved - * @param integerdata bytebuffer address to write integer to - */ - public native void getListeneri(int pname, int integerdata); - - /** - * Gets a floating point property of the listener. - * - * @param pname name of the attribute to be retrieved - * @param floatdata bytebuffer address to write float to - */ - public native void getListenerf(int pname, int floatdata); - - /** - * Retrieves a set of three floating point values from a - * property of the listener. - * - * @param pname name of the attribute to be retrieved - * @param v1 bytebuffer address to write float 1 to - * @param v2 bytebuffer address to write float 2 to - * @param v3 bytebuffer address to write float 3 to - */ - public native void getListener3f(int pname, int v1, int v2, int v3); - - /** - * Retrieves a floating point vector property of the listener. - * - * @param pname name of the attribute to be retrieved - * @param floatdata bytebuffer address to write floats to - */ - public native void getListenerfv(int pname, int floatdata); - - /** - * 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); + /** + * Enables a feature of the OpenAL driver. + * + * @param capability name of a capability to enable + */ + public native void enable(int capability); - /** - * 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 pname property to set - * @param value value of property - */ - public native void sourcei(int source, int pname, int value); - - /** - * Set a floating point property of a source. - * - * @param source Source to det property on - * @param pname property to set - * @param value value of property - */ - public native void sourcef(int source, int pname, float value); - - /** - * Sets a source property requiring three floating point values. - * - * @param source Source to set property on - * @param pname 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 pname, float v1, float v2, float v3); - - /** - * Sets a floating point vector property of a source. - * - * @param source source whichs attribute is being set - * @param pname name of the attribute being set - * @param floatdata bytebuffer address to read floats from - */ - public native void sourcefv(int source, int pname, int floatdata); - - /** - * Retrieves an integer property of a source. - * - * @param source source to get property from - * @param pname name of property - * @param integerdata bytebuffer address to write integer to - */ - public native void getSourcei(int source, int pname, int integerdata); - - /** - * Retrieves a floating point property of a source. - * - * @param source source to get property from - * @param pname name of property - * @param floatdata bytebuffer address to write float to - */ - public native void getSourcef(int source, int pname, int floatdata); - - /** - * Gets a floating point vector property from a Source object. - * - * @param source Source to get property from - * @param pname property to get - * @param floatdata bytebuffer address to write floats to - */ - public native void getSourcefv(int source, int pname, int floatdata); - - /** - * 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); + /** + * Disables a feature of the OpenAL driver. + * + * @param capability name of a capability to disable + */ + public native void disable(int capability); - /** - * 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); + /** + * 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); - /** - * 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); + /** + * Hinting for implementation + * NOTE: This method is a NOP, but is provided for completeness. + * + * @param target FIXME + * @param mode FIXME + */ + public native void hint(int target, int mode); - /** - * 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); + /** + * 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); - /** - * Generate one or more buffers. - * - * @param n number of buffers to generate - * @param buffers array holding buffers - */ - public native void genBuffers(int n, int buffers); - - /** - * Delete one or more buffers. - * - * @param n Number of buffers to delete - * @param buffers Buffer array to delete from - */ - 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. - * - * @param buffer Buffer to fill - * @param format format sound data is in - * @param data location of data (pointer) - * @param size size of data segment - * @param freq frequency of data - */ - public native void bufferData(int buffer, int format, int data, int size, int freq); - - /** - * Retrieves an integer property from a buffer. - * - * @param buffer buffer to get property from - * @param pname name of property to retrieve - * @param integerdata bytebuffer address to write integer to - */ - public native void getBufferi(int buffer, int pname, int integerdata); + /** + * 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); - /** - * Retrieves a floating point property from a buffer. - * - * @param buffer buffer to get property from - * @param pname name of property to retrieve - * @param floatdata bytebuffer address to write float to - */ - public native void getBufferf(int buffer, int pname, int floatdata); - - /** - * Queues a set of buffers on a source. - * - * @param source source to queue buffers onto - * @param n number of buffers to be queued - * @param buffers buffers to be queued - */ - public native void sourceQueueBuffers(int source, int n, int buffers); - - /** - * Unqueues a set of buffers attached to a 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); - - /** - * Selects the OpenAL distance model. - * - * @param value distance model to be set - */ - public native void distanceModel(int value); - - /** - * Selects the OpenAL Doppler factor value. - * - * @param value Doppler scale value to set - */ - public native void dopplerFactor(float value); - - /** - * Selects the OpenAL Doppler velocity value. - * - * @param value Doppler velocity value to set - */ - public native void dopplerVelocity(float value); + /** + * 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); + + /** + * Returns a boolean OpenAL state. + * + * @param parameter state to be queried + * @param data address of ByteBuffer to place the booleans in + */ + public native void getBooleanv(int pname, int data); + + /** + * Returns an integer OpenAL state. + * + * @param parameter state to be queried + * @param data address of ByteBuffer to place the integers in + */ + public native void getIntegerv(int pname, int data); + + /** + * Returns a floating point OpenAL state. + * + * @param parameter state to be queried + * @param data address of ByteBuffer to place the floats in + */ + public native void getFloatv(int pname, int data); + + /** + * Returns a double OpenAL state. + * + * @param parameter state to be queried + * @param data address of ByteBuffer to place the floats in + */ + public native void getDoublev(int pname, int data); + + /** + * Retrieve an OpenAL string property. + * + * @param pname The property to be returned + * @return OpenAL String property + */ + public native String getString(int pname); + + /** + * 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 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); + + /** + * Sets a floating point vector property of the listener + * + * @param pname name of the attribute to be set + * @param floatdata bytebuffer address to read floats from + */ + public native void listenerfv(int pname, int floatdata); + + /** + * Gets an integer property of the listener. + * + * @param pname name of the attribute to be retrieved + * @param integerdata bytebuffer address to write integer to + */ + public native void getListeneri(int pname, int integerdata); + + /** + * Gets a floating point property of the listener. + * + * @param pname name of the attribute to be retrieved + * @param floatdata bytebuffer address to write float to + */ + public native void getListenerf(int pname, int floatdata); + + /** + * Retrieves a set of three floating point values from a + * property of the listener. + * + * @param pname name of the attribute to be retrieved + * @param v1 bytebuffer address to write float 1 to + * @param v2 bytebuffer address to write float 2 to + * @param v3 bytebuffer address to write float 3 to + */ + public native void getListener3f(int pname, int v1, int v2, int v3); + + /** + * Retrieves a floating point vector property of the listener. + * + * @param pname name of the attribute to be retrieved + * @param floatdata bytebuffer address to write floats to + */ + public native void getListenerfv(int pname, int floatdata); + + /** + * 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 pname property to set + * @param value value of property + */ + public native void sourcei(int source, int pname, int value); + + /** + * Set a floating point property of a source. + * + * @param source Source to det property on + * @param pname property to set + * @param value value of property + */ + public native void sourcef(int source, int pname, float value); + + /** + * Sets a source property requiring three floating point values. + * + * @param source Source to set property on + * @param pname 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 pname, + float v1, + float v2, + float v3); + + /** + * Sets a floating point vector property of a source. + * + * @param source source whichs attribute is being set + * @param pname name of the attribute being set + * @param floatdata bytebuffer address to read floats from + */ + public native void sourcefv(int source, int pname, int floatdata); + + /** + * Retrieves an integer property of a source. + * + * @param source source to get property from + * @param pname name of property + * @param integerdata bytebuffer address to write integer to + */ + public native void getSourcei(int source, int pname, int integerdata); + + /** + * Retrieves a floating point property of a source. + * + * @param source source to get property from + * @param pname name of property + * @param floatdata bytebuffer address to write float to + */ + public native void getSourcef(int source, int pname, int floatdata); + + /** + * Gets a floating point vector property from a Source object. + * + * @param source Source to get property from + * @param pname property to get + * @param floatdata bytebuffer address to write floats to + */ + public native void getSourcefv(int source, int pname, int floatdata); + + /** + * 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. + * + * @param n number of buffers to generate + * @param buffers array holding buffers + */ + public native void genBuffers(int n, int buffers); + + /** + * Delete one or more buffers. + * + * @param n Number of buffers to delete + * @param buffers Buffer array to delete from + */ + 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. + * + * @param buffer Buffer to fill + * @param format format sound data is in + * @param data location of data (pointer) + * @param size size of data segment + * @param freq frequency of data + */ + public native void bufferData( + int buffer, + int format, + int data, + int size, + int freq); + + /** + * Retrieves an integer property from a buffer. + * + * @param buffer buffer to get property from + * @param pname name of property to retrieve + * @param integerdata bytebuffer address to write integer to + */ + public native void getBufferi(int buffer, int pname, int integerdata); + + /** + * Retrieves a floating point property from a buffer. + * + * @param buffer buffer to get property from + * @param pname name of property to retrieve + * @param floatdata bytebuffer address to write float to + */ + public native void getBufferf(int buffer, int pname, int floatdata); + + /** + * Queues a set of buffers on a source. + * + * @param source source to queue buffers onto + * @param n number of buffers to be queued + * @param buffers buffers to be queued + */ + public native void sourceQueueBuffers(int source, int n, int buffers); + + /** + * Unqueues a set of buffers attached to a 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); + + /** + * Selects the OpenAL distance model. + * + * @param value distance model to be set + */ + public native void distanceModel(int value); + + /** + * Selects the OpenAL Doppler factor value. + * + * @param value Doppler scale value to set + */ + public native void dopplerFactor(float value); + + /** + * Selects the OpenAL Doppler velocity value. + * + * @param value Doppler velocity value to set + */ + public native void dopplerVelocity(float value); } |