diff --git a/src/java/org/lwjgl/openal/AL.java b/src/java/org/lwjgl/openal/AL.java index b980b22c..28f2c65a 100644 --- a/src/java/org/lwjgl/openal/AL.java +++ b/src/java/org/lwjgl/openal/AL.java @@ -31,8 +31,6 @@ */ package org.lwjgl.openal; -import org.lwjgl.Sys; - /** * $Id$ * @@ -44,106 +42,90 @@ import org.lwjgl.Sys; public class AL extends CoreAL { /** ALC instance. */ - protected ALC alc; + protected static ALC alc; /** ALCdevice instance. */ - protected ALCdevice device; + protected static ALCdevice device; /** Current ALCcontext. */ - protected ALCcontext context; + protected static 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; + protected static String deviceArguments; /** Frequency for mixing output buffer, in units of Hz. */ - protected int contextFrequency = -1; + protected static int contextFrequency = -1; /** Refresh intervalls, in units of Hz. */ - protected int contextRefresh = -1; + protected static int contextRefresh = -1; /** Flag, indicating a synchronous context. */ - protected int contextSynchronized = ALC.FALSE; + protected static int contextSynchronized = ALC.ALC_FALSE; - /** - * Creates an OpenAL instance. The empty constructor will cause OpenAL to - * open the default device, and create a context using default values. - */ - public AL() { - } + /** + * Creates an OpenAL instance. Using this constructor will cause OpenAL to + * open the device using supplied device argument, and create a context using the context values + * supplied. + * + * @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 static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized) throws OpenALException { + AL.deviceArguments = deviceArguments; + AL.contextFrequency = contextFrequency; + AL.contextRefresh = contextRefresh; + AL.contextSynchronized = contextSynchronized ? ALC.ALC_TRUE : ALC.ALC_FALSE; + + create(); + } - /** - * Creates an OpenAL instance. Using this constructor will cause OpenAL to - * open the device using supplied device argument, and create a context using the context values - * supplied. - * - * @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(); + /** + * Creates an OpenAL instance. The empty create will cause OpenAL to + * open the default device, and create a context using default values. + */ + public static void create() throws OpenALException { + BaseAL.create(); + + ALC.create(); - alc = new ALC(this); - alc.create(); - - device = alc.openDevice(deviceArguments); + device = ALC.alcOpenDevice(deviceArguments); //check if doing default values or not if (contextFrequency == -1) { - context = alc.createContext(device.device, 0); + context = ALC.alcCreateContext(device.device, null); } else { context = - alc.createContext( + ALC.alcCreateContext( device.device, - Sys.getDirectBufferAddress( - ALCcontext.createAttributeList(contextFrequency, contextRefresh, contextSynchronized))); + ALCcontext.createAttributeList(contextFrequency, contextRefresh, contextSynchronized)); } - alc.makeContextCurrent(context.context); + ALC.alcMakeContextCurrent(context.context); } /** * Exit cleanly by calling destroy. */ - public void destroy() { - alc.destroyContext(context.context); - alc.closeDevice(device.device); - alc.destroy(); + public static void destroy() { + ALC.alcDestroyContext(context.context); + ALC.alcCloseDevice(device.device); + ALC.destroy(); - alc = null; device = null; context = null; - super.destroy(); - } - - /** - * Emergency finalizer! - */ - protected void finalize() throws Throwable { - super.finalize(); - - destroy(); - } + deviceArguments = null; - /** - * Retrieves the AL Context class - */ - public final ALC getALC() { - return alc; + contextFrequency = -1; + contextRefresh = -1; + contextSynchronized = ALC.ALC_FALSE; + + BaseAL.destroy(); } } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/ALC.java b/src/java/org/lwjgl/openal/ALC.java index 2e9e7cb8..22218ace 100644 --- a/src/java/org/lwjgl/openal/ALC.java +++ b/src/java/org/lwjgl/openal/ALC.java @@ -31,6 +31,8 @@ */ package org.lwjgl.openal; +import java.nio.Buffer; + /** * $Id$ * @@ -44,72 +46,68 @@ public class ALC { /** Has the ALC object been created? */ protected static boolean created; - /** Parent AL instance */ - protected AL al = null; - /** Bad value */ - public static final int INVALID = -1; + public static final int ALC_INVALID = -1; /** Boolean False */ - public static final int FALSE = 0; + public static final int ALC_FALSE = 0; /** Boolean True */ - public static final int TRUE = 1; + public static final int ALC_TRUE = 1; /** Errors: No Error */ - public static final int NO_ERROR = FALSE; + public static final int ALC_NO_ERROR = ALC_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 ALC_MAJOR_VERSION = 0x1000; + public static final int ALC_MINOR_VERSION = 0x1001; + public static final int ALC_ATTRIBUTES_SIZE = 0x1002; + public static final int ALC_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 ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004; + public static final int ALC_DEVICE_SPECIFIER = 0x1005; + public static final int ALC_EXTENSIONS = 0x1006; - public static final int FREQUENCY = 0x1007; - public static final int REFRESH = 0x1008; - public static final int SYNC = 0x1009; + public static final int ALC_FREQUENCY = 0x1007; + public static final int ALC_REFRESH = 0x1008; + public static final int ALC_SYNC = 0x1009; /** The device argument does not name a valid device */ - public static final int INVALID_DEVICE = 0xA001; + public static final int ALC_INVALID_DEVICE = 0xA001; /** The context argument does not name a valid context */ - public static final int INVALID_CONTEXT = 0xA002; + public static final 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 static final int INVALID_ENUM = 0xA003; + public static final int ALC_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; + public static final int ALC_INVALID_VALUE = 0xA004; /** * A function could not be completed, because there is not enough * memory available. */ - public static final int OUT_OF_MEMORY = 0xA005; + public static final int ALC_OUT_OF_MEMORY = 0xA005; static { initialize(); } /** Creates a new instance of ALC */ - protected ALC(AL al) { - this.al = al; + protected ALC() { } /** * Override to provide any initialization code after creation. */ - protected void init() { + protected static void init() { } /** @@ -124,7 +122,7 @@ public class ALC { * * @throws Exception if a failiure occured in the ALC creation process */ - protected void create() throws OpenALException { + protected static void create() throws OpenALException { if (created) { return; } @@ -141,12 +139,12 @@ public class ALC { * * @return true if the ALC creation process succeeded */ - protected native boolean nCreate(); + protected static native boolean nCreate(); /** * Calls whatever destruction rutines that are needed */ - protected void destroy() { + protected static void destroy() { if (!created) { return; } @@ -157,7 +155,7 @@ public class ALC { /** * Native method the destroy the ALC */ - protected native void nDestroy(); + protected static native void nDestroy(); /** * Returns strings related to the context. @@ -165,24 +163,24 @@ public class ALC { * @param pname Property to get * @return String property from device */ - public String getString(int pname) { - return nGetString(al.device.device, pname); + public static String alcGetString(int pname) { + return nGetString(AL.device.device, pname); } - native String nGetString(int device, int pname); + native static 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 + * @param integerdata ByteBuffer to write integers to */ - public void getIntegerv(int pname, int size, int integerdata) { - nGetIntegerv(al.device.device, pname, size, integerdata); + public static void alcGetIntegerv(int pname, int size, Buffer integerdata) { + nGetIntegerv(AL.device.device, pname, size, integerdata); } - native void nGetIntegerv(int device, int pname, int size, int integerdata); + native static void nGetIntegerv(int device, int pname, int size, Buffer integerdata); /** * Opens the named device. If null is specied, the implementation will @@ -191,23 +189,23 @@ public class ALC { * @param devicename name of device to open * @return opened device, or null */ - native ALCdevice openDevice(String devicename); + native static ALCdevice alcOpenDevice(String devicename); /** * Closes the supplied device. * * @param device address of native device to close */ - native void closeDevice(int device); + native static void alcCloseDevice(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 + * @param attrList Buffer to read attributes from * @return New context, or null if creation failed */ - native ALCcontext createContext(int device, int attrList); + native static ALCcontext alcCreateContext(int device, Buffer attrList); /** * Makes the supplied context the current one @@ -215,23 +213,23 @@ public class ALC { * @param context address of context to make current * @return true if successfull, false if not */ - native boolean makeContextCurrent(int context); + native static boolean alcMakeContextCurrent(int context); /** * Tells a context to begin processing. */ - public void processContext() { - nProcessContext(al.context.context); + public static void alcProcessContext() { + nProcessContext(AL.context.context); } - native void nProcessContext(int context); + native static void nProcessContext(int context); /** * Gets the current context * * @return Current ALCcontext */ - native ALCcontext getCurrentContext(); + native static ALCcontext alcGetCurrentContext(); /** * Retrives the device associated with the supplied context @@ -239,32 +237,32 @@ public class ALC { * @param context address of context to get device for * @param ALCdevice associated with context */ - native ALCdevice getContextsDevice(int context); + native static ALCdevice alcGetContextsDevice(int context); /** * Suspends processing on supplied context * * @param context address of context to suspend */ - native void suspendContext(int context); + native static void alcSuspendContext(int context); /** * Destroys supplied context * * @param context address of context to Destroy */ - native void destroyContext(int context); + native static void alcDestroyContext(int context); /** * Retrieves the current context error state. * * @return Errorcode from ALC statemachine */ - public int getError() { - return nGetError(al.device.device); + public static int alcGetError() { + return nGetError(AL.device.device); } - native int nGetError(int device); + native static int nGetError(int device); /** * Query if a specified context extension is available. @@ -272,11 +270,11 @@ public class ALC { * @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); + public static boolean alcIsExtensionPresent(String extName) { + return nIsExtensionPresent(AL.device.device, extName); } - native boolean nIsExtensionPresent(int device, String extName); + native static boolean nIsExtensionPresent(int device, String extName); /** * retrieves the enum value for a specified enumeration name. @@ -284,9 +282,9 @@ public class ALC { * @param enumName name of enum to find * @return value of enumeration */ - public int getEnumValue(String enumName) { - return nGetEnumValue(al.device.device, enumName); + public static int alcGetEnumValue(String enumName) { + return nGetEnumValue(AL.device.device, enumName); } - native int nGetEnumValue(int device, String enumName); + native static int nGetEnumValue(int device, String enumName); } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/ALCcontext.java b/src/java/org/lwjgl/openal/ALCcontext.java index 56f5212d..45ba1cf1 100644 --- a/src/java/org/lwjgl/openal/ALCcontext.java +++ b/src/java/org/lwjgl/openal/ALCcontext.java @@ -31,6 +31,7 @@ */ package org.lwjgl.openal; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -42,28 +43,28 @@ import java.nio.ByteOrder; * @author Brian Matzon * @version $Revision$ */ -class ALCcontext { +final class ALCcontext { /** address of actual context */ - public final int context; + final int context; /** * Creates a new instance of ALCcontext * * @param context address of actual context */ - public ALCcontext(int context) { + ALCcontext(int context) { this.context = context; } - public static ByteBuffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) { + static Buffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) { ByteBuffer attribList = ByteBuffer.allocateDirect(7*4).order(ByteOrder.nativeOrder()); - attribList.putInt(ALC.FREQUENCY); + attribList.putInt(ALC.ALC_FREQUENCY); attribList.putInt(contextFrequency); - attribList.putInt(ALC.REFRESH); + attribList.putInt(ALC.ALC_REFRESH); attribList.putInt(contextRefresh); - attribList.putInt(ALC.SYNC); + attribList.putInt(ALC.ALC_SYNC); attribList.putInt(contextSynchronized); attribList.putInt(0); //terminating int diff --git a/src/java/org/lwjgl/openal/ALCdevice.java b/src/java/org/lwjgl/openal/ALCdevice.java index fbcbdd16..786c680f 100644 --- a/src/java/org/lwjgl/openal/ALCdevice.java +++ b/src/java/org/lwjgl/openal/ALCdevice.java @@ -39,17 +39,17 @@ package org.lwjgl.openal; * @author Brian Matzon * @version $Revision$ */ -class ALCdevice { +final class ALCdevice { /** address of actual device */ - public final int device; + final int device; /** * Creates a new instance of ALCdevice * * @param device address of actual device */ - public ALCdevice(int device) { + ALCdevice(int device) { this.device = device; } } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/BaseAL.java b/src/java/org/lwjgl/openal/BaseAL.java index 277b979e..878af1e0 100644 --- a/src/java/org/lwjgl/openal/BaseAL.java +++ b/src/java/org/lwjgl/openal/BaseAL.java @@ -60,7 +60,7 @@ public abstract class BaseAL { /** * Override to provide any initialization code after creation. */ - protected void init() throws OpenALException { + protected static void init() throws OpenALException { } /** @@ -75,7 +75,7 @@ public abstract class BaseAL { * * @throws Exception if a failiure occured in the AL creation process */ - public void create() throws OpenALException { + public static void create() throws OpenALException { if (created) { return; } @@ -133,7 +133,7 @@ public abstract class BaseAL { * @param libname Name of library to search for * @return Absolute path to library if found, otherwise null */ - private String getPathFromJWS(String libname) { + private static String getPathFromJWS(String libname) { try { if(Sys.DEBUG) { @@ -162,12 +162,12 @@ public abstract class BaseAL { * @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); + protected static native boolean nCreate(String[] oalPaths); /** * Calls whatever destruction rutines that are needed */ - public void destroy() { + public static void destroy() { if (!created) { return; } @@ -178,5 +178,5 @@ public abstract class BaseAL { /** * Native method the destroy the AL */ - protected native void nDestroy(); + protected static native void nDestroy(); } diff --git a/src/java/org/lwjgl/openal/BaseALConstants.java b/src/java/org/lwjgl/openal/BaseALConstants.java index e30ca436..3b39a944 100644 --- a/src/java/org/lwjgl/openal/BaseALConstants.java +++ b/src/java/org/lwjgl/openal/BaseALConstants.java @@ -42,42 +42,42 @@ package org.lwjgl.openal; public interface BaseALConstants { /** Bad value */ - public static final int INVALID = -1; + public static final int AL_INVALID = -1; /** Disable value */ - public static final int NONE = 0; + public static final int AL_NONE = 0; /** Boolean False */ - public static final int FALSE = 0; + public static final int AL_FALSE = 0; /** Boolean True */ - public static final int TRUE = 1; + public static final int AL_TRUE = 1; /** * Indicate the type of SOURCE. * Sources can be spatialized */ - public static final int SOURCE_TYPE = 0x200; + public static final int AL_SOURCE_TYPE = 0x200; /** Indicate source has absolute coordinates */ - public static final int SOURCE_ABSOLUTE = 0x201; + public static final int AL_SOURCE_ABSOLUTE = 0x201; /** Indicate Source has listener relative coordinates */ - public static final int SOURCE_RELATIVE = 0x202; + public static final int AL_SOURCE_RELATIVE = 0x202; /** * Directional source, inner cone angle, in degrees * Range: [0-360] * Default: 360 */ - public static final int CONE_INNER_ANGLE = 0x1001; + 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 CONE_OUTER_ANGLE = 0x1002; + public static final int AL_CONE_OUTER_ANGLE = 0x1002; /** * Specify the pitch to be applied, either at source, @@ -85,7 +85,7 @@ public interface BaseALConstants { * Range: [0.5-2.0] * Default: 1.0 */ - public static final int PITCH = 0x1003; + public static final int AL_PITCH = 0x1003; /** * Specify the current location in three dimensional space. @@ -97,13 +97,13 @@ public interface BaseALConstants { * sign on the Z coordinate. * Listener position is always in the world coordinate system. */ - public static final int POSITION = 0x1004; + public static final int AL_POSITION = 0x1004; /** Specify the current direction as forward vector. */ - public static final int DIRECTION = 0x1005; + public static final int AL_DIRECTION = 0x1005; /** Specify the current velocity in three dimensional space. */ - public static final int VELOCITY = 0x1006; + public static final int AL_VELOCITY = 0x1006; /** * Indicate whether source has to loop infinite. @@ -111,14 +111,14 @@ public interface BaseALConstants { * Range: [TRUE, FALSE] * Default: FALSE */ - public static final int LOOPING = 0x1007; + 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 BUFFER = 0x1009; + public static final int AL_BUFFER = 0x1009; /** * Indicate the gain (volume amplification) applied. @@ -131,28 +131,28 @@ public interface BaseALConstants { * scale; it is interpreted as zero volume - the channel * is effectively disabled. */ - public static final int GAIN = 0x100A; + public static final int AL_GAIN = 0x100A; /** * Indicate minimum source attenuation. * Type: ALfloat * Range: [0.0 - 1.0] */ - public static final int MIN_GAIN = 0x100D; + public static final int AL_MIN_GAIN = 0x100D; /** * Indicate maximum source attenuation. * Type: ALfloat * Range: [0.0 - 1.0] */ - public static final int MAX_GAIN = 0x100E; + public static final int AL_MAX_GAIN = 0x100E; /** * Specify the current orientation. * Type: ALfv6 (at/up) * Range: N/A */ - public static final int ORIENTATION = 0x100F; + 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. @@ -161,7 +161,7 @@ public interface BaseALConstants { * Range: [0.0 - ] * Default: 1.0 */ - public static final int REFERENCE_DISTANCE = 0x1020; + public static final int AL_REFERENCE_DISTANCE = 0x1020; /** * Indicate the rolloff factor for the source. @@ -169,7 +169,7 @@ public interface BaseALConstants { * Range: [0.0 - ] * Default: 1.0 */ - public static final int ROLLOFF_FACTOR = 0x1021; + public static final int AL_ROLLOFF_FACTOR = 0x1021; /** * Indicate the gain (volume amplification) applied. @@ -182,54 +182,54 @@ public interface BaseALConstants { * scale; it is interpreted as zero volume - the channel * is effectively disabled. */ - public static final int CONE_OUTER_GAIN = 0x1022; + public static final int AL_CONE_OUTER_GAIN = 0x1022; /** * Specify the maximum distance. * Type: ALfloat * Range: [0.0 - ] */ - public static final int MAX_DISTANCE = 0x1023; + public static final int AL_MAX_DISTANCE = 0x1023; /** * Specify the channel mask. (Creative) * Type: ALuint * Range: [0 - 255] */ - public static final int CHANNEL_MASK = 0x3000; + public static final int AL_CHANNEL_MASK = 0x3000; /** Source state information */ - public static final int SOURCE_STATE = 0x1010; + public static final int AL_SOURCE_STATE = 0x1010; /** Source state information */ - public static final int INITIAL = 0x1011; + public static final int AL_INITIAL = 0x1011; /** Source state information */ - public static final int PLAYING = 0x1012; + public static final int AL_PLAYING = 0x1012; /** Source state information */ - public static final int PAUSED = 0x1013; + public static final int AL_PAUSED = 0x1013; /** Source state information */ - public static final int STOPPED = 0x1014; + public static final int AL_STOPPED = 0x1014; /** Buffer Queue params */ - public static final int BUFFERS_QUEUED = 0x1015; + public static final int AL_BUFFERS_QUEUED = 0x1015; /** Buffer Queue params */ - public static final int BUFFERS_PROCESSED = 0x1016; + public static final int AL_BUFFERS_PROCESSED = 0x1016; /** Sound buffers: format specifier. */ - public static final int FORMAT_MONO8 = 0x1100; + public static final int AL_FORMAT_MONO8 = 0x1100; /** Sound buffers: format specifier. */ - public static final int FORMAT_MONO16 = 0x1101; + public static final int AL_FORMAT_MONO16 = 0x1101; /** Sound buffers: format specifier. */ - public static final int FORMAT_STEREO8 = 0x1102; + public static final int AL_FORMAT_STEREO8 = 0x1102; /** Sound buffers: format specifier. */ - public static final int FORMAT_STEREO16 = 0x1103; + public static final int AL_FORMAT_STEREO16 = 0x1103; /** * Sound buffers: frequency, in units of Hertz [Hz]. @@ -237,7 +237,7 @@ public interface BaseALConstants { * sample frequency marks the maximum significant * frequency component. */ - public static final int FREQUENCY = 0x2001; + public static final int AL_FREQUENCY = 0x2001; /** * Sound buffers: frequency, in units of Hertz [Hz]. @@ -245,7 +245,7 @@ public interface BaseALConstants { * sample frequency marks the maximum significant * frequency component. */ - public static final int BITS = 0x2002; + public static final int AL_BITS = 0x2002; /** * Sound buffers: frequency, in units of Hertz [Hz]. @@ -253,7 +253,7 @@ public interface BaseALConstants { * sample frequency marks the maximum significant * frequency component. */ - public static final int CHANNELS = 0x2003; + public static final int AL_CHANNELS = 0x2003; /** * Sound buffers: frequency, in units of Hertz [Hz]. @@ -261,7 +261,7 @@ public interface BaseALConstants { * sample frequency marks the maximum significant * frequency component. */ - public static final int SIZE = 0x2004; + public static final int AL_SIZE = 0x2004; /** * Sound buffers: frequency, in units of Hertz [Hz]. @@ -269,43 +269,43 @@ public interface BaseALConstants { * sample frequency marks the maximum significant * frequency component. */ - public static final int DATA = 0x2005; + public static final int AL_DATA = 0x2005; /** * Buffer state. * * Not supported for public use (yet). */ - public static final int UNUSED = 0x2010; + public static final int AL_UNUSED = 0x2010; /** * Buffer state. * * Not supported for public use (yet). */ - public static final int PENDING = 0x2011; + public static final int AL_PENDING = 0x2011; /** * Buffer state. * * Not supported for public use (yet). */ - public static final int PROCESSED = 0x2012; + public static final int AL_PROCESSED = 0x2012; /** Errors: No Error. */ - public static final int NO_ERROR = FALSE; + public static final int AL_NO_ERROR = AL_FALSE; /** Illegal name passed as an argument to an AL call. */ - public static final int INVALID_NAME = 0xA001; + public static final int AL_INVALID_NAME = 0xA001; /** Illegal enum passed as an argument to an AL call. */ - public static final int INVALID_ENUM = 0xA002; + 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 INVALID_VALUE = 0xA003; + public static final int AL_INVALID_VALUE = 0xA003; /** * A function was called at inappropriate time, @@ -313,38 +313,38 @@ public interface BaseALConstants { * This can be an incompatible ALenum, object ID, * and/or function. */ - public static final int INVALID_OPERATION = 0xA004; + 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 OUT_OF_MEMORY = 0xA005; + public static final int AL_OUT_OF_MEMORY = 0xA005; /** Context strings: Vendor */ - public static final int VENDOR = 0xB001; + public static final int AL_VENDOR = 0xB001; /** Context strings: Version */ - public static final int VERSION = 0xB002; + public static final int AL_VERSION = 0xB002; /** Context strings: Renderer */ - public static final int RENDERER = 0xB003; + public static final int AL_RENDERER = 0xB003; /** Context strings: Extensions */ - public static final int EXTENSIONS = 0xB004; + public static final int AL_EXTENSIONS = 0xB004; /** Doppler scale. Default 1.0 */ - public static final int DOPPLER_FACTOR = 0xC000; + public static final int AL_DOPPLER_FACTOR = 0xC000; /** Doppler velocity. Default 1.0 */ - public static final int DOPPLER_VELOCITY = 0xC001; + public static final int AL_DOPPLER_VELOCITY = 0xC001; /** Distance model. Default INVERSE_DISTANCE_CLAMPED */ - public static final int DISTANCE_MODEL = 0xD000; + public static final int AL_DISTANCE_MODEL = 0xD000; /** Distance model */ - public static final int INVERSE_DISTANCE = 0xD001; + public static final int AL_INVERSE_DISTANCE = 0xD001; /** Distance model */ - public static final int INVERSE_DISTANCE_CLAMPED = 0xD002; + public static final int AL_INVERSE_DISTANCE_CLAMPED = 0xD002; } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/CoreAL.java b/src/java/org/lwjgl/openal/CoreAL.java index 42c997c9..69e311a5 100644 --- a/src/java/org/lwjgl/openal/CoreAL.java +++ b/src/java/org/lwjgl/openal/CoreAL.java @@ -31,6 +31,8 @@ */ package org.lwjgl.openal; +import java.nio.Buffer; + /** * $Id$ * @@ -42,24 +44,19 @@ package org.lwjgl.openal; */ public class CoreAL extends BaseAL implements BaseALConstants { - /** Creates a new instance of CoreAL */ - public CoreAL() { - super(); - } - /** * Enables a feature of the OpenAL driver. * * @param capability name of a capability to enable */ - public native void enable(int capability); + public static native void alEnable(int capability); /** * Disables a feature of the OpenAL driver. * * @param capability name of a capability to disable */ - public native void disable(int capability); + public static native void alDisable(int capability); /** * Checks if a specific feature is enabled in the OpenAL driver. @@ -67,7 +64,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param capability name of a capability to check * @return true if named feature is enabled */ - public native boolean isEnabled(int capability); + public static native boolean alIsEnabled(int capability); /** * Hinting for implementation @@ -76,67 +73,67 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param target FIXME * @param mode FIXME */ - public native void hint(int target, int mode); + public static native void alHint(int target, int mode); /** * Returns a boolean OpenAL state. * * @return boolean state described by pname will be returned. */ - public native boolean getBoolean(int pname); + public static native boolean alGetBoolean(int pname); /** * Returns an int OpenAL state. * * @return int state described by pname will be returned. */ - public native int getInteger(int pname); + public static native int alGetInteger(int pname); /** * Returns a float OpenAL state. * * @return float state described by pname will be returned. */ - public native float getFloat(int pname); + public static native float alGetFloat(int pname); /** * Returns a double OpenAL state. * * @return double state described by pname will be returned. */ - public native double getDouble(int pname); + public static native double alGetDouble(int pname); /** * Returns a boolean OpenAL state. * * @param pname state to be queried - * @param data address of ByteBuffer to place the booleans in + * @param data Buffer to place the booleans in */ - public native void getBooleanv(int pname, int data); + public static native void alGetBooleanv(int pname, Buffer data); /** * Returns an integer OpenAL state. * * @param pname state to be queried - * @param data address of ByteBuffer to place the integers in + * @param data Buffer to place the integers in */ - public native void getIntegerv(int pname, int data); + public static native void alGetIntegerv(int pname, Buffer data); /** * Returns a floating point OpenAL state. * * @param pname state to be queried - * @param data address of ByteBuffer to place the floats in + * @param data Buffer to place the floats in */ - public native void getFloatv(int pname, int data); + public static native void alGetFloatv(int pname, Buffer data); /** * Returns a double OpenAL state. * * @param pname state to be queried - * @param data address of ByteBuffer to place the floats in + * @param data Buffer to place the floats in */ - public native void getDoublev(int pname, int data); + public static native void alGetDoublev(int pname, Buffer data); /** * Retrieve an OpenAL string property. @@ -144,14 +141,14 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param pname The property to be returned * @return OpenAL String property */ - public native String getString(int pname); + public static native String alGetString(int pname); /** * Retrieve the current error state and then clears the error state. * * @return current error state */ - public native int getError(); + public static native int alGetError(); /** * Test if a specific extension is available for the OpenAL driver. @@ -159,7 +156,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param fname String describing the desired extension * @return true if extension is available, false if not */ - public native boolean isExtensionPresent(String fname); + public static native boolean alIsExtensionPresent(String fname); /** * Returns the enumeration value of an OpenAL enum described by a string. @@ -167,7 +164,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param ename String describing an OpenAL enum * @return Actual int for the described enumeration name */ - public native int getEnumValue(String ename); + public static native int alGetEnumValue(String ename); /** * Sets an integer property of the listener @@ -175,7 +172,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param pname name of the attribute to be set * @param value value to set the attribute to */ - public native void listeneri(int pname, int value); + public static native void alListeneri(int pname, int value); /** * Sets a floating point property of the listener @@ -183,60 +180,50 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @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); + public static native void alListenerf(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 static native void alListener3f(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 + * @param floatdata Buffer to read floats from */ - public native void listenerfv(int pname, int floatdata); + public static native void alListenerfv(int pname, Buffer 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 + * @param integerdata Buffer to write integer to */ - public native void getListeneri(int pname, int integerdata); + public static native void alGetListeneri(int pname, Buffer 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 + * @param floatdata Buffer 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); + public static native void alGetListenerf(int pname, Buffer floatdata); /** * 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 + * @param floatdata Buffer to write floats to */ - public native void getListenerfv(int pname, int floatdata); + public static native void alGetListenerfv(int pname, Buffer floatdata); /** * Generate one or more sources. @@ -244,7 +231,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param n number of sources to generate * @param sources array holding sources */ - public native void genSources(int n, int sources); + public static native void alGenSources(int n, Buffer sources); /** * Delete one or more sources. @@ -252,7 +239,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param n Number of sources to delete * @param source Source array to delete from */ - public native void deleteSources(int n, int source); + public static native void alDeleteSources(int n, Buffer source); /** * Tests if a source is valid. @@ -260,7 +247,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @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); + public static native boolean alIsSource(int id); /** * Set an integer property of a source. @@ -269,7 +256,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param pname property to set * @param value value of property */ - public native void sourcei(int source, int pname, int value); + public static native void alSourcei(int source, int pname, int value); /** * Set a floating point property of a source. @@ -278,59 +265,60 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @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); + public static native void alSourcef(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 static native void alSource3f( + 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 + * @param floatdata Buffer to read floats from */ - public native void sourcefv(int source, int pname, int floatdata); + public static native void alSourcefv(int source, int pname, Buffer 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 + * @param integerdata Buffer to write integer to */ - public native void getSourcei(int source, int pname, int integerdata); + public static native void alGetSourcei(int source, int pname, Buffer 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 + * @param floatdata Buffer to write float to */ - public native void getSourcef(int source, int pname, int floatdata); + public static native void alGetSourcef(int source, int pname, Buffer 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 + * @param floatdata Buffer to write floats to */ - public native void getSourcefv(int source, int pname, int floatdata); + public static native void alGetSourcefv(int source, int pname, Buffer floatdata); /** * Plays a set of sources. @@ -338,7 +326,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param n number of sources to play * @param sources array of sources to play */ - public native void sourcePlayv(int n, int sources); + public static native void alSourcePlayv(int n, Buffer sources); /** * Pauses a set of sources. @@ -346,7 +334,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param n number of sources to pause * @param sources array of sources to pause */ - public native void sourcePausev(int n, int sources); + public static native void alSourcePausev(int n, Buffer sources); /** * Stops a set of sources. @@ -354,7 +342,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param n number of sources to stop * @param sources array of sources to stop */ - public native void sourceStopv(int n, int sources); + public static native void alSourceStopv(int n, Buffer sources); /** * Rewinds a set of sources. @@ -362,51 +350,51 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param n number of sources to rewind * @param sources array of sources to rewind */ - public native void sourceRewindv(int n, int sources); + public static native void alSourceRewindv(int n, Buffer sources); /** * Play a source. * * @param source Source to play */ - public native void sourcePlay(int source); + public static native void alSourcePlay(int source); /** * Pauses a source. * * @param source Source to pause */ - public native void sourcePause(int source); + public static native void alSourcePause(int source); /** * Stops a source. * * @param source Source to stop */ - public native void sourceStop(int source); + public static native void alSourceStop(int source); /** * Rewinds a source. * * @param source Source to rewind */ - public native void sourceRewind(int source); + public static native void alSourceRewind(int source); /** * Generate one or more buffers. * * @param n number of buffers to generate - * @param buffers array holding buffers + * @param buffers holding buffers */ - public native void genBuffers(int n, int buffers); + public static native void alGenBuffers(int n, Buffer buffers); /** * Delete one or more buffers. * * @param n Number of buffers to delete - * @param buffers Buffer array to delete from + * @param buffers Buffer to delete from */ - public native void deleteBuffers(int n, int buffers); + public static native void alDeleteBuffers(int n, Buffer buffers); /** * Tests if buffer is valid. @@ -414,21 +402,21 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param buffer buffer to be tested for validity * @return true if supplied buffer is valid, false if not */ - public native boolean isBuffer(int buffer); + public static native boolean alIsBuffer(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 ByteBuffer location of data * @param size size of data segment * @param freq frequency of data */ - public native void bufferData( + public static native void alBufferData( int buffer, int format, - int data, + Buffer data, int size, int freq); @@ -437,18 +425,18 @@ public class CoreAL extends BaseAL implements BaseALConstants { * * @param buffer buffer to get property from * @param pname name of property to retrieve - * @param integerdata bytebuffer address to write integer to + * @param integerdata Buffer to write integer to */ - public native void getBufferi(int buffer, int pname, int integerdata); + public static native void alGetBufferi(int buffer, int pname, Buffer 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 + * @param floatdata Buffer to write float to */ - public native void getBufferf(int buffer, int pname, int floatdata); + public static native void alGetBufferf(int buffer, int pname, Buffer floatdata); /** * Queues a set of buffers on a source. @@ -457,7 +445,7 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param n number of buffers to be queued * @param buffers buffers to be queued */ - public native void sourceQueueBuffers(int source, int n, int buffers); + public static native void alSourceQueueBuffers(int source, int n, Buffer buffers); /** * Unqueues a set of buffers attached to a source. @@ -466,26 +454,26 @@ public class CoreAL extends BaseAL implements BaseALConstants { * @param n number of buffers to be unqueued * @param buffers buffers to be unqueued */ - public native void sourceUnqueueBuffers(int source, int n, int buffers); + public static native void alSourceUnqueueBuffers(int source, int n, Buffer buffers); /** * Selects the OpenAL distance model. * * @param value distance model to be set */ - public native void distanceModel(int value); + public static native void alDistanceModel(int value); /** * Selects the OpenAL Doppler factor value. * * @param value Doppler scale value to set */ - public native void dopplerFactor(float value); + public static native void alDopplerFactor(float value); /** * Selects the OpenAL Doppler velocity value. * * @param value Doppler velocity value to set */ - public native void dopplerVelocity(float value); + public static native void alDopplerVelocity(float value); } diff --git a/src/java/org/lwjgl/openal/eax/BaseEAX.java b/src/java/org/lwjgl/openal/eax/BaseEAX.java index f5c624a0..88f18b7e 100644 --- a/src/java/org/lwjgl/openal/eax/BaseEAX.java +++ b/src/java/org/lwjgl/openal/eax/BaseEAX.java @@ -55,7 +55,7 @@ public abstract class BaseEAX { /** * Override to provide any initialization code after creation. */ - protected void init() { + protected static void init() { } /** @@ -70,7 +70,7 @@ public abstract class BaseEAX { * * @throws Exception if the EAX extensions couldn't be loaded */ - public void create() throws Exception { + public static void create() throws Exception { if (created) { return; } @@ -87,12 +87,12 @@ public abstract class BaseEAX { * * @return true if the EAX extensions could be found */ - protected native boolean nCreate(); + protected static native boolean nCreate(); /** * "Destroy" the EAX object */ - public void destroy() { + public static void destroy() { if (!created) { return; } @@ -100,16 +100,8 @@ public abstract class BaseEAX { nDestroy(); } - /** - * Finalizer, marked final. - */ - public void finalize() throws Throwable { - super.finalize(); - destroy(); - } - /** * Native method the destroy the EAX */ - protected native void nDestroy(); + protected static native void nDestroy(); } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/eax/BaseEAXConstants.java b/src/java/org/lwjgl/openal/eax/BaseEAXConstants.java index 0fd997b4..ffa58a4a 100644 --- a/src/java/org/lwjgl/openal/eax/BaseEAXConstants.java +++ b/src/java/org/lwjgl/openal/eax/BaseEAXConstants.java @@ -40,71 +40,71 @@ package org.lwjgl.openal.eax; * @version $Revision$ */ public interface BaseEAXConstants { - public static final int ENVIRONMENT_GENERIC = 0; - public static final int ENVIRONMENT_PADDEDCELL = 1; - public static final int ENVIRONMENT_ROOM = 2; - public static final int ENVIRONMENT_BATHROOM = 3; - public static final int ENVIRONMENT_LIVINGROOM = 4; - public static final int ENVIRONMENT_STONEROOM = 5; - public static final int ENVIRONMENT_AUDITORIUM = 6; - public static final int ENVIRONMENT_CONCERTHALL = 7; - public static final int ENVIRONMENT_CAVE = 8; - public static final int ENVIRONMENT_ARENA = 9; - public static final int ENVIRONMENT_HANGAR = 10; - public static final int ENVIRONMENT_CARPETEDHALLWAY = 11; - public static final int ENVIRONMENT_HALLWAY = 12; - public static final int ENVIRONMENT_STONECORRIDOR = 13; - public static final int ENVIRONMENT_ALLEY = 14; - public static final int ENVIRONMENT_FOREST = 15; - public static final int ENVIRONMENT_CITY = 16; - public static final int ENVIRONMENT_MOUNTAINS = 17; - public static final int ENVIRONMENT_QUARRY = 18; - public static final int ENVIRONMENT_PLAIN = 19; - public static final int ENVIRONMENT_PARKINGLOT = 20; - public static final int ENVIRONMENT_SEWERPIPE = 21; - public static final int ENVIRONMENT_UNDERWATER = 22; - public static final int ENVIRONMENT_DRUGGED = 23; - public static final int ENVIRONMENT_DIZZY = 24; - public static final int ENVIRONMENT_PSYCHOTIC = 25; - public static final int ENVIRONMENT_COUNT = 26; + public static final int EAX_ENVIRONMENT_GENERIC = 0; + public static final int EAX_ENVIRONMENT_PADDEDCELL = 1; + public static final int EAX_ENVIRONMENT_ROOM = 2; + public static final int EAX_ENVIRONMENT_BATHROOM = 3; + public static final int EAX_ENVIRONMENT_LIVINGROOM = 4; + public static final int EAX_ENVIRONMENT_STONEROOM = 5; + public static final int EAX_ENVIRONMENT_AUDITORIUM = 6; + public static final int EAX_ENVIRONMENT_CONCERTHALL = 7; + public static final int EAX_ENVIRONMENT_CAVE = 8; + public static final int EAX_ENVIRONMENT_ARENA = 9; + public static final int EAX_ENVIRONMENT_HANGAR = 10; + public static final int EAX_ENVIRONMENT_CARPETEDHALLWAY = 11; + public static final int EAX_ENVIRONMENT_HALLWAY = 12; + public static final int EAX_ENVIRONMENT_STONECORRIDOR = 13; + public static final int EAX_ENVIRONMENT_ALLEY = 14; + public static final int EAX_ENVIRONMENT_FOREST = 15; + public static final int EAX_ENVIRONMENT_CITY = 16; + public static final int EAX_ENVIRONMENT_MOUNTAINS = 17; + public static final int EAX_ENVIRONMENT_QUARRY = 18; + public static final int EAX_ENVIRONMENT_PLAIN = 19; + public static final int EAX_ENVIRONMENT_PARKINGLOT = 20; + public static final int EAX_ENVIRONMENT_SEWERPIPE = 21; + public static final int EAX_ENVIRONMENT_UNDERWATER = 22; + public static final int EAX_ENVIRONMENT_DRUGGED = 23; + public static final int EAX_ENVIRONMENT_DIZZY = 24; + public static final int EAX_ENVIRONMENT_PSYCHOTIC = 25; + public static final int EAX_ENVIRONMENT_COUNT = 26; // Single window material preset - public static final int MATERIAL_SINGLEWINDOW = -2800; - public static final float MATERIAL_SINGLEWINDOWLF = 0.71f; - public static final float MATERIAL_SINGLEWINDOWROOMRATIO = 0.43f; + public static final int EAX_MATERIAL_SINGLEWINDOW = -2800; + public static final float EAX_MATERIAL_SINGLEWINDOWLF = 0.71f; + public static final float EAX_MATERIAL_SINGLEWINDOWROOMRATIO = 0.43f; // Double window material preset - public static final int MATERIAL_DOUBLEWINDOW = -5000; - public static final float MATERIAL_DOUBLEWINDOWHF = 0.40f; - public static final float MATERIAL_DOUBLEWINDOWROOMRATIO = 0.24f; + public static final int EAX_MATERIAL_DOUBLEWINDOW = -5000; + public static final float EAX_MATERIAL_DOUBLEWINDOWHF = 0.40f; + public static final float EAX_MATERIAL_DOUBLEWINDOWROOMRATIO = 0.24f; // Thin door material preset - public static final int MATERIAL_THINDOOR = -1800; - public static final float MATERIAL_THINDOORLF = 0.66f; - public static final float MATERIAL_THINDOORROOMRATIO = 0.66f; + public static final int EAX_MATERIAL_THINDOOR = -1800; + public static final float EAX_MATERIAL_THINDOORLF = 0.66f; + public static final float EAX_MATERIAL_THINDOORROOMRATIO = 0.66f; // Thick door material preset - public static final int MATERIAL_THICKDOOR = -4400; - public static final float MATERIAL_THICKDOORLF = 0.64f; - public static final float MATERIAL_THICKDOORROOMRTATION = 0.27f; + public static final int EAX_MATERIAL_THICKDOOR = -4400; + public static final float EAX_MATERIAL_THICKDOORLF = 0.64f; + public static final float EAX_MATERIAL_THICKDOORROOMRTATION = 0.27f; // Wood wall material preset - public static final int MATERIAL_WOODWALL = -4000; - public static final float MATERIAL_WOODWALLLF = 0.50f; - public static final float MATERIAL_WOODWALLROOMRATIO = 0.30f; + public static final int EAX_MATERIAL_WOODWALL = -4000; + public static final float EAX_MATERIAL_WOODWALLLF = 0.50f; + public static final float EAX_MATERIAL_WOODWALLROOMRATIO = 0.30f; // Brick wall material preset - public static final int MATERIAL_BRICKWALL = -5000; - public static final float MATERIAL_BRICKWALLLF = 0.60f; - public static final float MATERIAL_BRICKWALLROOMRATIO = 0.24f; + public static final int EAX_MATERIAL_BRICKWALL = -5000; + public static final float EAX_MATERIAL_BRICKWALLLF = 0.60f; + public static final float EAX_MATERIAL_BRICKWALLROOMRATIO = 0.24f; // Stone wall material preset - public static final int MATERIAL_STONEWALL = -6000; - public static final float MATERIAL_STONEWALLLF = 0.68f; - public static final float MATERIAL_STONEWALLROOMRATIO = 0.20f; + public static final int EAX_MATERIAL_STONEWALL = -6000; + public static final float EAX_MATERIAL_STONEWALLLF = 0.68f; + public static final float EAX_MATERIAL_STONEWALLROOMRATIO = 0.20f; // Curtain material preset - public static final int MATERIAL_CURTAIN = -1200; - public static final float MATERIAL_CURTAINLF = 0.15f; - public static final float MATERIAL_CURTAINROOMRATIO = 1.00f; + public static final int EAX_MATERIAL_CURTAIN = -1200; + public static final float EAX_MATERIAL_CURTAINLF = 0.15f; + public static final float EAX_MATERIAL_CURTAINROOMRATIO = 1.00f; } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/eax/CoreEAX.java b/src/java/org/lwjgl/openal/eax/CoreEAX.java index 1696ce5b..c671a3db 100644 --- a/src/java/org/lwjgl/openal/eax/CoreEAX.java +++ b/src/java/org/lwjgl/openal/eax/CoreEAX.java @@ -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.eax; +package org.lwjgl.openal.eax; + +import java.nio.Buffer; /** * $Id$ @@ -47,27 +49,23 @@ public class CoreEAX extends BaseEAX implements BaseEAXConstants { /** GUID for listener */ public static int LISTENER_GUID; - /** Creates a new instance of CoreEAX */ - public CoreEAX() { - } - /** * Load extensions */ - protected void init() { - determineAvailableExtensions(); - setGUID(); + protected static void init() { + determineAvailableExtensions(); + setGUID(); } /** * Determines available EAX extensions */ - protected native void determineAvailableExtensions(); + protected static native void determineAvailableExtensions(); /** * Sets the GUID's for the buffer and listener objects */ - protected native void setGUID(); + protected static native void setGUID(); /** * Retrieves an EAX Value @@ -75,11 +73,11 @@ public class CoreEAX extends BaseEAX implements BaseEAXConstants { * @param propertySetID adress to the property set GUID of the object being queried (a listener or a source) * @param property property being queried * @param source the source to be queried - * @param data address to write value to + * @param data Buffer to write value to * @param size size of area being written to * @return OpenAL Error code */ - public native int eaxGet(int propertySetID, int property, int source, int data, int size); + public static native int eaxGet(int propertySetID, int property, int source, Buffer data, int size); /** * Sets an EAX Value @@ -87,9 +85,9 @@ public class CoreEAX extends BaseEAX implements BaseEAXConstants { * @param propertySetID adress to the property set GUID of the object being queried (a listener or a source) * @param property property being queried * @param source the source to be queried - * @param data address to write value to + * @param data Buffer to write value to * @param size size of area being written to * @return OpenAL Error code */ - public native int eaxSet(int propertySetID, int property, int source, int data, int size); + public static native int eaxSet(int propertySetID, int property, int source, Buffer data, int size); } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/eax/EAX.java b/src/java/org/lwjgl/openal/eax/EAX.java index 35a4f06c..2658655b 100644 --- a/src/java/org/lwjgl/openal/eax/EAX.java +++ b/src/java/org/lwjgl/openal/eax/EAX.java @@ -40,10 +40,128 @@ * @version $Revision$ */ public class EAX extends CoreEAX { - - /** - * Nothing to se here - please move along - */ - public EAX() { + + /** + * Sets an EAX Value + * + * @param listener EAXListenerProperties to set values from + * @param property property being queried + * @param source the source to be queried + */ + public static void eaxSetProperty(EAXListenerProperties listener, int property, int source) { + System.out.println("EAX has been disapled for this release, due to \"issues\" with the implementation"); + //CoreEAX.eaxSet(CoreEAX.LISTENER_GUID, property, source, listener.eaxListenerProperties, EAXListenerProperties.EAXLISTENERPROPERTIES_SIZE); + } + + /** + * Sets an EAX Value + * + * @param buffer EAXBufferProperties to set values from + * @param property property being queried + * @param source the source to be queried + */ + public static void eaxSetProperty(EAXBufferProperties buffer, int property, int source) { + System.out.println("EAX has been disapled for this release, due to \"issues\" with the implementation"); + //CoreEAX.eaxSet(CoreEAX.BUFFER_GUID, property, source, buffer.eaxBufferProperties, EAX.getSizeOfProperty(CoreEAX.BUFFER_GUID, property)); + } + + /** + * Gets an EAX Value + * + * @param listener EAXListenerProperties to set values on + * @param property property being queried + * @param source the source to be queried + */ + public static void eaxGetProperty(EAXListenerProperties listener, int property, int source) { + System.out.println("EAX has been disapled for this release, due to \"issues\" with the implementation"); + //CoreEAX.eaxGet(CoreEAX.LISTENER_GUID, property, source, listener.eaxListenerProperties, EAX.getSizeOfProperty(CoreEAX.LISTENER_GUID, property)); + } + + /** + * Sets an EAX Value + * + * @param buffer EAXBufferProperties to set values on + * @param property property being queried + * @param source the source to be queried + */ + public static void eaxGetProperty(EAXBufferProperties buffer, int property, int source) { + System.out.println("EAX has been disapled for this release, due to \"issues\" with the implementation"); + //CoreEAX.eaxGet(CoreEAX.BUFFER_GUID, property, source, buffer.eaxBufferProperties, EAX.getSizeOfProperty(CoreEAX.BUFFER_GUID, property)); + } + + /** + * Retrieves the size of the property + * + * @param guid Listener or Source guid + * @param property Property to determine size of + * @return size of property + */ + private static int getSizeOfProperty(int guid, int property) { + if (guid == CoreEAX.LISTENER_GUID) { + switch(property) { + case EAXListenerProperties.EAXLISTENER_NONE: + return 0; + + /* long */ + case EAXListenerProperties.EAXLISTENER_ROOM: + case EAXListenerProperties.EAXLISTENER_ROOMHF: + case EAXListenerProperties.EAXLISTENER_REFLECTIONS: + case EAXListenerProperties.EAXLISTENER_REVERB: + + /* float */ + case EAXListenerProperties.EAXLISTENER_ROOMROLLOFFFACTOR: + case EAXListenerProperties.EAXLISTENER_DECAYTIME: + case EAXListenerProperties.EAXLISTENER_DECAYHFRATIO: + case EAXListenerProperties.EAXLISTENER_REFLECTIONSDELAY: + case EAXListenerProperties.EAXLISTENER_REVERBDELAY: + case EAXListenerProperties.EAXLISTENER_ENVIRONMENTSIZE: + case EAXListenerProperties.EAXLISTENER_ENVIRONMENTDIFFUSION: + case EAXListenerProperties.EAXLISTENER_AIRABSORPTIONHF: + + /* unsigned long */ + case EAXListenerProperties.EAXLISTENER_ENVIRONMENT: + case EAXListenerProperties.EAXLISTENER_FLAGS: + return 4; + + case EAXListenerProperties.EAXLISTENER_ALLPARAMETERS: + return EAXListenerProperties.EAXLISTENERPROPERTIES_SIZE; + + default: + throw new IllegalArgumentException("No such property '" + property + "'"); + + } + } else { + switch(property) { + case EAXBufferProperties.EAXBUFFER_NONE: + return 0; + + /* long */ + case EAXBufferProperties.EAXBUFFER_DIRECT: + case EAXBufferProperties.EAXBUFFER_DIRECTHF: + case EAXBufferProperties.EAXBUFFER_ROOM: + case EAXBufferProperties.EAXBUFFER_ROOMHF: + case EAXBufferProperties.EAXBUFFER_OBSTRUCTION: + case EAXBufferProperties.EAXBUFFER_OCCLUSION: + case EAXBufferProperties.EAXBUFFER_OUTSIDEVOLUMEHF: + + /* float */ + case EAXBufferProperties.EAXBUFFER_ROOMROLLOFFFACTOR: + case EAXBufferProperties.EAXBUFFER_OBSTRUCTIONLFRATIO: + case EAXBufferProperties.EAXBUFFER_OCCLUSIONLFRATIO: + case EAXBufferProperties.EAXBUFFER_OCCLUSIONROOMRATIO: + case EAXBufferProperties.EAXBUFFER_AIRABSORPTIONFACTOR: + + /* unsigned long */ + case EAXBufferProperties.EAXBUFFER_FLAGS: + return 4; + + case EAXBufferProperties.EAXBUFFER_ALLPARAMETERS: + return EAXBufferProperties.EAXBUFFERPROPERTIES_SIZE; + + default: + throw new IllegalArgumentException("No such property '" + property + "'"); + + } } + } } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/eax/EAXBufferProperties.java b/src/java/org/lwjgl/openal/eax/EAXBufferProperties.java index b911e5fb..9790b189 100644 --- a/src/java/org/lwjgl/openal/eax/EAXBufferProperties.java +++ b/src/java/org/lwjgl/openal/eax/EAXBufferProperties.java @@ -31,8 +31,6 @@ */ package org.lwjgl.openal.eax; -import org.lwjgl.Sys; - import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -93,109 +91,106 @@ public class EAXBufferProperties { /** modifies the behavior of properties offset */ protected static int flags_offset; - public static final int NONE = 0; - public static final int ALLPARAMETERS = 1; - public static final int DIRECT = 2; - public static final int DIRECTHF = 3; - public static final int ROOM = 4; - public static final int ROOMHF = 5; - public static final int ROOMROLLOFFFACTOR = 6; - public static final int OBSTRUCTION = 7; - public static final int OBSTRUCTIONLFRATIO = 8; - public static final int OCCLUSION = 9; - public static final int OCCLUSIONLFRATIO = 10; - public static final int OCCLUSIONROOMRATIO = 11; - public static final int OUTSIDEVOLUMEHF = 12; - public static final int AIRABSORPTIONFACTOR = 13; - public static final int FLAGS = 14; + public static final int EAXBUFFER_NONE = 0; + public static final int EAXBUFFER_ALLPARAMETERS = 1; + public static final int EAXBUFFER_DIRECT = 2; + public static final int EAXBUFFER_DIRECTHF = 3; + public static final int EAXBUFFER_ROOM = 4; + public static final int EAXBUFFER_ROOMHF = 5; + public static final int EAXBUFFER_ROOMROLLOFFFACTOR = 6; + public static final int EAXBUFFER_OBSTRUCTION = 7; + public static final int EAXBUFFER_OBSTRUCTIONLFRATIO = 8; + public static final int EAXBUFFER_OCCLUSION = 9; + public static final int EAXBUFFER_OCCLUSIONLFRATIO = 10; + public static final int EAXBUFFER_OCCLUSIONROOMRATIO = 11; + public static final int EAXBUFFER_OUTSIDEVOLUMEHF = 12; + public static final int EAXBUFFER_AIRABSORPTIONFACTOR = 13; + public static final int EAXBUFFER_FLAGS = 14; /** changes take effect immediately */ - public static final int IMMEDIATE = 0x00000000; + public static final int EAXBUFFER_IMMEDIATE = 0x00000000; /** changes take effect later */ - public static final int DEFERRED = 0x80000000; - public static final int COMMITDEFERREDSETTINGS = (NONE | IMMEDIATE); + public static final int EAXBUFFER_DEFERRED = 0x80000000; + public static final int EAXBUFFER_COMMITDEFERREDSETTINGS = (EAXBUFFER_NONE | EAXBUFFER_IMMEDIATE); /** affects DSPROPERTY_EAXBUFFER_DIRECTHF */ - public static final int FLAGS_DIRECTHFAUTO = 0x00000001; + public static final int EAXBUFFER_FLAGS_DIRECTHFAUTO = 0x00000001; /** affects DSPROPERTY_EAXBUFFER_ROOM */ - public static final int FLAGS_ROOMAUTO = 0x00000002; + public static final int EAXBUFFER_FLAGS_ROOMAUTO = 0x00000002; /** affects DSPROPERTY_EAXBUFFER_ROOMHF */ - public static final int FLAGS_ROOMHFAUTO = 0x00000004; + public static final int EAXBUFFER_FLAGS_ROOMHFAUTO = 0x00000004; /** reserved future use */ - public static final int FLAGS_RESERVED = 0xFFFFFFF8; + public static final int EAXBUFFER_FLAGS_RESERVED = 0xFFFFFFF8; // property ranges and defaults: - public static final int MINDIRECT = -10000; - public static final int MAXDIRECT = 1000; - public static final int DEFAULTDIRECT = 0; + public static final int EAXBUFFER_MINDIRECT = -10000; + public static final int EAXBUFFER_MAXDIRECT = 1000; + public static final int EAXBUFFER_DEFAULTDIRECT = 0; - public static final int MINDIRECTHF = -10000; - public static final int MAXDIRECTHF = 0; - public static final int DEFAULTDIRECTHF = 0; + public static final int EAXBUFFER_MINDIRECTHF = -10000; + public static final int EAXBUFFER_MAXDIRECTHF = 0; + public static final int EAXBUFFER_DEFAULTDIRECTHF = 0; - public static final int MINROOM = -10000; - public static final int MAXROOM = 1000; - public static final int DEFAULTROOM = 0; + public static final int EAXBUFFER_MINROOM = -10000; + public static final int EAXBUFFER_MAXROOM = 1000; + public static final int EAXBUFFER_DEFAULTROOM = 0; - public static final int MINROOMHF = -10000; - public static final int MAXROOMHF = 0; - public static final int DEFAULTROOMHF = 0; + public static final int EAXBUFFER_MINROOMHF = -10000; + public static final int EAXBUFFER_MAXROOMHF = 0; + public static final int EAXBUFFER_DEFAULTROOMHF = 0; - public static final float MINROOMROLLOFFFACTOR = 0.0f; - public static final float MAXROOMROLLOFFFACTOR = 10.f; - public static final float DEFAULTROOMROLLOFFFACTOR = 0.0f; + public static final float EAXBUFFER_MINROOMROLLOFFFACTOR = 0.0f; + public static final float EAXBUFFER_MAXROOMROLLOFFFACTOR = 10.f; + public static final float EAXBUFFER_DEFAULTROOMROLLOFFFACTOR = 0.0f; - public static final int MINOBSTRUCTION = -10000; - public static final int MAXOBSTRUCTION = 0; - public static final int DEFAULTOBSTRUCTION = 0; + public static final int EAXBUFFER_MINOBSTRUCTION = -10000; + public static final int EAXBUFFER_MAXOBSTRUCTION = 0; + public static final int EAXBUFFER_DEFAULTOBSTRUCTION = 0; - public static final float MINOBSTRUCTIONLFRATIO = 0.0f; - public static final float MAXOBSTRUCTIONLFRATIO = 1.0f; - public static final float DEFAULTOBSTRUCTIONLFRATIO = 0.0f; + public static final float EAXBUFFER_MINOBSTRUCTIONLFRATIO = 0.0f; + public static final float EAXBUFFER_MAXOBSTRUCTIONLFRATIO = 1.0f; + public static final float EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO = 0.0f; - public static final int MINOCCLUSION = -10000; - public static final int MAXOCCLUSION = 0; - public static final int DEFAULTOCCLUSION = 0; + public static final int EAXBUFFER_MINOCCLUSION = -10000; + public static final int EAXBUFFER_MAXOCCLUSION = 0; + public static final int EAXBUFFER_DEFAULTOCCLUSION = 0; - public static final float MINOCCLUSIONLFRATIO = 0.0f; - public static final float MAXOCCLUSIONLFRATIO = 1.0f; - public static final float DEFAULTOCCLUSIONLFRATIO = 0.25f; + public static final float EAXBUFFER_MINOCCLUSIONLFRATIO = 0.0f; + public static final float EAXBUFFER_MAXOCCLUSIONLFRATIO = 1.0f; + public static final float EAXBUFFER_DEFAULTOCCLUSIONLFRATIO = 0.25f; - public static final float MINOCCLUSIONROOMRATIO = 0.0f; - public static final float MAXOCCLUSIONROOMRATIO = 10.0f; - public static final float DEFAULTOCCLUSIONROOMRATIO = 0.5f; + public static final float EAXBUFFER_MINOCCLUSIONROOMRATIO = 0.0f; + public static final float EAXBUFFER_MAXOCCLUSIONROOMRATIO = 10.0f; + public static final float EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO = 0.5f; - public static final int MINOUTSIDEVOLUMEHF = -10000; - public static final int MAXOUTSIDEVOLUMEHF = 0; - public static final int DEFAULTOUTSIDEVOLUMEHF = 0; + public static final int EAXBUFFER_MINOUTSIDEVOLUMEHF = -10000; + public static final int EAXBUFFER_MAXOUTSIDEVOLUMEHF = 0; + public static final int EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF = 0; - public static final float MINAIRABSORPTIONFACTOR = 0.0f; - public static final float MAXAIRABSORPTIONFACTOR = 10.0f; - public static final float DEFAULTAIRABSORPTIONFACTOR = 1.0f; + public static final float EAXBUFFER_MINAIRABSORPTIONFACTOR = 0.0f; + public static final float EAXBUFFER_MAXAIRABSORPTIONFACTOR = 10.0f; + public static final float EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR = 1.0f; - public static final int DEFAULTFLAGS = (FLAGS_DIRECTHFAUTO | - FLAGS_ROOMAUTO | - FLAGS_ROOMHFAUTO); + public static final int EAXBUFFER_DEFAULTFLAGS = ( EAXBUFFER_FLAGS_DIRECTHFAUTO | + EAXBUFFER_FLAGS_ROOMAUTO | + EAXBUFFER_FLAGS_ROOMHFAUTO); static { - System.loadLibrary(org.lwjgl.Sys.getLibraryName()); - EAXBUFFERPROPERTIES_SIZE = sizeOfEaxBufferProperties(); - assignOffsets(); + System.loadLibrary(org.lwjgl.Sys.getLibraryName()); + EAXBUFFERPROPERTIES_SIZE = sizeOfEaxBufferProperties(); + assignOffsets(); } - /** - * Creates a new instance of EAXBufferProperties - */ public EAXBufferProperties() { - eaxBufferProperties = ByteBuffer.allocateDirect(EAXBUFFERPROPERTIES_SIZE); - eaxBufferProperties.order(ByteOrder.nativeOrder()); + eaxBufferProperties = ByteBuffer.allocateDirect(EAXBUFFERPROPERTIES_SIZE); + eaxBufferProperties.order(ByteOrder.nativeOrder()); } - + /** * Retireves the direct path level * @@ -430,17 +425,10 @@ public class EAXBufferProperties { eaxBufferProperties.putInt(flags_offset, flags); } - /** - * Retrieves the address of this EAXBufferProperties - */ - public int getAddress() { - return Sys.getDirectBufferAddress(eaxBufferProperties); - } - /** * Retrieves the size of the containing ByteBuffer */ - public int getSize() { + public static int getSize() { return EAXBUFFERPROPERTIES_SIZE; } diff --git a/src/java/org/lwjgl/openal/eax/EAXListenerProperties.java b/src/java/org/lwjgl/openal/eax/EAXListenerProperties.java index 78ab9772..11aa260f 100644 --- a/src/java/org/lwjgl/openal/eax/EAXListenerProperties.java +++ b/src/java/org/lwjgl/openal/eax/EAXListenerProperties.java @@ -31,8 +31,6 @@ */ package org.lwjgl.openal.eax; -import org.lwjgl.Sys; - import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -94,124 +92,120 @@ public class EAXListenerProperties { /** modifies the behavior of properties offset */ protected static int flags_offset; - public static final int NONE = 0; - public static final int ALLPARAMETERS = 1; - public static final int ROOM = 2; - public static final int ROOMHF = 3; - public static final int ROOMROLLOFFFACTOR = 4; - public static final int DECAYTIME = 5; - public static final int DECAYHFRATIO = 6; - public static final int REFLECTIONS = 7; - public static final int REFLECTIONSDELAY = 8; - public static final int REVERB = 9; - public static final int REVERBDELAY = 10; - public static final int ENVIRONMENT = 11; - public static final int ENVIRONMENTSIZE = 12; - public static final int ENVIRONMENTDIFFUSION = 13; - public static final int AIRABSORPTIONHF = 14; - public static final int FLAGS = 15; + public static final int EAXLISTENER_NONE = 0; + public static final int EAXLISTENER_ALLPARAMETERS = 1; + public static final int EAXLISTENER_ROOM = 2; + public static final int EAXLISTENER_ROOMHF = 3; + public static final int EAXLISTENER_ROOMROLLOFFFACTOR = 4; + public static final int EAXLISTENER_DECAYTIME = 5; + public static final int EAXLISTENER_DECAYHFRATIO = 6; + public static final int EAXLISTENER_REFLECTIONS = 7; + public static final int EAXLISTENER_REFLECTIONSDELAY = 8; + public static final int EAXLISTENER_REVERB = 9; + public static final int EAXLISTENER_REVERBDELAY = 10; + public static final int EAXLISTENER_ENVIRONMENT = 11; + public static final int EAXLISTENER_ENVIRONMENTSIZE = 12; + public static final int EAXLISTENER_ENVIRONMENTDIFFUSION = 13; + public static final int EAXLISTENER_AIRABSORPTIONHF = 14; + public static final int EAXLISTENER_FLAGS = 15; /** changes take effect immediately */ - public static final int IMMEDIATE = 0x00000000; + public static final int EAXLISTENER_IMMEDIATE = 0x00000000; /** changes take effect later */ - public static final int DEFERRED = 0x80000000; + public static final int EAXLISTENER_DEFERRED = 0x80000000; - public static final int COMMITDEFERREDSETTINGS = (NONE | IMMEDIATE); + public static final int EAXLISTENER_COMMITDEFERREDSETTINGS = (EAXLISTENER_NONE | EAXLISTENER_IMMEDIATE); /** reverberation decay time */ - public static final int FLAGS_DECAYTIMESCALE = 0x00000001; + public static final int EAXLISTENERFLAGS_DECAYTIMESCALE = 0x00000001; /** reflection level */ - public static final int FLAGS_REFLECTIONSSCALE = 0x00000002; + public static final int EAXLISTENERFLAGS_REFLECTIONSSCALE = 0x00000002; /** initial reflection delay time */ - public static final int FLAGS_REFLECTIONSDELAYSCALE = 0x00000004; + public static final int EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE = 0x00000004; /** reflections level */ - public static final int FLAGS_REVERBSCALE = 0x00000008; + public static final int EAXLISTENERFLAGS_REVERBSCALE = 0x00000008; /** late reverberation delay time */ - public static final int FLAGS_REVERBDELAYSCALE = 0x00000010; + public static final int EAXLISTENERFLAGS_REVERBDELAYSCALE = 0x00000010; /** This flag limits high-frequency decay time according to air absorption. */ - public static final int FLAGS_DECAYHFLIMIT = 0x00000020; + public static final int EAXLISTENERFLAGS_DECAYHFLIMIT = 0x00000020; /** reserved future use */ - public static final int FLAGS_RESERVED = 0xFFFFFFC0; + public static final int EAXLISTENERFLAGS_RESERVED = 0xFFFFFFC0; // property ranges and defaults: - public static final int MINROOM = -10000; - public static final int MAXROOM = 0; - public static final int DEFAULTROOM = -1000; + public static final int EAXLISTENER_MINROOM = -10000; + public static final int EAXLISTENER_MAXROOM = 0; + public static final int EAXLISTENER_DEFAULTROOM = -1000; - public static final int MINROOMHF = -10000; - public static final int MAXROOMHF = 0; - public static final int DEFAULTROOMHF = -100; + public static final int EAXLISTENER_MINROOMHF = -10000; + public static final int EAXLISTENER_MAXROOMHF = 0; + public static final int EAXLISTENER_DEFAULTROOMHF = -100; - public static final float MINROOMROLLOFFFACTOR = 0.0f; - public static final float MAXROOMROLLOFFFACTOR = 10.0f; - public static final float DEFAULTROOMROLLOFFFACTOR = 0.0f; + public static final float EAXLISTENER_MINROOMROLLOFFFACTOR = 0.0f; + public static final float EAXLISTENER_MAXROOMROLLOFFFACTOR = 10.0f; + public static final float EAXLISTENER_DEFAULTROOMROLLOFFFACTOR = 0.0f; - public static final float MINDECAYTIME = 0.1f; - public static final float MAXDECAYTIME = 20.0f; - public static final float DEFAULTDECAYTIME = 1.49f; + public static final float EAXLISTENER_MINDECAYTIME = 0.1f; + public static final float EAXLISTENER_MAXDECAYTIME = 20.0f; + public static final float EAXLISTENER_DEFAULTDECAYTIME = 1.49f; - public static final float MINDECAYHFRATIO = 0.1f; - public static final float MAXDECAYHFRATIO = 2.0f; - public static final float DEFAULTDECAYHFRATIO = 0.83f; + public static final float EAXLISTENER_MINDECAYHFRATIO = 0.1f; + public static final float EAXLISTENER_MAXDECAYHFRATIO = 2.0f; + public static final float EAXLISTENER_DEFAULTDECAYHFRATIO = 0.83f; - public static final int MINREFLECTIONS = -10000; - public static final int MAXREFLECTIONS = 1000; - public static final int DEFAULTREFLECTIONS = -2602; + public static final int EAXLISTENER_MINREFLECTIONS = -10000; + public static final int EAXLISTENER_MAXREFLECTIONS = 1000; + public static final int EAXLISTENER_DEFAULTREFLECTIONS = -2602; - public static final float MINREFLECTIONSDELAY = 0.0f; - public static final float MAXREFLECTIONSDELAY = 0.3f; - public static final float DEFAULTREFLECTIONSDELAY = 0.007f; + public static final float EAXLISTENER_MINREFLECTIONSDELAY = 0.0f; + public static final float EAXLISTENER_MAXREFLECTIONSDELAY = 0.3f; + public static final float EAXLISTENER_DEFAULTREFLECTIONSDELAY = 0.007f; - public static final int MINREVERB = -10000; - public static final int MAXREVERB = 2000; - public static final int DEFAULTREVERB = 200; + public static final int EAXLISTENER_MINREVERB = -10000; + public static final int EAXLISTENER_MAXREVERB = 2000; + public static final int EAXLISTENER_DEFAULTREVERB = 200; - public static final float MINREVERBDELAY = 0.0f; - public static final float MAXREVERBDELAY = 0.1f; - public static final float DEFAULTREVERBDELAY = 0.011f; + public static final float EAXLISTENER_MINREVERBDELAY = 0.0f; + public static final float EAXLISTENER_MAXREVERBDELAY = 0.1f; + public static final float EAXLISTENER_DEFAULTREVERBDELAY = 0.011f; - public static final int MINENVIRONMENT = 0; - public static final int MAXENVIRONMENT = (EAX.ENVIRONMENT_COUNT-1); - public static final int DEFAULTENVIRONMENT = EAX.ENVIRONMENT_GENERIC; + public static final int EAXLISTENER_MINENVIRONMENT = 0; + public static final int EAXLISTENER_MAXENVIRONMENT = (EAX.EAX_ENVIRONMENT_COUNT-1); + public static final int EAXLISTENER_DEFAULTENVIRONMENT = EAX.EAX_ENVIRONMENT_GENERIC; - public static final float MINENVIRONMENTSIZE = 1.0f; - public static final float MAXENVIRONMENTSIZE = 100.0f; - public static final float DEFAULTENVIRONMENTSIZE = 7.5f; + public static final float EAXLISTENER_MINENVIRONMENTSIZE = 1.0f; + public static final float EAXLISTENER_MAXENVIRONMENTSIZE = 100.0f; + public static final float EAXLISTENER_DEFAULTENVIRONMENTSIZE = 7.5f; - public static final float MINENVIRONMENTDIFFUSION = 0.0f; - public static final float MAXENVIRONMENTDIFFUSION = 1.0f; - public static final float DEFAULTENVIRONMENTDIFFUSION = 1.0f; + public static final float EAXLISTENER_MINENVIRONMENTDIFFUSION = 0.0f; + public static final float EAXLISTENER_MAXENVIRONMENTDIFFUSION = 1.0f; + public static final float EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION = 1.0f; - public static final float MINAIRABSORPTIONHF = -100.0f; - public static final float MAXAIRABSORPTIONHF = 0.0f; - public static final float DEFAULTAIRABSORPTIONHF = -5.0f; + public static final float EAXLISTENER_MINAIRABSORPTIONHF = -100.0f; + public static final float EAXLISTENER_MAXAIRABSORPTIONHF = 0.0f; + public static final float EAXLISTENER_DEFAULTAIRABSORPTIONHF = -5.0f; - public static final int DEFAULTFLAGS = (FLAGS_DECAYTIMESCALE | - FLAGS_REFLECTIONSSCALE | - FLAGS_REFLECTIONSDELAYSCALE | - FLAGS_REVERBSCALE | - FLAGS_REVERBDELAYSCALE | - FLAGS_DECAYHFLIMIT); - + public static final int EAXLISTENER_DEFAULTFLAGS = ( EAXLISTENERFLAGS_DECAYTIMESCALE | + EAXLISTENERFLAGS_REFLECTIONSSCALE | + EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | + EAXLISTENERFLAGS_REVERBSCALE | + EAXLISTENERFLAGS_REVERBDELAYSCALE | + EAXLISTENERFLAGS_DECAYHFLIMIT); static { - System.loadLibrary(org.lwjgl.Sys.getLibraryName()); - EAXLISTENERPROPERTIES_SIZE = sizeOfEaxListenerProperties(); - assignOffsets(); + System.loadLibrary(org.lwjgl.Sys.getLibraryName()); + EAXLISTENERPROPERTIES_SIZE = sizeOfEaxListenerProperties(); + assignOffsets(); } - /** - * Creates a new instance of EAXBufferProperties - */ public EAXListenerProperties() { - eaxListenerProperties = ByteBuffer.allocateDirect(EAXLISTENERPROPERTIES_SIZE); - eaxListenerProperties.order(ByteOrder.nativeOrder()); + eaxListenerProperties = ByteBuffer.allocateDirect(EAXLISTENERPROPERTIES_SIZE); + eaxListenerProperties.order(ByteOrder.nativeOrder()); } /** @@ -466,13 +460,6 @@ public class EAXListenerProperties { eaxListenerProperties.putInt(flags_offset, flags); } - /** - * Retrieves the address of this EAXBufferProperties - */ - public int getAddress() { - return Sys.getDirectBufferAddress(eaxListenerProperties); - } - /** * Retrieves the size of the containing ByteBuffer */ diff --git a/src/java/org/lwjgl/test/input/ControllerCreationTest.java b/src/java/org/lwjgl/test/input/ControllerCreationTest.java index 1ce64fcf..e19db8ce 100644 --- a/src/java/org/lwjgl/test/input/ControllerCreationTest.java +++ b/src/java/org/lwjgl/test/input/ControllerCreationTest.java @@ -52,9 +52,6 @@ public class ControllerCreationTest { /** OpenGL instance */ private GL gl; - /** GLU instance */ - private GLU glu; - /** position of quad to draw */ private Vector2f position = new Vector2f(320.0f, 240.0f); @@ -65,7 +62,7 @@ public class ControllerCreationTest { public ControllerCreationTest() { } - private void initialize() { + private void initialize(boolean fullscreen) { // find first display mode that allows us 640*480*16 DisplayMode[] modes = Display.getAvailableDisplayModes(); for (int i = 0; i < modes.length; i++) { @@ -75,18 +72,17 @@ public class ControllerCreationTest { displayMode = modes[i]; break; } - } - - // create display and opengl - setupDisplay(false); - } - - private void setupDisplay(boolean fullscreen) { + } + try { - gl = new GL("ControllerCreationTest", 50, 50, 640, 480, 16, 0, 0, 0); + if(fullscreen) { + Display.setDisplayMode(displayMode); + gl = new GL("MouseCreationTest", 16, 0, 0, 0); + } else { + gl = new GL("MouseCreationTest", 50, 50, 640, 480, 16, 0, 0, 0); + } gl.create(); - glu = new GLU(gl); } catch (Exception e) { e.printStackTrace(); System.exit(-1); @@ -94,14 +90,14 @@ public class ControllerCreationTest { initializeOpenGL(); } - + private void initializeOpenGL() { - gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f); - glu.ortho2D(0.0, Display.getWidth(), 0, Display.getHeight()); + GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + GLU.gluOrtho2D(0.0, 640, 0, 480); } public void executeTest() { - initialize(); + initialize(false); System.out.println("Test ready:\n"); @@ -121,7 +117,13 @@ public class ControllerCreationTest { System.out.println("success"); System.out.print("Entering fullscreen mode..."); - setupDisplay(true); + try { + gl.destroy(); + initialize(true); + Display.setDisplayMode(displayMode); + } catch (Exception e) { + e.printStackTrace(); + } System.out.println("success"); @@ -197,24 +199,24 @@ public class ControllerCreationTest { } private void render() { - gl.clear(GL.COLOR_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); - gl.pushMatrix(); - gl.begin(GL.POLYGON); + GL.glPushMatrix(); + GL.glBegin(GL.GL_POLYGON); { - gl.color3f(0.0f, 1.0f, 1.0f); - gl.vertex2f(position.x + 0.0f, position.y + 0.0f); + GL.glColor3f(0.0f, 1.0f, 1.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 0.0f); - gl.color3f(1.0f, 0.0f, 1.0f); - gl.vertex2f(position.x + 0.0f, position.y + 30.0f); - gl.vertex2f(position.x + 40.0f, position.y + 30.0f); + GL.glColor3f(1.0f, 0.0f, 1.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 30.0f); + GL.glVertex2f(position.x + 40.0f, position.y + 30.0f); - gl.color3f(1.0f, 1.0f, 0.0f); - gl.vertex2f(position.x + 60.0f, position.y + 15.f); - gl.vertex2f(position.x + 40.0f, position.y + 0.0f); + GL.glColor3f(1.0f, 1.0f, 0.0f); + GL.glVertex2f(position.x + 60.0f, position.y + 15.f); + GL.glVertex2f(position.x + 40.0f, position.y + 0.0f); } - gl.end(); - gl.popMatrix(); + GL.glEnd(); + GL.glPopMatrix(); } /** diff --git a/src/java/org/lwjgl/test/input/ControllerTest.java b/src/java/org/lwjgl/test/input/ControllerTest.java index a99d2b4f..acb89d42 100644 --- a/src/java/org/lwjgl/test/input/ControllerTest.java +++ b/src/java/org/lwjgl/test/input/ControllerTest.java @@ -80,8 +80,6 @@ public class ControllerTest { try { gl = new GL("ControllerTest", 50, 50, 640, 480, 16, 0, 0, 0); gl.create(); - - glu = new GLU(gl); } catch (Exception e) { e.printStackTrace(); System.exit(-1); @@ -91,8 +89,8 @@ public class ControllerTest { } private void initializeOpenGL() { - gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f); - glu.ortho2D(0.0, 640, 0, 480); + GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + GLU.gluOrtho2D(0.0, 640, 0, 480); } public void executeTest() { @@ -172,9 +170,9 @@ public class ControllerTest { } private void render() { - gl.clear(GL.COLOR_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); - gl.begin(GL.POLYGON); + GL.glBegin(GL.GL_POLYGON); { float color = 1.0f; int buttonDown = 0; @@ -185,15 +183,15 @@ public class ControllerTest { System.out.println("Button " + i + " down"); } } - gl.color3f(color, color, color); + GL.glColor3f(color, color, color); - gl.vertex2f(position.x + 0.0f, position.y + 0.0f); - gl.vertex2f(position.x + 0.0f, position.y + 30.0f); - gl.vertex2f(position.x + 40.0f, position.y + 30.0f); - gl.vertex2f(position.x + 60.0f, position.y + 15.f); - gl.vertex2f(position.x + 40.0f, position.y + 0.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 0.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 30.0f); + GL.glVertex2f(position.x + 40.0f, position.y + 30.0f); + GL.glVertex2f(position.x + 60.0f, position.y + 15.f); + GL.glVertex2f(position.x + 40.0f, position.y + 0.0f); } - gl.end(); + GL.glEnd(); } /** diff --git a/src/java/org/lwjgl/test/input/HWCursorTest.java b/src/java/org/lwjgl/test/input/HWCursorTest.java index 47450f20..b88a34e6 100644 --- a/src/java/org/lwjgl/test/input/HWCursorTest.java +++ b/src/java/org/lwjgl/test/input/HWCursorTest.java @@ -85,7 +85,6 @@ public class HWCursorTest { // start of in windowed mode gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); gl.create(); - glu = new GLU(gl); glInit(); @@ -139,7 +138,7 @@ public class HWCursorTest { try { if ((Mouse.getNativeCursorCaps() | Mouse.CURSOR_ANIMATION) == 0) num_images = 1; - cursor = new Cursor(Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize()/2, Mouse.getMaxCursorSize()/2, num_images, Sys.getDirectBufferAddress(cursor_images), Sys.getDirectBufferAddress(delays)); + cursor = new Cursor(Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize()/2, Mouse.getMaxCursorSize()/2, num_images, cursor_images, delays); Mouse.setNativeCursor(cursor); } catch (Exception e) { e.printStackTrace(); @@ -186,23 +185,23 @@ public class HWCursorTest { */ private void render() { //clear background - gl.clear(GL.COLOR_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); // draw white quad - gl.pushMatrix(); + GL.glPushMatrix(); { - gl.translatef(mouse_x, 600 - mouse_y, 0); - gl.color3f(1.0f, 1.0f, 1.0f); - gl.begin(GL.QUADS); + GL.glTranslatef(mouse_x, 600 - mouse_y, 0); + GL.glColor3f(1.0f, 1.0f, 1.0f); + GL.glBegin(GL.GL_QUADS); { - gl.vertex2i(-50, -50); - gl.vertex2i(50, -50); - gl.vertex2i(50, 50); - gl.vertex2i(-50, 50); + GL.glVertex2i(-50, -50); + GL.glVertex2i(50, -50); + GL.glVertex2i(50, 50); + GL.glVertex2i(-50, 50); } - gl.end(); + GL.glEnd(); } - gl.popMatrix(); + GL.glPopMatrix(); } /** @@ -236,8 +235,7 @@ public class HWCursorTest { Display.setDisplayMode(mode); gl = new GL("Test", mode.bpp, 0, 0, 0); gl.create(); - glu = new GLU(gl); - + glInit(); Keyboard.create(); @@ -264,7 +262,6 @@ public class HWCursorTest { Display.resetDisplayMode(); gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); gl.create(); - glu = new GLU(gl); glInit(); @@ -336,15 +333,15 @@ public class HWCursorTest { private void glInit() { // Go into orthographic projection mode. gl.determineAvailableExtensions(); - gl.matrixMode(GL.PROJECTION); - gl.loadIdentity(); - glu.ortho2D(0, mode.width, 0, mode.height); - gl.matrixMode(GL.MODELVIEW); - gl.loadIdentity(); - gl.viewport(0, 0, mode.width, mode.height); + GL.glMatrixMode(GL.GL_PROJECTION); + GL.glLoadIdentity(); + GLU.gluOrtho2D(0, mode.width, 0, mode.height); + GL.glMatrixMode(GL.GL_MODELVIEW); + GL.glLoadIdentity(); + GL.glViewport(0, 0, mode.width, mode.height); //set clear color to black - gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f); + GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //sync frame (only works on windows) if (GL.WGL_EXT_swap_control) { diff --git a/src/java/org/lwjgl/test/input/KeyboardTest.java b/src/java/org/lwjgl/test/input/KeyboardTest.java index 8fd8cf83..322cb3e8 100644 --- a/src/java/org/lwjgl/test/input/KeyboardTest.java +++ b/src/java/org/lwjgl/test/input/KeyboardTest.java @@ -84,7 +84,6 @@ public class KeyboardTest { gl = new GL("KeyboardTest", 50, 50, 640, 480, 16, 0, 0, 0); gl.create(); - glu = new GLU(gl); } catch (Exception e) { e.printStackTrace(); System.exit(-1); @@ -94,8 +93,8 @@ public class KeyboardTest { } private void initializeOpenGL() { - gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f); - glu.ortho2D(0.0, 640, 0, 480); + GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + GLU.gluOrtho2D(0.0, 640, 0, 480); } public void executeTest() { @@ -195,21 +194,21 @@ public class KeyboardTest { } private void render() { - gl.clear(GL.COLOR_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); - gl.begin(GL.POLYGON); + GL.glBegin(GL.GL_POLYGON); { float color = 1.0f; int buttonDown = 0; - gl.color3f(color, color, color); + GL.glColor3f(color, color, color); - gl.vertex2f(position.x + 0.0f, position.y + 0.0f); - gl.vertex2f(position.x + 0.0f, position.y + 30.0f); - gl.vertex2f(position.x + 40.0f, position.y + 30.0f); - gl.vertex2f(position.x + 60.0f, position.y + 15.f); - gl.vertex2f(position.x + 40.0f, position.y + 0.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 0.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 30.0f); + GL.glVertex2f(position.x + 40.0f, position.y + 30.0f); + GL.glVertex2f(position.x + 60.0f, position.y + 15.f); + GL.glVertex2f(position.x + 40.0f, position.y + 0.0f); } - gl.end(); + GL.glEnd(); } /** diff --git a/src/java/org/lwjgl/test/input/MouseCreationTest.java b/src/java/org/lwjgl/test/input/MouseCreationTest.java index 982b0467..7f6282c5 100644 --- a/src/java/org/lwjgl/test/input/MouseCreationTest.java +++ b/src/java/org/lwjgl/test/input/MouseCreationTest.java @@ -86,7 +86,6 @@ public class MouseCreationTest { } gl.create(); - glu = new GLU(gl); } catch (Exception e) { e.printStackTrace(); System.exit(-1); @@ -96,8 +95,8 @@ public class MouseCreationTest { } private void initializeOpenGL() { - gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f); - glu.ortho2D(0.0, 640, 0, 480); + GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + GLU.gluOrtho2D(0.0, 640, 0, 480); } public void executeTest() { @@ -205,9 +204,9 @@ public class MouseCreationTest { } private void render() { - gl.clear(GL.COLOR_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); - gl.begin(GL.POLYGON); + GL.glBegin(GL.GL_POLYGON); { float color = 1.0f; int buttonDown = 0; @@ -218,15 +217,15 @@ public class MouseCreationTest { break; } } - gl.color3f(color, color, color); + GL.glColor3f(color, color, color); - gl.vertex2f(position.x + 0.0f, position.y + 0.0f); - gl.vertex2f(position.x + 0.0f, position.y + 30.0f); - gl.vertex2f(position.x + 40.0f, position.y + 30.0f); - gl.vertex2f(position.x + 60.0f, position.y + 15.f); - gl.vertex2f(position.x + 40.0f, position.y + 0.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 0.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 30.0f); + GL.glVertex2f(position.x + 40.0f, position.y + 30.0f); + GL.glVertex2f(position.x + 60.0f, position.y + 15.f); + GL.glVertex2f(position.x + 40.0f, position.y + 0.0f); } - gl.end(); + GL.glEnd(); } /** diff --git a/src/java/org/lwjgl/test/input/MouseTest.java b/src/java/org/lwjgl/test/input/MouseTest.java index 932178e6..bb897342 100644 --- a/src/java/org/lwjgl/test/input/MouseTest.java +++ b/src/java/org/lwjgl/test/input/MouseTest.java @@ -81,7 +81,6 @@ public class MouseTest { gl = new GL("MouseTest", 50, 50, 640, 480, 16, 0, 0, 0); gl.create(); - glu = new GLU(gl); } catch (Exception e) { e.printStackTrace(); System.exit(-1); @@ -91,8 +90,8 @@ public class MouseTest { } private void initializeOpenGL() { - gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f); - glu.ortho2D(0.0, 640, 0, 480); + GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + GLU.gluOrtho2D(0.0, 640, 0, 480); } public void executeTest() { @@ -159,9 +158,9 @@ public class MouseTest { } private void render() { - gl.clear(GL.COLOR_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); - gl.begin(GL.POLYGON); + GL.glBegin(GL.GL_POLYGON); { float color = 1.0f; int buttonDown = 0; @@ -172,15 +171,15 @@ public class MouseTest { break; } } - gl.color3f(color, color, color); + GL.glColor3f(color, color, color); - gl.vertex2f(position.x + 0.0f, position.y + 0.0f); - gl.vertex2f(position.x + 0.0f, position.y + 30.0f); - gl.vertex2f(position.x + 40.0f, position.y + 30.0f); - gl.vertex2f(position.x + 60.0f, position.y + 15.f); - gl.vertex2f(position.x + 40.0f, position.y + 0.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 0.0f); + GL.glVertex2f(position.x + 0.0f, position.y + 30.0f); + GL.glVertex2f(position.x + 40.0f, position.y + 30.0f); + GL.glVertex2f(position.x + 60.0f, position.y + 15.f); + GL.glVertex2f(position.x + 40.0f, position.y + 0.0f); } - gl.end(); + GL.glEnd(); } /** diff --git a/src/java/org/lwjgl/test/openal/ALCTest.java b/src/java/org/lwjgl/test/openal/ALCTest.java index 5128b87d..390e189b 100644 --- a/src/java/org/lwjgl/test/openal/ALCTest.java +++ b/src/java/org/lwjgl/test/openal/ALCTest.java @@ -32,7 +32,6 @@ package org.lwjgl.test.openal; import org.lwjgl.openal.ALC; -import org.lwjgl.Sys; import java.nio.IntBuffer; @@ -46,15 +45,11 @@ import java.nio.IntBuffer; */ public class ALCTest extends BasicTest { - /** instance of alc */ - private ALC alc; - /** * Creates an instance of ALCTest */ public ALCTest() { super(); - alc = al.getALC(); } /** @@ -62,34 +57,34 @@ public class ALCTest extends BasicTest { */ protected void execute(String[] args) { //error stuff - int lastError = ALC.NO_ERROR; + int lastError = ALC.ALC_NO_ERROR; //create attribute list for context creation IntBuffer buffer = createIntBuffer(7); - if ((lastError = alc.getError()) != ALC.NO_ERROR) { - System.out.println("ALC Error: " + alc.getString(lastError)); + if ((lastError = ALC.alcGetError()) != ALC.ALC_NO_ERROR) { + System.out.println("ALC Error: " + ALC.alcGetString(lastError)); System.exit(-1); } //query System.out.println( "DEFAULT_DEVICE_SPECIFIER: " - + alc.getString(ALC.DEFAULT_DEVICE_SPECIFIER)); + + ALC.alcGetString(ALC.ALC_DEFAULT_DEVICE_SPECIFIER)); System.out.println( - "DEVICE_SPECIFIER: " + alc.getString(ALC.DEVICE_SPECIFIER)); - System.out.println("EXTENSIONS: " + alc.getString(ALC.EXTENSIONS)); + "DEVICE_SPECIFIER: " + ALC.alcGetString(ALC.ALC_DEVICE_SPECIFIER)); + System.out.println("EXTENSIONS: " + ALC.alcGetString(ALC.ALC_EXTENSIONS)); //mo query buffer.rewind(); - alc.getIntegerv( - ALC.MAJOR_VERSION, + ALC.alcGetIntegerv( + ALC.ALC_MAJOR_VERSION, 4, - Sys.getDirectBufferAddress(buffer)); - alc.getIntegerv( - ALC.MINOR_VERSION, + buffer); + ALC.alcGetIntegerv( + ALC.ALC_MINOR_VERSION, 4, - Sys.getDirectBufferAddress(buffer) + 4); + ((IntBuffer)buffer.position(4)).slice()); System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0)); System.out.println("ALC_MINOR_VERSION: " + buffer.get(1)); @@ -100,7 +95,7 @@ public class ALCTest extends BasicTest { //get an enumerstion value System.out.println( "Value of ALC_MAJOR_VERSION: " - + alc.getEnumValue("ALC_MAJOR_VERSION")); + + ALC.alcGetEnumValue("ALC_MAJOR_VERSION")); alExit(); } diff --git a/src/java/org/lwjgl/test/openal/ALTest.java b/src/java/org/lwjgl/test/openal/ALTest.java index 048c1ded..04e3fba5 100644 --- a/src/java/org/lwjgl/test/openal/ALTest.java +++ b/src/java/org/lwjgl/test/openal/ALTest.java @@ -36,7 +36,6 @@ import org.lwjgl.openal.ALC; import org.lwjgl.openal.eax.EAX; import org.lwjgl.openal.eax.EAXBufferProperties; import org.lwjgl.openal.eax.EAXListenerProperties; -import org.lwjgl.Sys; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -138,78 +137,78 @@ public class ALTest extends BasicTest { /** enumerations string */ protected int[] enumeration = new int[]{ - AL.INVALID, - AL.INVALID, - ALC.INVALID, - AL.NONE, - AL.FALSE, - ALC.FALSE, - AL.TRUE, - ALC.TRUE, - AL.SOURCE_RELATIVE, - AL.CONE_INNER_ANGLE, - AL.CONE_OUTER_ANGLE, - AL.PITCH, - AL.POSITION, - AL.DIRECTION, - AL.VELOCITY, - AL.LOOPING, - AL.BUFFER, - AL.GAIN, - AL.MIN_GAIN, - AL.MAX_GAIN, - AL.ORIENTATION, - AL.REFERENCE_DISTANCE, - AL.ROLLOFF_FACTOR, - AL.CONE_OUTER_GAIN, - AL.MAX_DISTANCE, - AL.SOURCE_STATE, - AL.INITIAL, - AL.PLAYING, - AL.PAUSED, - AL.STOPPED, - AL.BUFFERS_QUEUED, - AL.BUFFERS_PROCESSED, - AL.FORMAT_MONO8, - AL.FORMAT_MONO16, - AL.FORMAT_STEREO8, - AL.FORMAT_STEREO16, - AL.FREQUENCY, - AL.SIZE, - AL.UNUSED, - AL.PENDING, - AL.PROCESSED, - ALC.MAJOR_VERSION, - ALC.MINOR_VERSION, - ALC.ATTRIBUTES_SIZE, - ALC.ALL_ATTRIBUTES, - ALC.DEFAULT_DEVICE_SPECIFIER, - ALC.DEVICE_SPECIFIER, - ALC.EXTENSIONS, - ALC.FREQUENCY, - ALC.REFRESH, - ALC.SYNC, - AL.NO_ERROR, - AL.INVALID_NAME, - AL.INVALID_ENUM, - AL.INVALID_VALUE, - AL.INVALID_OPERATION, - AL.OUT_OF_MEMORY, - ALC.NO_ERROR, - ALC.INVALID_DEVICE, - ALC.INVALID_CONTEXT, - ALC.INVALID_ENUM, - ALC.INVALID_VALUE, - ALC.OUT_OF_MEMORY, - AL.VENDOR, - AL.VERSION, - AL.RENDERER, - AL.EXTENSIONS, - AL.DOPPLER_FACTOR, - AL.DOPPLER_VELOCITY, - AL.DISTANCE_MODEL, - AL.INVERSE_DISTANCE, - AL.INVERSE_DISTANCE_CLAMPED + AL.AL_INVALID, + AL.AL_INVALID, + ALC.ALC_INVALID, + AL.AL_NONE, + AL.AL_FALSE, + ALC.ALC_FALSE, + AL.AL_TRUE, + ALC.ALC_TRUE, + AL.AL_SOURCE_RELATIVE, + AL.AL_CONE_INNER_ANGLE, + AL.AL_CONE_OUTER_ANGLE, + AL.AL_PITCH, + AL.AL_POSITION, + AL.AL_DIRECTION, + AL.AL_VELOCITY, + AL.AL_LOOPING, + AL.AL_BUFFER, + AL.AL_GAIN, + AL.AL_MIN_GAIN, + AL.AL_MAX_GAIN, + AL.AL_ORIENTATION, + AL.AL_REFERENCE_DISTANCE, + AL.AL_ROLLOFF_FACTOR, + AL.AL_CONE_OUTER_GAIN, + AL.AL_MAX_DISTANCE, + AL.AL_SOURCE_STATE, + AL.AL_INITIAL, + AL.AL_PLAYING, + AL.AL_PAUSED, + AL.AL_STOPPED, + AL.AL_BUFFERS_QUEUED, + AL.AL_BUFFERS_PROCESSED, + AL.AL_FORMAT_MONO8, + AL.AL_FORMAT_MONO16, + AL.AL_FORMAT_STEREO8, + AL.AL_FORMAT_STEREO16, + AL.AL_FREQUENCY, + AL.AL_SIZE, + AL.AL_UNUSED, + AL.AL_PENDING, + AL.AL_PROCESSED, + ALC.ALC_MAJOR_VERSION, + ALC.ALC_MINOR_VERSION, + ALC.ALC_ATTRIBUTES_SIZE, + ALC.ALC_ALL_ATTRIBUTES, + ALC.ALC_DEFAULT_DEVICE_SPECIFIER, + ALC.ALC_DEVICE_SPECIFIER, + ALC.ALC_EXTENSIONS, + ALC.ALC_FREQUENCY, + ALC.ALC_REFRESH, + ALC.ALC_SYNC, + AL.AL_NO_ERROR, + AL.AL_INVALID_NAME, + AL.AL_INVALID_ENUM, + AL.AL_INVALID_VALUE, + AL.AL_INVALID_OPERATION, + AL.AL_OUT_OF_MEMORY, + ALC.ALC_NO_ERROR, + ALC.ALC_INVALID_DEVICE, + ALC.ALC_INVALID_CONTEXT, + ALC.ALC_INVALID_ENUM, + ALC.ALC_INVALID_VALUE, + ALC.ALC_OUT_OF_MEMORY, + AL.AL_VENDOR, + AL.AL_VERSION, + AL.AL_RENDERER, + AL.AL_EXTENSIONS, + AL.AL_DOPPLER_FACTOR, + AL.AL_DOPPLER_VELOCITY, + AL.AL_DISTANCE_MODEL, + AL.AL_INVERSE_DISTANCE, + AL.AL_INVERSE_DISTANCE_CLAMPED }; /** Whether or not EAX is supported */ @@ -252,6 +251,20 @@ public class ALTest extends BasicTest { return temp.asFloatBuffer(); } + /** + * Creates a byte buffer to hold specified bytes + * - strictly a utility method + * + * @param size how many bytes to contain + * @return created ByteBuffer + */ + protected ByteBuffer createByteBuffer(int size) { + ByteBuffer temp = ByteBuffer.allocateDirect(4*size); + temp.order(ByteOrder.nativeOrder()); + + return temp; + } + /** * Sleeeeeep */ @@ -267,7 +280,7 @@ public class ALTest extends BasicTest { * Display error */ protected void displayALError(String text, int errorcode) { - System.out.println(text + " - " + al.getString(errorcode)); + System.out.println(text + " - " + AL.alGetString(errorcode)); } /** @@ -293,35 +306,35 @@ public class ALTest extends BasicTest { // Initialize Open AL manually // Clear Error Code - al.getError(); + AL.alGetError(); // Set Listener attributes // Position ... - al.listenerfv(AL.POSITION, Sys.getDirectBufferAddress(listenerPos)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alListenerfv(AL.AL_POSITION, listenerPos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alListenerfv POSITION : ", error); System.exit(-1); } // Velocity ... - al.listenerfv(AL.VELOCITY, Sys.getDirectBufferAddress(listenerVel)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alListenerfv(AL.AL_VELOCITY, listenerVel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alListenerfv VELOCITY : ", error); System.exit(-1); } // Orientation ... - al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alListenerfv(AL.AL_ORIENTATION, listenerOri); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alListenerfv ORIENTATION : ", error); System.exit(-1); } // Generate Buffers - al.genBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alGenBuffers(NUM_BUFFERS, buffers); - if ((error = al.getError()) != AL.NO_ERROR) { + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alGenBuffers :", error); System.exit(-1); } @@ -332,16 +345,16 @@ public class ALTest extends BasicTest { if (wavefile == null) { displayALError("LoadWAVFile footsteps.wav : ", error); // Delete Buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy footsteps.wav data into AL Buffer 0 - al.bufferData(buffers.get(0), wavefile.format, Sys.getDirectBufferAddress(wavefile.data), wavefile.data.capacity(), wavefile.samplerate); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alBufferData(buffers.get(0), wavefile.format, wavefile.data, wavefile.data.capacity(), wavefile.samplerate); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alBufferData buffer 0 : ", error); // Delete buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } @@ -354,16 +367,16 @@ public class ALTest extends BasicTest { if (wavefile == null) { displayALError("LoadWAVFile ding.wav : ", error); // Delete Buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy ding.wav data into AL Buffer 1 - al.bufferData(buffers.get(1), wavefile.format, Sys.getDirectBufferAddress(wavefile.data), wavefile.data.capacity(), wavefile.samplerate); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alBufferData(buffers.get(1), wavefile.format, wavefile.data, wavefile.data.capacity(), wavefile.samplerate); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alBufferData buffer 1 : ", error); // Delete buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } @@ -376,16 +389,16 @@ public class ALTest extends BasicTest { if (wavefile == null) { displayALError("LoadWAVFile wave1.wav : ", error); // Delete Buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy wave1.wav data into AL Buffer 2 - al.bufferData(buffers.get(2), wavefile.format, Sys.getDirectBufferAddress(wavefile.data), wavefile.data.capacity(), wavefile.samplerate); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alBufferData(buffers.get(2), wavefile.format, wavefile.data, wavefile.data.capacity(), wavefile.samplerate); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alBufferData buffer 2 : ", error); // Delete buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } @@ -398,16 +411,16 @@ public class ALTest extends BasicTest { if (wavefile == null) { displayALError("LoadWAVFile Wave2.wav : ", error); // Delete Buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy Wave2.wav data into AL Buffer 3 - al.bufferData(buffers.get(3), wavefile.format, Sys.getDirectBufferAddress(wavefile.data), wavefile.data.capacity(), wavefile.samplerate); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alBufferData(buffers.get(3), wavefile.format, wavefile.data, wavefile.data.capacity(), wavefile.samplerate); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alBufferData buffer 3 : ", error); // Delete buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } @@ -420,16 +433,16 @@ public class ALTest extends BasicTest { if (wavefile == null) { displayALError("LoadWAVFile wave3.wav : ", error); // Delete Buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy wave3.wav data into AL Buffer 4 - al.bufferData(buffers.get(4), wavefile.format, Sys.getDirectBufferAddress(wavefile.data), wavefile.data.capacity(), wavefile.samplerate); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alBufferData(buffers.get(4), wavefile.format, wavefile.data, wavefile.data.capacity(), wavefile.samplerate); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alBufferData buffer 4 : ", error); // Delete buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } @@ -442,16 +455,16 @@ public class ALTest extends BasicTest { if (wavefile == null) { displayALError("LoadWAVFile wave4.wav : ", error); // Delete Buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy wave4.wav data into AL Buffer 5 - al.bufferData(buffers.get(5), wavefile.format, Sys.getDirectBufferAddress(wavefile.data), wavefile.data.capacity(), wavefile.samplerate); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alBufferData(buffers.get(5), wavefile.format, wavefile.data, wavefile.data.capacity(), wavefile.samplerate); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alBufferData buffer 5 : ", error); // Delete buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } @@ -464,16 +477,16 @@ public class ALTest extends BasicTest { if (wavefile == null) { displayALError("LoadWAVFile stereo.wav : ", error); // Delete Buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy stereo.wav data into AL Buffer 6 - al.bufferData(buffers.get(6), wavefile.format, Sys.getDirectBufferAddress(wavefile.data), wavefile.data.capacity(), wavefile.samplerate); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alBufferData(buffers.get(6), wavefile.format, wavefile.data, wavefile.data.capacity(), wavefile.samplerate); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alBufferData buffer 6 : ", error); // Delete buffers - al.deleteBuffers(NUM_BUFFERS, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } @@ -482,7 +495,7 @@ public class ALTest extends BasicTest { wavefile = null; //do EAX check (can only be performed after device / context creation - eaxAvailable = al.isExtensionPresent("EAX"); + eaxAvailable = AL.alIsExtensionPresent("EAX"); do { System.out.print("\n\n\nAutomated Test Series:\n\n"); @@ -563,7 +576,6 @@ public class ALTest extends BasicTest { fA_VectorStateTransition(); // Vector State Transistion Testing fA_GetBufferProperties(); // Get Buffer Properties fA_EnumerationValue(); // Enumeration Value Test - fA_QueuingUnderrunStates(); // test underrun while queuing System.out.print("\n\n"); delay_ms(1000); @@ -577,26 +589,26 @@ public class ALTest extends BasicTest { int error; System.out.print("\nRequest Object Names Test. "); - al.getError(); // clear error state + AL.alGetError(); // clear error state localResultOK = true; - al.genBuffers(0, Sys.getDirectBufferAddress(testBuffers)); // should be equivalent to NOP - error = al.getError(); - if (error != AL.NO_ERROR) { + AL.alGenBuffers(0, testBuffers); // should be equivalent to NOP + error = AL.alGetError(); + if (error != AL.AL_NO_ERROR) { localResultOK = false; } - al.genSources(0, Sys.getDirectBufferAddress(testSources)); // should be equivalent to NOP - error = al.getError(); - if (error != AL.NO_ERROR) { + AL.alGenSources(0, testSources); // should be equivalent to NOP + error = AL.alGetError(); + if (error != AL.AL_NO_ERROR) { localResultOK = false; } - al.genBuffers(-1, Sys.getDirectBufferAddress(testBuffers)); // invalid -- make sure error code comes back - error = al.getError(); - if (error == AL.NO_ERROR) { + AL.alGenBuffers(-1, testBuffers); // invalid -- make sure error code comes back + error = AL.alGetError(); + if (error == AL.AL_NO_ERROR) { localResultOK = false; } - al.genSources(-1, Sys.getDirectBufferAddress(testSources)); // invalid -- make sure error code comes back - error = al.getError(); - if (error == AL.NO_ERROR) { + AL.alGenSources(-1, testSources); // invalid -- make sure error code comes back + error = AL.alGetError(); + if (error == AL.AL_NO_ERROR) { localResultOK = false; } if (localResultOK == true) { @@ -613,16 +625,16 @@ public class ALTest extends BasicTest { int error; System.out.print("\nReleasing Object Names Test. "); - al.getError(); + AL.alGetError(); localResultOK = true; - al.deleteBuffers(-1, Sys.getDirectBufferAddress(testBuffers)); // invalid -- make sure error code comes back - error = al.getError(); - if (error == AL.NO_ERROR) { + AL.alDeleteBuffers(-1, testBuffers); // invalid -- make sure error code comes back + error = AL.alGetError(); + if (error == AL.AL_NO_ERROR) { localResultOK = false; } - al.deleteSources(-1, Sys.getDirectBufferAddress(testSources)); // invalid -- make sure error code comes back - error = al.getError(); - if (error == AL.NO_ERROR) { + AL.alDeleteSources(-1, testSources); // invalid -- make sure error code comes back + error = AL.alGetError(); + if (error == AL.AL_NO_ERROR) { localResultOK = false; } if (localResultOK == true) { @@ -639,32 +651,32 @@ public class ALTest extends BasicTest { int error; System.out.print("\nValidating Object Names Test. "); - al.getError(); + AL.alGetError(); localResultOK = true; - al.genBuffers(1, Sys.getDirectBufferAddress(testBuffers)); - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - error = al.getError(); - if (error != AL.NO_ERROR) { + AL.alGenBuffers(1, testBuffers); + AL.alGenSources(1, testSources); + error = AL.alGetError(); + if (error != AL.AL_NO_ERROR) { localResultOK = false; } else { - if (al.isBuffer(testBuffers.get(0)) == false) // this buffer should test as valid + if (AL.alIsBuffer(testBuffers.get(0)) == false) // this buffer should test as valid { localResultOK = false; } - if (al.isSource(testSources.get(0)) == false) // this source should test as valid + if (AL.alIsSource(testSources.get(0)) == false) // this source should test as valid { localResultOK = false; } - if (al.isBuffer(testBuffers.get(0) + 1) == true) // this buffer should be invalid + if (AL.alIsBuffer(testBuffers.get(0) + 1) == true) // this buffer should be invalid { localResultOK = false; } - if (al.isSource(testSources.get(0) + 1) == true) // this source should be invalid + if (AL.alIsSource(testSources.get(0) + 1) == true) // this source should be invalid { localResultOK = false; } - al.deleteBuffers(1, Sys.getDirectBufferAddress(testBuffers)); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alDeleteBuffers(1, testBuffers); + AL.alDeleteSources(1, testSources); } if (localResultOK == true) { System.out.print("PASSED."); @@ -678,44 +690,44 @@ public class ALTest extends BasicTest { IntBuffer testSources = createIntBuffer(1); System.out.print("\nState Transition Test. "); - al.getError(); + AL.alGetError(); localResultOK = true; - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(0)); - al.sourcei(testSources.get(0), AL.LOOPING, AL.TRUE); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(0)); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); IntBuffer sourceState = createIntBuffer(1); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.INITIAL) { + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_INITIAL) { localResultOK = false; } - al.sourcePlay(testSources.get(0)); + AL.alSourcePlay(testSources.get(0)); delay_ms(500); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.PLAYING) { + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_PLAYING) { localResultOK = false; } - al.sourcePause(testSources.get(0)); + AL.alSourcePause(testSources.get(0)); delay_ms(500); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.PAUSED) { + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_PAUSED) { localResultOK = false; } - al.sourcePlay(testSources.get(0)); + AL.alSourcePlay(testSources.get(0)); delay_ms(500); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.PLAYING) { + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_PLAYING) { localResultOK = false; } - al.sourceStop(testSources.get(0)); + AL.alSourceStop(testSources.get(0)); delay_ms(500); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.STOPPED) { + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_STOPPED) { localResultOK = false; } if (localResultOK == true) { @@ -723,7 +735,7 @@ public class ALTest extends BasicTest { } else { System.out.print("FAILED."); } - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alDeleteSources(1, testSources); } protected void fA_VectorStateTransition() { @@ -734,82 +746,82 @@ public class ALTest extends BasicTest { IntBuffer sourceState = createIntBuffer(1); System.out.print("\nVector State Transition Test. "); - al.getError(); + AL.alGetError(); localResultOK = true; - al.genSources(2, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(0)); - al.sourcei(testSources.get(1), AL.BUFFER, buffers.get(1)); - al.sourcei(testSources.get(0), AL.LOOPING, AL.TRUE); - al.sourcei(testSources.get(1), AL.LOOPING, AL.TRUE); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); + AL.alGenSources(2, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(0)); + AL.alSourcei(testSources.get(1), AL.AL_BUFFER, buffers.get(1)); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); + AL.alSourcei(testSources.get(1), AL.AL_LOOPING, AL.AL_TRUE); + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); - if (sourceState.get(0) != AL.INITIAL) { + if (sourceState.get(0) != AL.AL_INITIAL) { localResultOK = false; System.out.print("FAILED -- AL_INITIAL 0"); } - al.getSourcei(testSources.get(1), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.INITIAL) { + AL.alGetSourcei(testSources.get(1), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_INITIAL) { localResultOK = false; System.out.print("FAILED -- AL_INITIAL 1"); } - al.sourcePlay(testSources.get(0)); - al.sourcePlay(testSources.get(1)); + AL.alSourcePlay(testSources.get(0)); + AL.alSourcePlay(testSources.get(1)); delay_ms(500); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.PLAYING) { + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_PLAYING) { localResultOK = false; System.out.print("FAILED -- AL_PLAYING 0"); } - al.getSourcei(testSources.get(1), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.PLAYING) { + AL.alGetSourcei(testSources.get(1), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_PLAYING) { localResultOK = false; System.out.print("FAILED -- AL_PLAYING 1"); } - al.sourcePause(testSources.get(0)); - al.sourcePause(testSources.get(1)); + AL.alSourcePause(testSources.get(0)); + AL.alSourcePause(testSources.get(1)); delay_ms(500); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.PAUSED) { + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_PAUSED) { localResultOK = false; System.out.print("FAILED -- AL_PAUSED 0"); } - al.getSourcei(testSources.get(1), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.PAUSED) { + AL.alGetSourcei(testSources.get(1), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_PAUSED) { localResultOK = false; System.out.print("FAILED -- AL_PAUSED 1"); } - al.sourcePlay(testSources.get(0)); - al.sourcePlay(testSources.get(1)); + AL.alSourcePlay(testSources.get(0)); + AL.alSourcePlay(testSources.get(1)); delay_ms(500); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.PLAYING) { + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_PLAYING) { localResultOK = false; System.out.print("FAILED -- AL_PLAYING 0A"); } - al.getSourcei(testSources.get(1), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.PLAYING) { + AL.alGetSourcei(testSources.get(1), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_PLAYING) { localResultOK = false; System.out.print("FAILED -- AL_PLAYING 1A"); } - al.sourceStop(testSources.get(0)); - al.sourceStop(testSources.get(1)); + AL.alSourceStop(testSources.get(0)); + AL.alSourceStop(testSources.get(1)); delay_ms(500); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.STOPPED) { + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_STOPPED) { localResultOK = false; System.out.print("FAILED -- AL_STOPPED 0"); } - al.getSourcei(testSources.get(1), AL.SOURCE_STATE, Sys.getDirectBufferAddress(sourceState)); - if (sourceState.get(0) != AL.STOPPED) { + AL.alGetSourcei(testSources.get(1), AL.AL_SOURCE_STATE, sourceState); + if (sourceState.get(0) != AL.AL_STOPPED) { localResultOK = false; System.out.print("FAILED -- AL_STOPPED 1"); } @@ -818,25 +830,26 @@ public class ALTest extends BasicTest { } else { System.out.print("FAILED."); } - al.deleteSources(2, Sys.getDirectBufferAddress(testSources)); + AL.alDeleteSources(2, testSources); } protected void fA_GetBufferProperties() { - IntBuffer data = createIntBuffer(4); + ByteBuffer freq = createByteBuffer(16); + ByteBuffer bits = ((ByteBuffer) freq.position(4)).slice().order(ByteOrder.nativeOrder()); + ByteBuffer chan = ((ByteBuffer) freq.position(8)).slice().order(ByteOrder.nativeOrder()); + ByteBuffer size = ((ByteBuffer) freq.position(12)).slice().order(ByteOrder.nativeOrder()); boolean passNULL; System.out.print("\nGet Buffer Properties Test. "); - al.getBufferi(buffers.get(0), AL.FREQUENCY, Sys.getDirectBufferAddress(data)); - al.getBufferi(buffers.get(0), AL.BITS, Sys.getDirectBufferAddress(data)+4); - al.getBufferi(buffers.get(0), AL.CHANNELS, Sys.getDirectBufferAddress(data)+8); - al.getBufferi(buffers.get(0), AL.SIZE, Sys.getDirectBufferAddress(data)+12); + AL.alGetBufferi(buffers.get(0), AL.AL_FREQUENCY, freq); + AL.alGetBufferi(buffers.get(0), AL.AL_BITS, bits); + AL.alGetBufferi(buffers.get(0), AL.AL_CHANNELS, chan); + AL.alGetBufferi(buffers.get(0), AL.AL_SIZE, size); - passNULL = !(al.isBuffer(0)); // the NULL buffer should cause alIsBuffer to be FALSE - - data.rewind(); + passNULL = !(AL.alIsBuffer(0)); // the NULL buffer should cause alIsBuffer to be FALSE // FREQ BITS CH SIZE - if ((data.get(0) == 44100) && (data.get(1) == 16) && (data.get(2) == 1) && (data.get(3) == 282626) && (passNULL == true)) { + if ((freq.getInt(0) == 44100) && (bits.getInt(0) == 16) && (chan.getInt(0) == 1) && (size.getInt(0) == 282626) && (passNULL == true)) { System.out.print("PASSED."); } else { System.out.print("FAILED."); @@ -851,7 +864,7 @@ public class ALTest extends BasicTest { System.out.print("\nEnumeration Value Test. "); while (i < enumerationString.length) { - getVal = al.getEnumValue(enumerationString[i]); + getVal = AL.alGetEnumValue(enumerationString[i]); if (getVal != enumeration[i]) { System.out.print("\n" + enumerationString[i] + " has an invalid enum value."); result = false; @@ -865,59 +878,6 @@ public class ALTest extends BasicTest { System.out.print("FAILED."); } } - - protected void fA_QueuingUnderrunStates() { - int error; - IntBuffer testSources = createIntBuffer(1); - IntBuffer tempInt = createIntBuffer(1); - IntBuffer bufferName = createIntBuffer(1); - - FloatBuffer listenerOri = createFloatBuffer(6); - listenerOri.put(new float[] {0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f}); - - FloatBuffer sourceOri = createFloatBuffer(6); - sourceOri.put(new float[] {1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f}); - - boolean localResultOK; - - System.out.print("\nQueuing Underrun States Test. "); - localResultOK = true; - al.getError(); - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.sourcei(testSources.get(0), AL.LOOPING, AL.FALSE); - if ((error = al.getError()) != AL.NO_ERROR) - displayALError("Init error : ", error); - al.sourceQueueBuffers(testSources.get(0), 1, Sys.getDirectBufferAddress(buffers) + (4)); - if ((error = al.getError()) != AL.NO_ERROR) localResultOK = false; - al.sourcePlay(testSources.get(0)); - delay_ms(1000); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(tempInt)); - if (tempInt.get(0) != AL.STOPPED) localResultOK = false; - al.getSourcei(testSources.get(0), AL.BUFFERS_PROCESSED, Sys.getDirectBufferAddress(tempInt)); - if (tempInt.get(0) != 1) { - localResultOK = false; - } else { - al.sourceUnqueueBuffers(testSources.get(0), tempInt.get(0), Sys.getDirectBufferAddress(bufferName)); - } - al.sourceQueueBuffers(testSources.get(0), 1, Sys.getDirectBufferAddress(buffers) + (4*1)); - if ((error = al.getError()) != AL.NO_ERROR) localResultOK = false; - al.sourcePlay(testSources.get(0)); - delay_ms(100); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(tempInt)); - if (tempInt.get(0) != AL.PLAYING) localResultOK = false; - - // cleanup - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); - - // display result - if (localResultOK == true) { - System.out.print("PASSED."); - } else { - System.out.print("FAILED."); - } - } protected void semiAutoTests() { sA_StringQueries(); // String Queries Test @@ -989,24 +949,24 @@ public class ALTest extends BasicTest { String tempString; - tempString = alc.getString(ALC.DEVICE_SPECIFIER); + tempString = ALC.alcGetString(ALC.ALC_DEVICE_SPECIFIER); System.out.print("OpenAL Context Device Specifier is '" + tempString + "'\n"); - tempString = al.getString(AL.RENDERER); + tempString = AL.alGetString(AL.AL_RENDERER); System.out.print("OpenAL Renderer is '" + tempString + "'\n"); - tempString = al.getString(AL.VERSION); + tempString = AL.alGetString(AL.AL_VERSION); System.out.print("OpenAL Version is '" + tempString + "'\n"); - tempString = al.getString(AL.VENDOR); + tempString = AL.alGetString(AL.AL_VENDOR); System.out.print("OpenAL Vendor is '" + tempString + "'\n"); - tempString = al.getString(AL.EXTENSIONS); + tempString = AL.alGetString(AL.AL_EXTENSIONS); System.out.print("OpenAL Extensions supported are :\n" + tempString + "\n"); System.out.print("\nError Codes are :-\n"); - System.out.print("AL_NO_ERROR : '" + al.getString(AL.NO_ERROR) + "'\n"); + System.out.print("AL_NO_ERROR : '" + AL.alGetString(AL.AL_NO_ERROR) + "'\n"); - System.out.print("AL_INVALID_ENUM : '" + al.getString(AL.INVALID_ENUM) + "'\n"); - System.out.print("AL_INVALID_VALUE : '" + al.getString(AL.INVALID_VALUE) + "'\n"); + System.out.print("AL_INVALID_ENUM : '" + AL.alGetString(AL.AL_INVALID_ENUM) + "'\n"); + System.out.print("AL_INVALID_VALUE : '" + AL.alGetString(AL.AL_INVALID_VALUE) + "'\n"); - System.out.print("AL_INVALID_OPERATION : '" + al.getString(AL.INVALID_OPERATION) + "'\n"); - System.out.print("AL_OUT_OF_MEMORY : '" + al.getString(AL.OUT_OF_MEMORY) + "'\n"); + System.out.print("AL_INVALID_OPERATION : '" + AL.alGetString(AL.AL_INVALID_OPERATION) + "'\n"); + System.out.print("AL_OUT_OF_MEMORY : '" + AL.alGetString(AL.AL_OUT_OF_MEMORY) + "'\n"); CRForNextTest(); } } @@ -1022,31 +982,31 @@ public class ALTest extends BasicTest { System.out.print("Source Gain Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("The following sound effect will be played at full source gain (Press Return):\n"); CRToContinue(); - al.sourcef(Sys.getDirectBufferAddress(testSources),AL.GAIN,1.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0),AL.AL_GAIN,1.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The following sound effect will be played at half source gain (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0),AL.GAIN,0.5f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0),AL.AL_GAIN,0.5f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The following sound effect will be played at quarter source gain (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0),AL.GAIN,0.25f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0),AL.AL_GAIN,0.25f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The following sound effect will be played at 1/20th source gain (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0),AL.GAIN,0.05f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0),AL.AL_GAIN,0.05f); + AL.alSourcePlay(testSources.get(0)); CRForNextTest(); - al.sourcef(testSources.get(0),AL.GAIN,1.0f); + AL.alSourcef(testSources.get(0),AL.AL_GAIN,1.0f); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1061,35 +1021,35 @@ public class ALTest extends BasicTest { System.out.print("Listener Gain Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("The following sound effect will be played at full listener gain (Press Return):\n"); CRToContinue(); - al.listenerf(AL.GAIN,1.0f); - al.sourcePlay(testSources.get(0)); + AL.alListenerf(AL.AL_GAIN,1.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The following sound effect will be played at half listener gain (Press Return):\n"); CRToContinue(); - al.listenerf(AL.GAIN,0.5f); - al.sourcePlay(testSources.get(0)); + AL.alListenerf(AL.AL_GAIN,0.5f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The following sound effect will be played at quarter listener gain (Press Return):\n"); CRToContinue(); - al.listenerf(AL.GAIN,0.25f); - al.sourcePlay(testSources.get(0)); + AL.alListenerf(AL.AL_GAIN,0.25f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The following sound effect will be played at 1/20th listener gain (Press Return):\n"); CRToContinue(); - al.listenerf(AL.GAIN,0.05f); - al.sourcePlay(testSources.get(0)); + AL.alListenerf(AL.AL_GAIN,0.05f); + AL.alSourcePlay(testSources.get(0)); CRForNextTest(); - al.listenerf(AL.GAIN,1.0f); + AL.alListenerf(AL.AL_GAIN,1.0f); FloatBuffer f = createFloatBuffer(1); - al.getListenerf(AL.GAIN, Sys.getDirectBufferAddress(f)); + AL.alGetListenerf(AL.AL_GAIN, f); if (f.get(0) != 1.0) { System.out.print("ERROR: alGetListenerf failed.\n"); } - al.sourceStop(testSources.get(0)); + AL.alSourceStop(testSources.get(0)); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1106,59 +1066,59 @@ public class ALTest extends BasicTest { System.out.print("Position Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("Trying Left-to-Right sweep by moving listener(Press Return):\n"); CRToContinue(); - al.sourcei(testSources.get(0), AL.LOOPING, AL.TRUE); - al.listener3f(AL.POSITION, 100.0f, 0.0f, 0.0f); - al.getListener3f(AL.POSITION, Sys.getDirectBufferAddress(tempFVect), Sys.getDirectBufferAddress(tempFVect) + 4, Sys.getDirectBufferAddress(tempFVect) + 8); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); + AL.alListener3f(AL.AL_POSITION, 100.0f, 0.0f, 0.0f); + AL.alGetListenerfv(AL.AL_POSITION, tempFVect); if ((tempFVect.get(0) != 100.0f) || (tempFVect.get(1) != 0.0f) || (tempFVect.get(2) != 0.0f)) { System.out.print("ERROR: alGetListener3f(AL_POSITION, ...).\n"); } - al.getListenerfv(AL.POSITION, Sys.getDirectBufferAddress(tempFVect)); + AL.alGetListenerfv(AL.AL_POSITION, tempFVect); if ((tempFVect.get(0) != 100.0f) || (tempFVect.get(1) != 0.0) || (tempFVect.get(2) != 0.0f)) { System.out.print("ERROR: alGetListenerfv(AL_POSITION, ...).\n"); } - al.sourcePlay(testSources.get(0)); + AL.alSourcePlay(testSources.get(0)); for (i = -100; i < 100; i++) { - al.listener3f(AL.POSITION, (float) -i, 0.0f, 0.0f); + AL.alListener3f(AL.AL_POSITION, (float) -i, 0.0f, 0.0f); delay_ms(100); } - al.listener3f(AL.POSITION, 0.0f, 0.0f, 0.0f); - al.sourceStop(testSources.get(0)); + AL.alListener3f(AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alSourceStop(testSources.get(0)); System.out.print("Trying Left-to-Right sweep by moving source (Press Return):\n"); CRToContinue(); - al.sourcei(testSources.get(0), AL.LOOPING, AL.TRUE); - al.source3f(testSources.get(0), AL.POSITION, -100.0f, 0.0f, 0.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, -100.0f, 0.0f, 0.0f); + AL.alSourcePlay(testSources.get(0)); for (i = -100; i < 100; i++) { - al.source3f(testSources.get(0), AL.POSITION, (float) i, 0.0f, 0.0f); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, (float) i, 0.0f, 0.0f); delay_ms(100); } - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, 0.0f); - al.sourceStop(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alSourceStop(testSources.get(0)); System.out.print("Trying Back-to-Front sweep (Press Return):\n"); CRToContinue(); - al.sourcei(testSources.get(0), AL.LOOPING, AL.TRUE); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -100.0f); - al.getSourcefv(testSources.get(0), AL.POSITION, Sys.getDirectBufferAddress(tempFVect)); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -100.0f); + AL.alGetSourcefv(testSources.get(0), AL.AL_POSITION, tempFVect); if ((tempFVect.get(0) != 0.0f) || (tempFVect.get(1) != 0.0f) || (tempFVect.get(2) != -100.0f)) { System.out.print("ERROR: alGetSourcefv(..., AL_POSITION, ...).\n"); } - al.sourcePlay(testSources.get(0)); + AL.alSourcePlay(testSources.get(0)); for (i = -100; i < 100; i++) { - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, (float) -i); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, (float) -i); delay_ms(100); } - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, 0.0f); - al.sourceStop(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alSourceStop(testSources.get(0)); CRForNextTest(); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1173,43 +1133,43 @@ public class ALTest extends BasicTest { System.out.print("Source Relative Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("Placing Listener at (100, 0, 0) and sweeping source from (0, 0, 0) to (100, 0, 0). The sound should pan from left to center (Press Return):\n"); CRToContinue(); - al.listener3f(AL.POSITION, 100.0f, 0.0f, 0.0f); - al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); - al.sourcei(testSources.get(0), AL.LOOPING, AL.TRUE); - al.source3f(testSources.get(0), AL.POSITION, -10.0f, 0.0f, 0.0f); - al.sourcePlay(testSources.get(0)); + AL.alListener3f(AL.AL_POSITION, 100.0f, 0.0f, 0.0f); + AL.alListenerfv(AL.AL_ORIENTATION, listenerOri); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, -10.0f, 0.0f, 0.0f); + AL.alSourcePlay(testSources.get(0)); for (i = 00; i < 100; i++) { - al.source3f(testSources.get(0), AL.POSITION, (float) i, 0.0f, 0.0f); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, (float) i, 0.0f, 0.0f); delay_ms(100); } - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, 0.0f); - al.sourceStop(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alSourceStop(testSources.get(0)); System.out.print("Turning on source relative mode, placing Listener at (100, 0, 0), and sweeping source from (0, 0, 0) to (100, 0, 0). The sound should pan from center to right (Press Return):\n"); CRToContinue(); - al.sourcei(testSources.get(0), AL.SOURCE_RELATIVE, AL.TRUE); - al.sourcei(testSources.get(0), AL.LOOPING, AL.TRUE); - al.source3f(testSources.get(0), AL.POSITION, -100.0f, 0.0f, 0.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcei(testSources.get(0), AL.AL_SOURCE_RELATIVE, AL.AL_TRUE); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, -100.0f, 0.0f, 0.0f); + AL.alSourcePlay(testSources.get(0)); for (i = 0; i < 100; i++) { - al.source3f(testSources.get(0), AL.POSITION, (float) i, 0.0f, 0.0f); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, (float) i, 0.0f, 0.0f); delay_ms(100); } - al.listener3f(AL.POSITION, 0.0f, 0.0f, 0.0f); - al.sourcei(testSources.get(0), AL.SOURCE_RELATIVE, AL.FALSE); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, 0.0f); - al.sourceStop(testSources.get(0)); + AL.alListener3f(AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alSourcei(testSources.get(0), AL.AL_SOURCE_RELATIVE, AL.AL_FALSE); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alSourceStop(testSources.get(0)); CRForNextTest(); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1225,28 +1185,28 @@ public class ALTest extends BasicTest { System.out.print("Listener Orientation Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("The listener will be placed at (1, 0, 0) and will face the -X direction. The sound should be centered. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, 0.0f); - al.listenerf(AL.GAIN,1.0f); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alListenerf(AL.AL_GAIN,1.0f); FloatBuffer f = createFloatBuffer(1); - al.getSourcef(testSources.get(0), AL.GAIN, Sys.getDirectBufferAddress(f)); + AL.alGetSourcef(testSources.get(0), AL.AL_GAIN, f); if (f.get(0) != 1.0f) { System.out.print("ERROR: alGetSourcef(..., AL_GAIN, ...).\n"); } - al.listener3f(AL.POSITION, 1.0f, 0.0f, 0.0f); + AL.alListener3f(AL.AL_POSITION, 1.0f, 0.0f, 0.0f); listenerOri.put(0, listenerOri.get(0)-1.0f); listenerOri.put(1, 0.0f); listenerOri.put(2, 0.0f); listenerOri.put(3, 0.0f); listenerOri.put(4, 1.0f); listenerOri.put(5, 0.0f); - al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); - al.sourcei(testSources.get(0), AL.LOOPING, AL.TRUE); - al.sourcePlay(testSources.get(0)); + AL.alListenerfv(AL.AL_ORIENTATION, listenerOri); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); + AL.alSourcePlay(testSources.get(0)); delay_ms(4000); - al.sourceStop(testSources.get(0)); + AL.alSourceStop(testSources.get(0)); System.out.print("The listener will now be oriented down the -Z axis. The sound should be to the left. (Press Return):\n"); CRToContinue(); @@ -1256,10 +1216,10 @@ public class ALTest extends BasicTest { listenerOri.put(3, 0.0f); listenerOri.put(4, 1.0f); listenerOri.put(5, 0.0f); - al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); - al.sourcePlay(testSources.get(0)); + AL.alListenerfv(AL.AL_ORIENTATION, listenerOri); + AL.alSourcePlay(testSources.get(0)); delay_ms(4000); - al.sourceStop(testSources.get(0)); + AL.alSourceStop(testSources.get(0)); System.out.print("The listener will now be turned upside-down (the 'up' direction will be (0, -1, 0)). The sound should be to the right. (Press Return):\n"); CRToContinue(); @@ -1269,10 +1229,10 @@ public class ALTest extends BasicTest { listenerOri.put(3, 0.0f); listenerOri.put(4, listenerOri.get(4)-1.0f); listenerOri.put(5, 0.0f); - al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); - al.sourcePlay(testSources.get(0)); + AL.alListenerfv(AL.AL_ORIENTATION, listenerOri); + AL.alSourcePlay(testSources.get(0)); delay_ms(4000); - al.sourceStop(testSources.get(0)); + AL.alSourceStop(testSources.get(0)); System.out.print("The listener will now be oriented down the +Z axis (and the 'up' direction is now (0, 1, 0) again). The sound should be to the right. (Press Return):\n"); CRToContinue(); @@ -1282,25 +1242,25 @@ public class ALTest extends BasicTest { listenerOri.put(3, 0.0f); listenerOri.put(4, 1.0f); listenerOri.put(5, 0.0f); - al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); - al.sourcePlay(testSources.get(0)); + AL.alListenerfv(AL.AL_ORIENTATION, listenerOri); + AL.alSourcePlay(testSources.get(0)); delay_ms(4000); - al.sourceStop(testSources.get(0)); + AL.alSourceStop(testSources.get(0)); CRForNextTest(); - al.listenerf(AL.GAIN,1.0f); - al.listener3f(AL.POSITION, 0.0f, 0.0f, 0.0f); + AL.alListenerf(AL.AL_GAIN,1.0f); + AL.alListener3f(AL.AL_POSITION, 0.0f, 0.0f, 0.0f); listenerOri.put(0, 0.0f); listenerOri.put(1, 0.0f); listenerOri.put(2, listenerOri.get(2)-1.0f); listenerOri.put(3, 0.0f); listenerOri.put(4, 1.0f); listenerOri.put(5, 0.0f); - al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); + AL.alListenerfv(AL.AL_ORIENTATION, listenerOri); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1322,35 +1282,35 @@ public class ALTest extends BasicTest { System.out.print("Source Cone Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("The listener will be at (0,0,0). The source will be at (0,0,-1). The source will be directly facing the listener and should be loud. (Press Return):\n"); CRToContinue(); - al.listener3f(AL.POSITION, 0.0f, 0.0f, 0.0f); - al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); - al.sourcef(testSources.get(0), AL.CONE_INNER_ANGLE, 10.0f); - al.sourcef(testSources.get(0), AL.CONE_OUTER_ANGLE, 270.0f); - al.sourcef(testSources.get(0), AL.CONE_OUTER_GAIN, (float)0.01); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -1.0f); - al.sourcefv(testSources.get(0), AL.DIRECTION, Sys.getDirectBufferAddress(sourceOri)); - al.sourcePlay(testSources.get(0)); + AL.alListener3f(AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alListenerfv(AL.AL_ORIENTATION, listenerOri); + AL.alSourcef(testSources.get(0), AL.AL_CONE_INNER_ANGLE, 10.0f); + AL.alSourcef(testSources.get(0), AL.AL_CONE_OUTER_ANGLE, 270.0f); + AL.alSourcef(testSources.get(0), AL.AL_CONE_OUTER_GAIN, (float)0.01); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -1.0f); + AL.alSourcefv(testSources.get(0), AL.AL_DIRECTION, sourceOri); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will now point between the inner and outer cones, and should be at medium volume. (Press Return):\n"); CRToContinue(); - al.sourcefv(testSources.get(0), AL.DIRECTION, Sys.getDirectBufferAddress(sourceOri2)); - al.sourcePlay(testSources.get(0)); + AL.alSourcefv(testSources.get(0), AL.AL_DIRECTION, sourceOri2); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will now point behind the outer cone and will be at low volume. (Press Return):\n"); CRToContinue(); - al.sourcefv(testSources.get(0), AL.DIRECTION, Sys.getDirectBufferAddress(sourceOri3)); - al.sourcePlay(testSources.get(0)); + AL.alSourcefv(testSources.get(0), AL.AL_DIRECTION, sourceOri3); + AL.alSourcePlay(testSources.get(0)); CRForNextTest(); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1365,48 +1325,48 @@ public class ALTest extends BasicTest { System.out.print("MIN/MAX Gain Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("The source will be played at GAIN 1.0 with MAX gain set to 1.0. This should be high volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.GAIN, 1.0f); - al.sourcef(testSources.get(0), AL.MAX_GAIN, 1.0f); - al.sourcei(testSources.get(0), AL.LOOPING, AL.FALSE); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_GAIN, 1.0f); + AL.alSourcef(testSources.get(0), AL.AL_MAX_GAIN, 1.0f); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_FALSE); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be played at GAIN 0.1 with MIN gain set to 0.6. This should be at medium volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.GAIN, (float) 0.1); - al.sourcef(testSources.get(0), AL.MIN_GAIN, (float) 0.6); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_GAIN, (float) 0.1); + AL.alSourcef(testSources.get(0), AL.AL_MIN_GAIN, (float) 0.6); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be played at GAIN 1.0 with MAX gain set to 0.1. This should be low volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.GAIN, 1.0f); - al.sourcef(testSources.get(0), AL.MAX_GAIN, (float) 0.1); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_GAIN, 1.0f); + AL.alSourcef(testSources.get(0), AL.AL_MAX_GAIN, (float) 0.1); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be played at GAIN 0.1 with MIN gain set to 0.0. This should be low volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.GAIN, (float) 0.1); - al.sourcef(testSources.get(0), AL.MIN_GAIN, 0.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_GAIN, (float) 0.1); + AL.alSourcef(testSources.get(0), AL.AL_MIN_GAIN, 0.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be played at GAIN 1.0 with MAX gain set to 0.0. This should be zero volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.GAIN, (float) 1.0); - al.sourcef(testSources.get(0), AL.MAX_GAIN, 0.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_GAIN, (float) 1.0); + AL.alSourcef(testSources.get(0), AL.AL_MAX_GAIN, 0.0f); + AL.alSourcePlay(testSources.get(0)); CRForNextTest(); - al.sourcef(testSources.get(0), AL.GAIN, 1.0f); - al.sourcef(testSources.get(0), AL.MAX_GAIN, 1.0f); - al.sourcef(testSources.get(0), AL.MIN_GAIN, 0.0f); + AL.alSourcef(testSources.get(0), AL.AL_GAIN, 1.0f); + AL.alSourcef(testSources.get(0), AL.AL_MAX_GAIN, 1.0f); + AL.alSourcef(testSources.get(0), AL.AL_MIN_GAIN, 0.0f); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1421,33 +1381,33 @@ public class ALTest extends BasicTest { System.out.print("Reference Distance Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("The source will be placed at (0, 0, -10), and the reference distance set at 1.0. This should be low volume. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -10.0f); - al.sourcef(testSources.get(0), AL.REFERENCE_DISTANCE, 1.0f); - al.sourcei(testSources.get(0), AL.LOOPING, AL.FALSE); - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -10.0f); + AL.alSourcef(testSources.get(0), AL.AL_REFERENCE_DISTANCE, 1.0f); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_FALSE); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be played with the reference distance set to 3.0. This should be medium volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.REFERENCE_DISTANCE, 3.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_REFERENCE_DISTANCE, 3.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be played with the reference distance set to 10.0. This should be high volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.REFERENCE_DISTANCE, 10.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_REFERENCE_DISTANCE, 10.0f); + AL.alSourcePlay(testSources.get(0)); CRForNextTest(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, 0.0f); - al.sourcef(testSources.get(0), AL.REFERENCE_DISTANCE, 1.0f); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alSourcef(testSources.get(0), AL.AL_REFERENCE_DISTANCE, 1.0f); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1462,36 +1422,36 @@ public class ALTest extends BasicTest { System.out.print("Rolloff Factor Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("The source will be played with the rolloff factor set to 0.0. This should be high volume. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -10.0f); - al.sourcei(testSources.get(0), AL.LOOPING, AL.FALSE); - al.sourcef(testSources.get(0), AL.ROLLOFF_FACTOR, 0.0f); - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -10.0f); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_FALSE); + AL.alSourcef(testSources.get(0), AL.AL_ROLLOFF_FACTOR, 0.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be placed at (0, 0, -10), and the rolloff factor set at 1.0. This should be medium volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.ROLLOFF_FACTOR, 1.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_ROLLOFF_FACTOR, 1.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be played with the rolloff factor set to 3.0. This should be low volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.ROLLOFF_FACTOR, 3.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_ROLLOFF_FACTOR, 3.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be played with the rolloff factor set to 10.0. This should be very low volume. (Press Return):\n"); CRToContinue(); - al.sourcef(testSources.get(0), AL.ROLLOFF_FACTOR, 10.0f); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_ROLLOFF_FACTOR, 10.0f); + AL.alSourcePlay(testSources.get(0)); CRForNextTest(); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1506,58 +1466,58 @@ public class ALTest extends BasicTest { System.out.print("Distance Model Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("The source will be placed at (0, 0, -10). This should be low volume. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -10.0f); - al.distanceModel(AL.INVERSE_DISTANCE); - al.sourcei(testSources.get(0), AL.LOOPING, AL.FALSE); - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -10.0f); + AL.alDistanceModel(AL.AL_INVERSE_DISTANCE); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_FALSE); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be placed at (0, 0, -1). This should be high volume. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -1.0f); - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -1.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be placed at (0, 0, -10) and the distance model will be set to AL_NONE. This should be high volume. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -10.0f); - al.distanceModel(AL.NONE); - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -10.0f); + AL.alDistanceModel(AL.AL_NONE); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be placed at (0, 0, -100) and the distance model will remain AL_NONE. This should be high volume. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -100.0f); - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -100.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be placed at (0, 0, -100) and the distance model will be AL_INVERSE_DISTANCE_CLAMPED. AL_MAX_DISTANCE will be set to 100.0. This should be low volume. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -100.0f); - al.distanceModel(AL.INVERSE_DISTANCE_CLAMPED); - al.sourcef(testSources.get(0), AL.MAX_DISTANCE, 100.0f); - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -100.0f); + AL.alDistanceModel(AL.AL_INVERSE_DISTANCE_CLAMPED); + AL.alSourcef(testSources.get(0), AL.AL_MAX_DISTANCE, 100.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be placed at (0, 0, -100) and the distance model will be AL_INVERSE_DISTANCE_CLAMPED. AL_MAX_DISTANCE will be set to 20.0. This should be louder. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -100.0f); - al.sourcef(testSources.get(0), AL.MAX_DISTANCE, 20.0f); - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -100.0f); + AL.alSourcef(testSources.get(0), AL.AL_MAX_DISTANCE, 20.0f); + AL.alSourcePlay(testSources.get(0)); System.out.print("The source will be placed at (0, 0, -100) and the distance model will be AL_INVERSE_DISTANCE_CLAMPED. AL_MAX_DISTANCE will be set to 5.0. This should be high volume. (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, -100.0f); - al.sourcef(testSources.get(0), AL.MAX_DISTANCE, 5.0f); - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, -100.0f); + AL.alSourcef(testSources.get(0), AL.AL_MAX_DISTANCE, 5.0f); + AL.alSourcePlay(testSources.get(0)); CRForNextTest(); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, 0.0f); - al.distanceModel(AL.INVERSE_DISTANCE); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alDistanceModel(AL.AL_INVERSE_DISTANCE); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1573,54 +1533,54 @@ public class ALTest extends BasicTest { System.out.print("Doppler Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("Trying Left-to-Right sweep with doppler shift (Press Return):\n"); CRToContinue(); - al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); - al.sourcei(testSources.get(0), AL.LOOPING, AL.TRUE); - al.source3f(testSources.get(0), AL.POSITION, -100.0f, 0.0f, 0.0f); - al.source3f(testSources.get(0), AL.VELOCITY, 10.0f, 0.0f, 0.0f); - al.sourcefv(testSources.get(0), AL.ORIENTATION, Sys.getDirectBufferAddress(sourceOri)); - al.sourcePlay(testSources.get(0)); + AL.alListenerfv(AL.AL_ORIENTATION, listenerOri); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, -100.0f, 0.0f, 0.0f); + AL.alSource3f(testSources.get(0), AL.AL_VELOCITY, 10.0f, 0.0f, 0.0f); + AL.alSourcefv(testSources.get(0), AL.AL_ORIENTATION, sourceOri); + AL.alSourcePlay(testSources.get(0)); for (i = -100; i < 100; i++) { - al.source3f(testSources.get(0), AL.POSITION, (float) i, 0.0f, 0.0f); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, (float) i, 0.0f, 0.0f); delay_ms(100); } - al.sourceStop(testSources.get(0)); + AL.alSourceStop(testSources.get(0)); System.out.print("Trying Left-to-Right sweep with DopplerFactor set to 4.0 -- should be more extreme (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, -100.0f, 0.0f, 0.0f); - al.source3f(testSources.get(0), AL.VELOCITY, 10.0f, 0.0f, 0.0f); - al.dopplerFactor(4.0f); - if (al.getFloat(AL.DOPPLER_FACTOR) != 4.0f) { System.out.print(" alGetFloat(AL_DOPPLER_FACTOR) error.\n"); } - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, -100.0f, 0.0f, 0.0f); + AL.alSource3f(testSources.get(0), AL.AL_VELOCITY, 10.0f, 0.0f, 0.0f); + AL.alDopplerFactor(4.0f); + if (AL.alGetFloat(AL.AL_DOPPLER_FACTOR) != 4.0f) { System.out.print(" alGetFloat(AL_DOPPLER_FACTOR) error.\n"); } + AL.alSourcePlay(testSources.get(0)); for (i = -100; i < 100; i++) { - al.source3f(testSources.get(0), AL.POSITION, (float) i, 0.0f, 0.0f); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, (float) i, 0.0f, 0.0f); delay_ms(100); } - al.sourceStop(testSources.get(0)); - al.dopplerFactor(1.0f); + AL.alSourceStop(testSources.get(0)); + AL.alDopplerFactor(1.0f); System.out.print("Trying Left-to-Right sweep with DopplerVelocity set to 86 -- should remain extreme (Press Return):\n"); CRToContinue(); - al.source3f(testSources.get(0), AL.POSITION, -100.0f, 0.0f, 0.0f); - al.source3f(testSources.get(0), AL.VELOCITY, 10.0f, 0.0f, 0.0f); - al.dopplerVelocity(86); - if (al.getFloat(AL.DOPPLER_VELOCITY) != 86) { System.out.print(" alGetFloat(AL_DOPPLER_VELOCITY) error.\n"); } - al.sourcePlay(testSources.get(0)); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, -100.0f, 0.0f, 0.0f); + AL.alSource3f(testSources.get(0), AL.AL_VELOCITY, 10.0f, 0.0f, 0.0f); + AL.alDopplerVelocity(86); + if (AL.alGetFloat(AL.AL_DOPPLER_VELOCITY) != 86) { System.out.print(" alGetFloat(AL_DOPPLER_VELOCITY) error.\n"); } + AL.alSourcePlay(testSources.get(0)); for (i = -100; i < 100; i++) { - al.source3f(testSources.get(0), AL.POSITION, (float) i, 0.0f, 0.0f); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, (float) i, 0.0f, 0.0f); delay_ms(100); } - al.dopplerVelocity(343); - al.source3f(testSources.get(0), AL.POSITION, 0.0f, 0.0f, 0.0f); - al.sourceStop(testSources.get(0)); + AL.alDopplerVelocity(343); + AL.alSource3f(testSources.get(0), AL.AL_POSITION, 0.0f, 0.0f, 0.0f); + AL.alSourceStop(testSources.get(0)); CRForNextTest(); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1635,24 +1595,24 @@ public class ALTest extends BasicTest { System.out.print("Frequency Test:"); if (ContinueOrSkip() == 1) { // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("A source will be played eight times -- going from one-half to double it's native frequency (Press Return):\n"); CRToContinue(); - al.sourcei(testSources.get(0), AL.LOOPING, AL.FALSE); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_FALSE); for (i = 0; i < 8; i++) { - al.sourcef(testSources.get(0), AL.PITCH, (float) (0.5 + (float) i * 0.2)); - al.sourcePlay(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_PITCH, (float) (0.5 + (float) i * 0.2)); + AL.alSourcePlay(testSources.get(0)); delay_ms(2000); } - al.sourceStop(testSources.get(0)); - al.sourcef(testSources.get(0), AL.PITCH, 1.0f); + AL.alSourceStop(testSources.get(0)); + AL.alSourcef(testSources.get(0), AL.AL_PITCH, 1.0f); CRForNextTest(); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1667,30 +1627,30 @@ public class ALTest extends BasicTest { System.out.print("Stereo Test:"); if (ContinueOrSkip() == 1) { // clear error state - al.getError(); + AL.alGetError(); // load up sources - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, buffers.get(1)); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, buffers.get(1)); System.out.print("A stereo buffer will play twice in succession (Press Return):\n"); CRToContinue(); - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.sourcei(testSources.get(0), AL.LOOPING, AL.FALSE); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_FALSE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("Init error : ", error); - al.sourceQueueBuffers(testSources.get(0), 1, Sys.getDirectBufferAddress(buffers) + 4*6); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(testSources.get(0), 1, ((ByteBuffer)buffers.position(4*6)).slice().order(ByteOrder.nativeOrder())); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 1 (stereo) : ", error); - al.sourceQueueBuffers(testSources.get(0), 1, Sys.getDirectBufferAddress(buffers) + 4*6); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(testSources.get(0), 1, ((ByteBuffer)buffers.position(4*6)).slice().order(ByteOrder.nativeOrder())); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 1 (stereo) : ", error); - al.sourcePlay(testSources.get(0)); + AL.alSourcePlay(testSources.get(0)); CRForNextTest(); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1719,41 +1679,41 @@ public class ALTest extends BasicTest { if (ContinueOrSkip() == 1) { System.out.print("A stereo buffer will play once, there will be a brief pause, and then the buffer will play again (Press Return):\n"); CRToContinue(); - al.getError(); - al.genSources(1, Sys.getDirectBufferAddress(testSources)); - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.sourcei(testSources.get(0), AL.LOOPING, AL.FALSE); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alGetError(); + AL.alGenSources(1, testSources); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alSourcei(testSources.get(0), AL.AL_LOOPING, AL.AL_FALSE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("Init error : ", error); - al.sourceQueueBuffers(testSources.get(0), 1, Sys.getDirectBufferAddress(buffers) + 4*6); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(testSources.get(0), 1, ((ByteBuffer)buffers.position(4*6)).slice().order(ByteOrder.nativeOrder())); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 1 (stereo) : ", error); - al.sourcePlay(testSources.get(0)); + AL.alSourcePlay(testSources.get(0)); delay_ms(4000); - al.getSourcei(testSources.get(0), AL.SOURCE_STATE, Sys.getDirectBufferAddress(tempInt)); - if (tempInt.get(0) != AL.STOPPED) + AL.alGetSourcei(testSources.get(0), AL.AL_SOURCE_STATE, tempInt); + if (tempInt.get(0) != AL.AL_STOPPED) System.out.print("Wrong underrun state -- should be AL_STOPPED. "); - al.getSourcei(testSources.get(0), AL.BUFFERS_PROCESSED, Sys.getDirectBufferAddress(tempInt)); + AL.alGetSourcei(testSources.get(0), AL.AL_BUFFERS_PROCESSED, tempInt); if (tempInt.get(0) != 1) { System.out.print("Wrong underrun state -- should have one buffer processed. "); } else { - al.sourceUnqueueBuffers(testSources.get(0), tempInt.get(0), Sys.getDirectBufferAddress(bufferName)); + AL.alSourceUnqueueBuffers(testSources.get(0), tempInt.get(0), bufferName); } - al.sourceQueueBuffers(testSources.get(0), 1, Sys.getDirectBufferAddress(buffers) + 4*6); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(testSources.get(0), 1, ((ByteBuffer)buffers.position(4*6)).slice().order(ByteOrder.nativeOrder())); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 1 (stereo) : ", error); - al.sourcePlay(testSources.get(0)); + AL.alSourcePlay(testSources.get(0)); delay_ms(3000); System.out.print("The stereo buffer will now play twice with no pause (Press Return):\n"); CRToContinue(); - al.sourceQueueBuffers(testSources.get(0), 1, Sys.getDirectBufferAddress(buffers) + 4*6); - al.sourcePlay(testSources.get(0)); + AL.alSourceQueueBuffers(testSources.get(0), 1, ((ByteBuffer)buffers.position(4*6)).slice().order(ByteOrder.nativeOrder())); + AL.alSourcePlay(testSources.get(0)); delay_ms(4000); CRForNextTest(); // dispose of sources - al.sourcei(testSources.get(0), AL.BUFFER, 0); - al.deleteSources(1, Sys.getDirectBufferAddress(testSources)); + AL.alSourcei(testSources.get(0), AL.AL_BUFFER, 0); + AL.alDeleteSources(1, testSources); } } @@ -1775,69 +1735,69 @@ public class ALTest extends BasicTest { FloatBuffer source1Vel = createFloatBuffer(3); source1Vel.put(new float[] {0.0f, 0.0f, 0.0f}); - al.genSources(2, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alGenSources(2, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alGenSources 2 : ", error); return; } - al.sourcef(source.get(0),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(0),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 0 AL_PITCH : \n", error); } - al.sourcef(source.get(0),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(0),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 0 AL_GAIN : \n", error); } - al.sourcefv(source.get(0),AL.POSITION,Sys.getDirectBufferAddress(source0Pos)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(0),AL.AL_POSITION,source0Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 0 AL_POSITION : \n", error); } - al.sourcefv(source.get(0),AL.VELOCITY,Sys.getDirectBufferAddress(source0Vel)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(0),AL.AL_VELOCITY,source0Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 0 AL_VELOCITY : \n", error); } - al.sourcei(source.get(0),AL.BUFFER, buffers.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcei(source.get(0),AL.AL_BUFFER, buffers.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcei 0 AL_BUFFER buffer 0 : \n", error); } - al.sourcei(source.get(0),AL.LOOPING,AL.TRUE); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcei(source.get(0),AL.AL_LOOPING,AL.AL_TRUE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcei 0 AL_LOOPING true: \n", error); } - al.sourcef(source.get(1),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(1),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 1 AL_PITCH : \n", error); } - al.sourcef(source.get(1),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(1),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 1 AL_GAIN : \n", error); } - al.sourcefv(source.get(1),AL.POSITION,Sys.getDirectBufferAddress(source1Pos)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(1),AL.AL_POSITION,source1Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 1 AL_POSITION : \n", error); } - al.sourcefv(source.get(1),AL.VELOCITY,Sys.getDirectBufferAddress(source1Vel)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(1),AL.AL_VELOCITY,source1Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 1 AL_VELOCITY : \n", error); } - al.sourcei(source.get(1),AL.BUFFER, buffers.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcei(source.get(1),AL.AL_BUFFER, buffers.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcei 1 AL_BUFFER buffer 1 : \n", error); } - al.sourcei(source.get(1),AL.LOOPING,AL.FALSE); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcei(source.get(1),AL.AL_LOOPING,AL.AL_FALSE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcei 1 AL_LOOPING false: \n", error); } @@ -1856,35 +1816,35 @@ public class ALTest extends BasicTest { switch (ch) { case '1': - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 0 : ", error); break; case '2': - al.sourcePlay(source.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 1 : ", error); break; case '3': - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop source 0 : ", error); break; case '4': - al.sourceStop(source.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop source 1 : ", error); break; } } while (ch != 'q'); // Release resources - al.sourceStopv(2, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStopv(2, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStopv 2 : ", error); - al.deleteSources(2, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alDeleteSources(2, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alDeleteSources 2 : ", error); return; @@ -1894,8 +1854,8 @@ public class ALTest extends BasicTest { int error; IntBuffer source = createIntBuffer(2); int ch = -1; - int bLooping0 = AL.FALSE; - int bLooping1 = AL.FALSE; + int bLooping0 = AL.AL_FALSE; + int bLooping1 = AL.AL_FALSE; FloatBuffer source0Pos = createFloatBuffer(3); source0Pos.put(new float[] {-2.0f, 0.0f, -2.0f}); @@ -1910,71 +1870,71 @@ public class ALTest extends BasicTest { source1Vel.put(new float[] {0.0f, 0.0f, 0.0f}); // Clear Error Code - al.getError(); + AL.alGetError(); - al.genSources(2,Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alGenSources(2,source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alGenSources 1 : ", error); return; } - al.sourcef(source.get(0),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(0),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 0 AL_PITCH : \n", error); } - al.sourcef(source.get(0),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(0),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 0 AL_GAIN : \n", error); } - al.sourcefv(source.get(0),AL.POSITION,Sys.getDirectBufferAddress(source0Pos)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(0),AL.AL_POSITION,source0Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 0 AL_POSITION : \n", error); } - al.sourcefv(source.get(0),AL.VELOCITY,Sys.getDirectBufferAddress(source0Vel)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(0),AL.AL_VELOCITY,source0Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 0 AL_VELOCITY : \n", error); } - al.sourcei(source.get(0),AL.BUFFER, buffers.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcei(source.get(0),AL.AL_BUFFER, buffers.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcei 0 AL_BUFFER buffer 0 : \n", error); } - al.sourcei(source.get(0),AL.LOOPING,AL.FALSE); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcei(source.get(0),AL.AL_LOOPING,AL.AL_FALSE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcei 0 AL_LOOPING false : \n", error); } - al.sourcef(source.get(1),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(1),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 1 AL_PITCH : \n", error); } - al.sourcef(source.get(1),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(1),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 1 AL_GAIN : \n", error); } - al.sourcefv(source.get(1),AL.POSITION,Sys.getDirectBufferAddress(source1Pos)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(1),AL.AL_POSITION,source1Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 1 AL_POSITION : \n", error); } - al.sourcefv(source.get(1),AL.VELOCITY,Sys.getDirectBufferAddress(source1Vel)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(1),AL.AL_VELOCITY,source1Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 1 AL_VELOCITY : \n", error); } - al.sourcei(source.get(1),AL.BUFFER, buffers.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcei(source.get(1),AL.AL_BUFFER, buffers.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcei 1 AL_BUFFER buffer 1 : \n", error); } - al.sourcei(source.get(1),AL.LOOPING,AL.FALSE); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcei(source.get(1),AL.AL_LOOPING,AL.AL_FALSE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcei 1 AL_LOOPING false: \n", error); } @@ -1993,48 +1953,48 @@ public class ALTest extends BasicTest { switch (ch) { case '1': - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 0 : ", error); break; case '2': - if (bLooping0 == AL.FALSE) { - bLooping0 = AL.TRUE; - if (bLooping1 == AL.TRUE) + if (bLooping0 == AL.AL_FALSE) { + bLooping0 = AL.AL_TRUE; + if (bLooping1 == AL.AL_TRUE) System.out.print("Source 0 : Looping Source 1 : Looping \n"); else System.out.print("Source 0 : Looping Source 1 : Not looping\n"); } else { - bLooping0 = AL.FALSE; - if (bLooping1 == AL.TRUE) + bLooping0 = AL.AL_FALSE; + if (bLooping1 == AL.AL_TRUE) System.out.print("Source 0 : Not looping Source 1 : Looping \n"); else System.out.print("Source 0 : Not looping Source 1 : Not looping\n"); } - al.sourcei(source.get(0), AL.LOOPING, bLooping0); + AL.alSourcei(source.get(0), AL.AL_LOOPING, bLooping0); break; case '3': - al.sourcePlay(source.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 1 : ", error); break; case '4': - if (bLooping1 == AL.FALSE) { - bLooping1 = AL.TRUE; - if (bLooping0 == AL.TRUE) + if (bLooping1 == AL.AL_FALSE) { + bLooping1 = AL.AL_TRUE; + if (bLooping0 == AL.AL_TRUE) System.out.print("Source 0 : Looping Source 1 : Looping \n"); else System.out.print("Source 0 : Not looping Source 1 : Looping \n"); } else { - bLooping1 = AL.FALSE; - if (bLooping0 == AL.TRUE) + bLooping1 = AL.AL_FALSE; + if (bLooping0 == AL.AL_TRUE) System.out.print("Source 0 : Looping Source 1 : Not looping\n"); else System.out.print("Source 0 : Not looping Source 1 : Not looping\n"); } - al.sourcei(source.get(1), AL.LOOPING, bLooping1); + AL.alSourcei(source.get(1), AL.AL_LOOPING, bLooping1); break; } } while (ch != 'q'); @@ -2042,12 +2002,12 @@ public class ALTest extends BasicTest { System.out.print("\n"); // Release resources - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop source 1 : ", error); - al.deleteSources(2, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alDeleteSources(2, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alDeleteSources 1 : ", error); return; @@ -2059,11 +2019,8 @@ public class ALTest extends BasicTest { int ch = -1; IntBuffer source = createIntBuffer(2); - IntBuffer Env = createIntBuffer(1); - IntBuffer Room = createIntBuffer(1); - IntBuffer Occlusion = createIntBuffer(1); - IntBuffer Obstruction = createIntBuffer(1); - EAXBufferProperties eaxBufferProp0 = new EAXBufferProperties(); + EAXBufferProperties eaxBufferProp = new EAXBufferProperties(); + EAXListenerProperties eaxListenerProp = new EAXListenerProperties(); FloatBuffer source0Pos = createFloatBuffer(3); source0Pos.put(new float[] {-2.0f, 0.0f, 2.0f}); @@ -2075,70 +2032,69 @@ public class ALTest extends BasicTest { FloatBuffer source1Vel = createFloatBuffer(3); source1Vel.put(new float[] {0.0f, 0.0f, 0.0f}); - EAX eax = new EAX(); try { - eax.create(); + EAX.create(); } catch (Exception e) { e.printStackTrace(); return; } // Clear Error Code - al.getError(); + AL.alGetError(); - al.genSources(2, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alGenSources(2, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alGenSources 2 : ", error); return; } - al.sourcef(source.get(0),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_PITCH : \n", error); - al.sourcef(source.get(0),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN : \n", error); - al.sourcefv(source.get(0),AL.POSITION,Sys.getDirectBufferAddress(source0Pos)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_POSITION,source0Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_POSITION : \n", error); - al.sourcefv(source.get(0),AL.VELOCITY,Sys.getDirectBufferAddress(source0Vel)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_VELOCITY,source0Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_VELOCITY : \n", error); - al.sourcei(source.get(0),AL.BUFFER, buffers.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_BUFFER, buffers.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_BUFFER buffer 0 : \n", error); - al.sourcei(source.get(0),AL.LOOPING,AL.TRUE); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_LOOPING,AL.AL_TRUE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_LOOPING true: \n", error); - al.sourcef(source.get(1),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(1),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 1 AL_PITCH : \n", error); - al.sourcef(source.get(1),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(1),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 1 AL_GAIN : \n", error); - al.sourcefv(source.get(1),AL.POSITION,Sys.getDirectBufferAddress(source1Pos)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(1),AL.AL_POSITION,source1Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 1 AL_POSITION : \n", error); - al.sourcefv(source.get(1),AL.VELOCITY,Sys.getDirectBufferAddress(source1Vel)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(1),AL.AL_VELOCITY,source1Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 1 AL_VELOCITY : \n", error); - al.sourcei(source.get(1),AL.BUFFER, buffers.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(1),AL.AL_BUFFER, buffers.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 1 AL_BUFFER buffer 1 : \n", error); - al.sourcei(source.get(1),AL.LOOPING,AL.FALSE); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(1),AL.AL_LOOPING,AL.AL_FALSE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 1 AL_LOOPING false: \n", error); System.out.print("EAX Test\n\n"); @@ -2162,98 +2118,115 @@ public class ALTest extends BasicTest { } switch (ch) { case '1': - al.sourcePlay(source.get(0)); + AL.alSourcePlay(source.get(0)); break; case '2': - al.sourcePlay(source.get(1)); + AL.alSourcePlay(source.get(1)); break; case '3': - al.sourceStop(source.get(0)); + AL.alSourceStop(source.get(0)); break; case '4': - al.sourceStop(source.get(1)); + AL.alSourceStop(source.get(1)); break; case '5': - Env.put(0, EAX.ENVIRONMENT_HANGAR); - eax.eaxSet(EAX.LISTENER_GUID, EAXListenerProperties.ENVIRONMENT | EAXListenerProperties.DEFERRED, - 0, Sys.getDirectBufferAddress(Env), 4); - if ((error = al.getError()) != AL.NO_ERROR) + eaxListenerProp.setEnvironment(EAX.EAX_ENVIRONMENT_HANGAR); + EAX.eaxSetProperty(eaxListenerProp, + EAXListenerProperties.EAXLISTENER_ENVIRONMENT | + EAXListenerProperties.EAXLISTENER_DEFERRED, + 0); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxSet EAXLISTENER_ENVIRONMENT | EAXLISTENER_DEFERRED : \n", error); break; case '6': - Room.put(0, -10000); - eax.eaxSet(EAX.LISTENER_GUID, EAXListenerProperties.ROOM | EAXListenerProperties.DEFERRED, 0, - Sys.getDirectBufferAddress(Room), 4); - if ((error = al.getError()) != AL.NO_ERROR) + eaxListenerProp.setRoom(-10000); + EAX.eaxSetProperty(eaxListenerProp, + EAXListenerProperties.EAXLISTENER_ROOM | + EAXListenerProperties.EAXLISTENER_DEFERRED, + 0); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxSet EAXLISTENER_ROOM | EAXLISTENER_DEFERRED : \n", error); break; case '7': - eax.eaxGet(EAX.BUFFER_GUID, EAXBufferProperties.ALLPARAMETERS, source.get(0), - eaxBufferProp0.getAddress(), eaxBufferProp0.getSize()); - if ((error = al.getError()) != AL.NO_ERROR) + + EAX.eaxGetProperty(eaxBufferProp, + EAXBufferProperties.EAXBUFFER_ALLPARAMETERS, + source.get(0)); + + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxGet EAXBUFFER_ALLPARAMETERS : \n", error); - eaxBufferProp0.setOcclusion(-5000); - eax.eaxSet(EAX.BUFFER_GUID, EAXBufferProperties.ALLPARAMETERS | EAXBufferProperties.DEFERRED, source.get(0), - eaxBufferProp0.getAddress(), eaxBufferProp0.getSize()); - if ((error = al.getError()) != AL.NO_ERROR) + eaxBufferProp.setOcclusion(-5000); + EAX.eaxSetProperty(eaxBufferProp, + EAXBufferProperties.EAXBUFFER_ALLPARAMETERS | + EAXBufferProperties.EAXBUFFER_DEFERRED, + source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxSet EAXBUFFER_ALLPARAMETERS | EAXBUFFER_DEFERRED : \n", error); break; case '8': - Occlusion.put(0, 0); - eax.eaxSet(EAX.BUFFER_GUID, EAXBufferProperties.OCCLUSION | EAXBufferProperties.DEFERRED, source.get(0), - Sys.getDirectBufferAddress(Occlusion), 4); - if ((error = al.getError()) != AL.NO_ERROR) + eaxBufferProp.setOcclusion(0); + EAX.eaxSetProperty(eaxBufferProp, + EAXBufferProperties.EAXBUFFER_OCCLUSION | + EAXBufferProperties.EAXBUFFER_DEFERRED, + source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxSet EAXBUFFER_OCCLUSION | EAXBUFFER_DEFERRED : \n", error); break; case '9': - Obstruction.put(0, -5000); - eax.eaxSet(EAX.BUFFER_GUID, EAXBufferProperties.OBSTRUCTION, source.get(1), - Sys.getDirectBufferAddress(Obstruction), 4); - if ((error = al.getError()) != AL.NO_ERROR) + eaxBufferProp.setObstruction(-5000); + EAX.eaxSetProperty(eaxBufferProp, + EAXBufferProperties.EAXBUFFER_OBSTRUCTION, + source.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxSet EAXBUFFER_OBSTRUCTION : \n", error); break; case '0': - Obstruction.put(0, 0); - eax.eaxSet(EAX.BUFFER_GUID, EAXBufferProperties.OBSTRUCTION, source.get(1), - Sys.getDirectBufferAddress(Obstruction), 4); - if ((error = al.getError()) != AL.NO_ERROR) + eaxBufferProp.setObstruction(0); + EAX.eaxSetProperty(eaxBufferProp, + EAXBufferProperties.EAXBUFFER_OBSTRUCTION, + source.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxSet EAXBUFFER_OBSTRUCTION : \n", error); break; case 'c': // Commit settings on source 0 - eax.eaxSet(EAX.BUFFER_GUID, EAXBufferProperties.COMMITDEFERREDSETTINGS, - source.get(0), 0, 0); - if ((error = al.getError()) != AL.NO_ERROR) + EAX.eaxSetProperty(eaxBufferProp, + EAXBufferProperties.EAXBUFFER_COMMITDEFERREDSETTINGS, + source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxSet EAXBUFFER_COMMITDEFERREDSETTINGS : \n", error); // Commit Listener settings - eax.eaxSet(EAX.LISTENER_GUID, EAXListenerProperties.COMMITDEFERREDSETTINGS, - 0, 0, 0); - if ((error = al.getError()) != AL.NO_ERROR) + EAX.eaxSetProperty(eaxListenerProp, + EAXListenerProperties.EAXLISTENER_COMMITDEFERREDSETTINGS, + 0); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxSet EAXLISTENER_COMMITDEFERREDSETTINGSENVIRONMENT : \n", error); break; } } while (ch != 'q'); // reset EAX level - Room.put(0, -10000); - eax.eaxSet(EAX.LISTENER_GUID, EAXListenerProperties.ROOM, 0, Sys.getDirectBufferAddress(Room), 4); - if ((error = al.getError()) != AL.NO_ERROR) + eaxListenerProp.setRoom(-10000); + EAX.eaxSetProperty(eaxListenerProp, + EAXListenerProperties.EAXLISTENER_ROOM, + 0); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("eaxSet EAXLISTENER_ROOM : \n", error); // Release resources - al.sourceStopv(2, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStopv(2, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStopv 2 : ", error); - al.deleteSources(2, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alDeleteSources(2, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alDeleteSources 2 : ", error); } @@ -2278,40 +2251,40 @@ public class ALTest extends BasicTest { int i; // Clear Error Code - al.getError(); + AL.alGetError(); - al.genSources(1,Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alGenSources(1,source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alGenSources 1 : ", error); return; } - al.sourcef(source.get(0),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(0),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 0 AL_PITCH : ", error); } - al.sourcef(source.get(0),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcef(source.get(0),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcef 0 AL_GAIN : ", error); } - al.sourcefv(source.get(0),AL.POSITION,Sys.getDirectBufferAddress(source0Pos)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(0),AL.AL_POSITION,source0Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 0 AL_POSITION : ", error); } - al.sourcefv(source.get(0),AL.VELOCITY,Sys.getDirectBufferAddress(source0Vel)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcefv(source.get(0),AL.AL_VELOCITY,source0Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcefv 0 AL_VELOCITY : ", error); } - al.sourcei(source.get(0),AL.LOOPING,AL.FALSE); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alSourcei(source.get(0),AL.AL_LOOPING,AL.AL_FALSE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourcei 0 AL_LOOPING false: ", error); } - bLooping = AL.FALSE; + bLooping = AL.AL_FALSE; System.out.print("Queue Test\n\n"); System.out.print("Press '1' to start playing source 0\n"); @@ -2349,66 +2322,66 @@ public class ALTest extends BasicTest { } switch (ch) { case '1': - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 0 : ", error); break; case '2': - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop source 0 : ", error); break; case '3': - if (bLooping == AL.TRUE) + if (bLooping == AL.AL_TRUE) { - bLooping = AL.FALSE; + bLooping = AL.AL_FALSE; System.out.print("Source 0 not looping\n"); } else { - bLooping = AL.TRUE; + bLooping = AL.AL_TRUE; System.out.print("Source 0 looping \n"); } - al.sourcei(source.get(0), AL.LOOPING, bLooping); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0), AL.AL_LOOPING, bLooping); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei AL_LOOPING : ", error); break; case '4': - al.sourceQueueBuffers(source.get(0), 4, Sys.getDirectBufferAddress(buffers)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(source.get(0), 4, buffers); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 4 : ", error); break; case '5': - al.sourceQueueBuffers(source.get(0), 1, Sys.getDirectBufferAddress(buffers) + (4*0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(source.get(0), 1, ((ByteBuffer)buffers.position(4*0)).slice().order(ByteOrder.nativeOrder())); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 1 : ", error); break; case '6': - al.sourceQueueBuffers(source.get(0), 1, Sys.getDirectBufferAddress(buffers) + (4*1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(source.get(0), 1, ((ByteBuffer)buffers.position(4*1)).slice().order(ByteOrder.nativeOrder())); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 1 : ", error); break; case '7': - al.sourceQueueBuffers(source.get(0), 1, Sys.getDirectBufferAddress(buffers) + (4*2)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(source.get(0), 1, ((ByteBuffer)buffers.position(4*2)).slice().order(ByteOrder.nativeOrder())); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 1 : ", error); break; case '8': - al.sourceQueueBuffers(source.get(0), 1, Sys.getDirectBufferAddress(buffers) + (4*3)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(source.get(0), 1, ((ByteBuffer)buffers.position(4*3)).slice().order(ByteOrder.nativeOrder())); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 1 : ", error); break; case '9': // Queue buffer 0 - al.sourceQueueBuffers(source.get(0), 1, Sys.getDirectBufferAddress(buffers) + (4*4)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(source.get(0), 1, ((ByteBuffer)buffers.position(4*4)).slice().order(ByteOrder.nativeOrder())); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 1 (buffer 0) : ", error); break; case 'a': // Unqueue first Buffer - al.sourceUnqueueBuffers(source.get(0), 1, Sys.getDirectBufferAddress(buffersremoved)); + AL.alSourceUnqueueBuffers(source.get(0), 1, buffersremoved); - if ((error = al.getError()) != AL.NO_ERROR) + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourceUnqueueBuffers 1 : ", error); } else @@ -2429,9 +2402,9 @@ public class ALTest extends BasicTest { break; case 'b': // Unqueue first 2 Buffers - al.sourceUnqueueBuffers(source.get(0), 2, Sys.getDirectBufferAddress(buffersremoved)); + AL.alSourceUnqueueBuffers(source.get(0), 2, buffersremoved); - if ((error = al.getError()) != AL.NO_ERROR) + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourceUnqueueBuffers 2 : ", error); } else @@ -2455,8 +2428,8 @@ public class ALTest extends BasicTest { break; case 'c': // Unqueue first 3 Buffers - al.sourceUnqueueBuffers(source.get(0), 3, Sys.getDirectBufferAddress(buffersremoved)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceUnqueueBuffers(source.get(0), 3, buffersremoved); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourceUnqueueBuffers 3 : ", error); } else @@ -2482,9 +2455,9 @@ public class ALTest extends BasicTest { break; case 'd': // Unqueue first 4 Buffers - al.sourceUnqueueBuffers(source.get(0), 4, Sys.getDirectBufferAddress(buffersremoved)); + AL.alSourceUnqueueBuffers(source.get(0), 4, buffersremoved); - if ((error = al.getError()) != AL.NO_ERROR) + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourceUnqueueBuffers 1 : ", error); } else @@ -2512,9 +2485,9 @@ public class ALTest extends BasicTest { break; case 'e': // Unqueue first 5 Buffers - al.sourceUnqueueBuffers(source.get(0), 5, Sys.getDirectBufferAddress(buffersremoved)); + AL.alSourceUnqueueBuffers(source.get(0), 5, buffersremoved); - if ((error = al.getError()) != AL.NO_ERROR) + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alSourceUnqueueBuffers 1 : ", error); } else @@ -2542,19 +2515,19 @@ public class ALTest extends BasicTest { } break; case 'f': - al.sourcei(source.get(0), AL.BUFFER, 0); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0), AL.AL_BUFFER, 0); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSource AL_BUFFER NULL : ", error); break; case '0': // Retrieve number of buffers in queue - al.getSourcei(source.get(0), AL.BUFFERS_QUEUED, Sys.getDirectBufferAddress(BuffersInQueue)); + AL.alGetSourcei(source.get(0), AL.AL_BUFFERS_QUEUED, BuffersInQueue); // Retrieve number of processed buffers - al.getSourcei(source.get(0), AL.BUFFERS_PROCESSED, Sys.getDirectBufferAddress(BuffersProcessed)); + AL.alGetSourcei(source.get(0), AL.AL_BUFFERS_PROCESSED, BuffersProcessed); // Retrieve current buffer - al.getSourcei(source.get(0), AL.BUFFER, Sys.getDirectBufferAddress(Buffer)); + AL.alGetSourcei(source.get(0), AL.AL_BUFFER, Buffer); int address = Buffer.get(0); if (address == buffers.get(0)) @@ -2577,12 +2550,12 @@ public class ALTest extends BasicTest { } while (ch != 'q'); // Release resources - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop : ", error); - al.deleteSources(1, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alDeleteSources(1, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alDeleteSources 1 : ", error); } @@ -2597,30 +2570,30 @@ public class ALTest extends BasicTest { FloatBuffer source0Vel = createFloatBuffer(3); source0Vel.put(new float[] {0.0f, 0.0f, 0.0f}); - al.genSources(1,Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alGenSources(1,source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alGenSources 2 : ", error); return; } - al.sourcef(source.get(0),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_PITCH : \n", error); - al.sourcef(source.get(0),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN : \n", error); - al.sourcefv(source.get(0),AL.POSITION,Sys.getDirectBufferAddress(source0Pos)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_POSITION,source0Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_POSITION : \n", error); - al.sourcefv(source.get(0),AL.VELOCITY,Sys.getDirectBufferAddress(source0Vel)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_VELOCITY,source0Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_VELOCITY : \n", error); - al.sourcei(source.get(0),AL.LOOPING,AL.FALSE); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_LOOPING,AL.AL_FALSE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_LOOPING true: \n", error); System.out.print("Buffer Test\n"); @@ -2638,48 +2611,48 @@ public class ALTest extends BasicTest { switch (ch) { case '1': // Stop source - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop 0 : ", error); // Attach buffer 0 to source - al.sourcei(source.get(0), AL.BUFFER, buffers.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0), AL.AL_BUFFER, buffers.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei AL_BUFFER 0 : ", error); // Play - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay 0 : ", error); break; case '2': // Stop source - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop 0 : ", error); // Attach buffer 0 to source - al.sourcei(source.get(0), AL.BUFFER, buffers.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0), AL.AL_BUFFER, buffers.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei AL_BUFFER 1 : ", error); // Play - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay 0 : ", error); break; case '3': // Stop source - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop 0 : ", error); break; } } while (ch != 'q'); // Release resources - al.sourceStopv(1, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStopv(1, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStopv 1 : ", error); - al.deleteSources(1, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alDeleteSources(1, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alDeleteSources 1 : ", error); } @@ -2694,34 +2667,34 @@ public class ALTest extends BasicTest { FloatBuffer source0Vel = createFloatBuffer(3); source0Vel.put(new float[] {0.0f, 0.0f, 0.0f}); - al.genSources(1,Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alGenSources(1,source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alGenSources 1 : ", error); return; } - al.sourcef(source.get(0),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_PITCH : \n", error); - al.sourcef(source.get(0),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN : \n", error); - al.sourcefv(source.get(0),AL.POSITION,Sys.getDirectBufferAddress(source0Pos)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_POSITION,source0Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_POSITION : \n", error); - al.sourcefv(source.get(0),AL.VELOCITY, Sys.getDirectBufferAddress(source0Vel)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_VELOCITY, source0Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_VELOCITY : \n", error); - al.sourcei(source.get(0),AL.BUFFER, buffers.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_BUFFER, buffers.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_BUFFER buffer 1 : \n", error); - al.sourcei(source.get(0),AL.LOOPING,AL.TRUE); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_LOOPING,AL.AL_TRUE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_LOOPING true: \n", error); System.out.print("Frequency Test\n"); @@ -2738,31 +2711,31 @@ public class ALTest extends BasicTest { switch (ch) { case '1': - al.sourcef(source.get(0), AL.PITCH, 1.0f); - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0), AL.AL_PITCH, 1.0f); + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 0 : ", error); break; case '2': - al.sourcef(source.get(0), AL.PITCH, 2.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0), AL.AL_PITCH, 2.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef source 0 AL_PITCH 2.0 : ", error); break; case '3': - al.sourcef(source.get(0), AL.PITCH, 0.5f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0), AL.AL_PITCH, 0.5f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef source 0 AL PITCH 0.5: ", error); break; } } while (ch != 'q'); // Release resources - al.sourceStopv(1, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStopv(1, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStopv 2 : ", error); - al.deleteSources(1, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alDeleteSources(1, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alDeleteSources 2 : ", error); } @@ -2775,7 +2748,7 @@ public class ALTest extends BasicTest { IntBuffer Buffer = createIntBuffer(1); int ch = -1; - int bLoop = AL.TRUE; + int bLoop = AL.AL_TRUE; FloatBuffer source0Pos = createFloatBuffer(3); source0Pos.put(new float[] {2.0f, 0.0f, -2.0f}); @@ -2783,8 +2756,8 @@ public class ALTest extends BasicTest { FloatBuffer source0Vel = createFloatBuffer(3); source0Vel.put(new float[] {0.0f, 0.0f, 0.0f}); - al.genSources(1,Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alGenSources(1,source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alGenSources 1 : ", error); return; } @@ -2812,123 +2785,123 @@ public class ALTest extends BasicTest { switch (ch) { case '1': // Stop source - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop source 0 : ", error); // Attach new buffer - al.sourcei(source.get(0),AL.BUFFER, buffers.get(6)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_BUFFER, buffers.get(6)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_BUFFER buffer 6 (stereo) : \n", error); // Set volume - al.sourcef(source.get(0),AL.GAIN,0.5f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,0.5f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN : \n", error); // Set looping - al.sourcei(source.get(0),AL.LOOPING,bLoop); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_LOOPING,bLoop); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_LOOPING true: \n", error); // Play source - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 0 : ", error); break; case '2': // Stop source - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop source 0 : ", error); // Attach new buffer - al.sourcei(source.get(0),AL.BUFFER, buffers.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_BUFFER, buffers.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_BUFFER buffer 0 (mono) : \n", error); // Set 3D position - al.sourcefv(source.get(0),AL.POSITION, Sys.getDirectBufferAddress(source0Pos)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_POSITION, source0Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_POSITION : \n", error); // Set 3D velocity - al.sourcefv(source.get(0),AL.VELOCITY, Sys.getDirectBufferAddress(source0Vel)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_VELOCITY, source0Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_VELOCITY : \n", error); // Set volume to full - al.sourcef(source.get(0),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN : \n", error); // Set Looping - al.sourcei(source.get(0),AL.LOOPING,bLoop); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_LOOPING,bLoop); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_LOOPING : \n", error); // Play source - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 0 : ", error); break; case '3': - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop source 0 : ", error); break; case '4': - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop Source 0 : ", error); // Attach NULL buffer to source to clear everything - al.sourcei(source.get(0), AL.BUFFER, 0); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0), AL.AL_BUFFER, 0); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei AL_BUFFER (NULL) : ", error); - al.sourceQueueBuffers(source.get(0), 2, Sys.getDirectBufferAddress(buffers)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceQueueBuffers(source.get(0), 2, buffers); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceQueueBuffers 2 (stereo) : ", error); // Set Looping - al.sourcei(source.get(0),AL.LOOPING,bLoop); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_LOOPING,bLoop); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_LOOPING : \n", error); - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay Source 0 : ", error); break; case '5': //yes, this causes a invalid operation - so does the original :/ - al.sourceUnqueueBuffers(source.get(0), 2, Sys.getDirectBufferAddress(buffers)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceUnqueueBuffers(source.get(0), 2, buffers); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceUnqueueBuffers 2 (stereo) : ", error); break; case '6': - if (bLoop == AL.TRUE) + if (bLoop == AL.AL_TRUE) { System.out.print("Looping is off\n"); - bLoop = AL.FALSE; + bLoop = AL.AL_FALSE; } else { System.out.print("Looping is on \n"); - bLoop = AL.TRUE; + bLoop = AL.AL_TRUE; } - al.sourcei(source.get(0), AL.LOOPING, bLoop); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0), AL.AL_LOOPING, bLoop); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_LOOPING : \n", error); break; case '0': // Retrieve number of buffers in queue - al.getSourcei(source.get(0), AL.BUFFERS_QUEUED, Sys.getDirectBufferAddress(BuffersInQueue)); + AL.alGetSourcei(source.get(0), AL.AL_BUFFERS_QUEUED, BuffersInQueue); // Retrieve number of processed buffers - al.getSourcei(source.get(0), AL.BUFFERS_PROCESSED, Sys.getDirectBufferAddress(BuffersProcessed)); + AL.alGetSourcei(source.get(0), AL.AL_BUFFERS_PROCESSED, BuffersProcessed); // Retrieve current buffer - al.getSourcei(source.get(0), AL.BUFFER, Sys.getDirectBufferAddress(Buffer)); + AL.alGetSourcei(source.get(0), AL.AL_BUFFER, Buffer); int address = Buffer.get(0); if (address == buffers.get(0)) @@ -2948,12 +2921,12 @@ public class ALTest extends BasicTest { } while (ch != 'q'); // Release resources - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop : ", error); - al.deleteSources(1, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alDeleteSources(1, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alDeleteSources 2 : ", error); } @@ -2975,59 +2948,59 @@ public class ALTest extends BasicTest { FloatBuffer source1Vel = createFloatBuffer(3); source1Vel.put(new float[] {0.0f, 0.0f, 0.0f}); - al.genSources(2,Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) { + AL.alGenSources(2,source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { displayALError("alGenSources 2 : ", error); return; } - al.sourcef(source.get(0),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_PITCH : \n", error); - al.sourcef(source.get(0),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN : \n", error); - al.sourcefv(source.get(0),AL.POSITION,Sys.getDirectBufferAddress(source0Pos)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_POSITION,source0Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_POSITION : \n", error); - al.sourcefv(source.get(0),AL.VELOCITY,Sys.getDirectBufferAddress(source0Vel)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(0),AL.AL_VELOCITY,source0Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 0 AL_VELOCITY : \n", error); - al.sourcei(source.get(0),AL.BUFFER, buffers.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_BUFFER, buffers.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_BUFFER buffer 0 : \n", error); - al.sourcei(source.get(0),AL.LOOPING,AL.TRUE); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(0),AL.AL_LOOPING,AL.AL_TRUE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 0 AL_LOOPING true: \n", error); - al.sourcef(source.get(1),AL.PITCH,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(1),AL.AL_PITCH,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 1 AL_PITCH : \n", error); - al.sourcef(source.get(1),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(1),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 1 AL_GAIN : \n", error); - al.sourcefv(source.get(1),AL.POSITION,Sys.getDirectBufferAddress(source1Pos)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(1),AL.AL_POSITION,source1Pos); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 1 AL_POSITION : \n", error); - al.sourcefv(source.get(1),AL.VELOCITY,Sys.getDirectBufferAddress(source1Vel)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcefv(source.get(1),AL.AL_VELOCITY,source1Vel); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcefv 1 AL_VELOCITY : \n", error); - al.sourcei(source.get(1),AL.BUFFER, buffers.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(1),AL.AL_BUFFER, buffers.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 1 AL_BUFFER buffer 1 : \n", error); - al.sourcei(source.get(1),AL.LOOPING,AL.TRUE); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcei(source.get(1),AL.AL_LOOPING,AL.AL_TRUE); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcei 1 AL_LOOPING true: \n", error); System.out.print("Gain Test\n"); @@ -3053,76 +3026,76 @@ public class ALTest extends BasicTest { switch (ch) { case '1': - al.sourcePlay(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 0 : ", error); break; case '2': - al.sourcePlay(source.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(source.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay source 1 : ", error); break; case '3': - al.sourceStop(source.get(0)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop source 0 : \n", error); break; case '4': - al.sourceStop(source.get(1)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourceStop(source.get(1)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop source 1 : \n", error); break; case '5': - al.sourcef(source.get(0),AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN 1.0 : \n", error); break; case '6': - al.sourcef(source.get(0),AL.GAIN,0.5f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,0.5f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN 0.5 : \n", error); break; case '7': - al.sourcef(source.get(0),AL.GAIN,0.25f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,0.25f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN 0.25 : \n", error); break; case '8': - al.sourcef(source.get(0),AL.GAIN,0.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcef(source.get(0),AL.AL_GAIN,0.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcef 0 AL_GAIN 0.0 : \n", error); break; case 'a': - al.listenerf(AL.GAIN,1.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alListenerf(AL.AL_GAIN,1.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alListenerf AL_GAIN 1.0 : \n", error); break; case 'b': - al.listenerf(AL.GAIN,0.5f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alListenerf(AL.AL_GAIN,0.5f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alListenerf AL_GAIN 0.5 : \n", error); break; case 'c': - al.listenerf(AL.GAIN,0.25f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alListenerf(AL.AL_GAIN,0.25f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alListenerf AL_GAIN 0.25 : \n", error); break; case 'd': - al.listenerf(AL.GAIN,0.0f); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alListenerf(AL.AL_GAIN,0.0f); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alListenerf AL_GAIN 0.0 : \n", error); break; } } while (ch != 'q'); // Reset & Release resources - al.listenerf(AL.GAIN,1.0f); - al.sourceStopv(2,Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alListenerf(AL.AL_GAIN,1.0f); + AL.alSourceStopv(2,source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourceStop : ", error); - al.deleteSources(2, Sys.getDirectBufferAddress(source)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alDeleteSources(2, source); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alDeleteSources 2 : ", error); } @@ -3133,7 +3106,7 @@ public class ALTest extends BasicTest { protected void i_MultipleSourcesTest() { int numSources = 0; - IntBuffer Sources = createIntBuffer(64); + IntBuffer[] Sources = new IntBuffer[64]; int error; int i; int ch = -1; @@ -3143,8 +3116,9 @@ public class ALTest extends BasicTest { // Generate as many sources as possible (up to 64) for (i = 0; i < 64; i++) { - al.genSources(1, Sys.getDirectBufferAddress(Sources) + (4*i)); - if ((error = al.getError()) != AL.NO_ERROR) { + Sources[i] = createIntBuffer(1); + AL.alGenSources(1, Sources[i]); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) { break; } else { numSources++; @@ -3161,14 +3135,14 @@ public class ALTest extends BasicTest { for (i = 0; i < numSources; i++) { // Attach buffer - al.sourcei(Sources.get(i), AL.BUFFER, buffers.get(0)); + AL.alSourcei(Sources[i].get(0), AL.AL_BUFFER, buffers.get(0)); // Set position pos.put(0, (float)(Math.cos(anglestep*i) * radius)); pos.put(1, 0.0f); pos.put(2, (float)(Math.sin(anglestep*i) * radius)); - al.sourcefv(Sources.get(i), AL.POSITION, Sys.getDirectBufferAddress(pos)); + AL.alSourcefv(Sources[i].get(0), AL.AL_POSITION, pos); System.out.print("Source " + i + " at " + pos.get(0) + ", " + @@ -3176,7 +3150,7 @@ public class ALTest extends BasicTest { pos.get(2) + "\n"); // Enable looping - al.sourcei(Sources.get(i), AL.LOOPING, AL.TRUE); + AL.alSourcei(Sources[i].get(0), AL.AL_LOOPING, AL.AL_TRUE); pos.clear(); } @@ -3194,8 +3168,8 @@ public class ALTest extends BasicTest { switch (ch) { case '1': for (i = 0; i < numSources; i++) { - al.sourcePlay(Sources.get(i)); - if ((error = al.getError()) != AL.NO_ERROR) + AL.alSourcePlay(Sources[i].get(0)); + if ((error = AL.alGetError()) != AL.AL_NO_ERROR) displayALError("alSourcePlay : ", error); // Delay a little @@ -3203,15 +3177,19 @@ public class ALTest extends BasicTest { } break; case '2': - al.sourceStopv(numSources, Sys.getDirectBufferAddress(Sources)); - if ((error = al.getError()) != AL.NO_ERROR) + for(i=0; ibuffer - al.sourcei(sources.get(nextSlot), AL.BUFFER, buffers.get(randomBuffer)); - if (al.getError() != AL.NO_ERROR) { + AL.alSourcei(sources.get(nextSlot), AL.AL_BUFFER, buffers.get(randomBuffer)); + if (AL.alGetError() != AL.AL_NO_ERROR) { System.out.println("Error linking buffer and source."); } System.out.println("linked source " + nextSlot + " with buffer " + randomBuffer); //start playing System.out.println("playing source " + nextSlot); - al.sourcePlay(sources.get(nextSlot++)); + AL.alSourcePlay(sources.get(nextSlot++)); if (nextSlot == 4) { nextSlot = startSlot; } @@ -176,7 +175,7 @@ public class StressTest extends BasicTest { //stop all sources for (int i = 0; i < 4; i++) { - al.sourceStop(sources.get(i)); + AL.alSourceStop(sources.get(i)); System.out.println("Stopping source " + (i+1)); } @@ -192,8 +191,8 @@ public class StressTest extends BasicTest { } catch (Exception e) { } - al.deleteSources(4, Sys.getDirectBufferAddress(sources)); - al.deleteBuffers(10, Sys.getDirectBufferAddress(buffers)); + AL.alDeleteSources(4, sources); + AL.alDeleteBuffers(10, buffers); } private int getRandomBuffer() { diff --git a/src/java/org/lwjgl/test/openal/WaveData.java b/src/java/org/lwjgl/test/openal/WaveData.java index 1a37fac7..e05c4d65 100644 --- a/src/java/org/lwjgl/test/openal/WaveData.java +++ b/src/java/org/lwjgl/test/openal/WaveData.java @@ -129,17 +129,17 @@ public class WaveData { int channels = 0; if (audioformat.getChannels() == 1) { if (audioformat.getSampleSizeInBits() == 8) { - channels = AL.FORMAT_MONO8; + channels = AL.AL_FORMAT_MONO8; } else if (audioformat.getSampleSizeInBits() == 16) { - channels = AL.FORMAT_MONO16; + channels = AL.AL_FORMAT_MONO16; } else { assert false : "Illegal sample size"; } } else if (audioformat.getChannels() == 2) { if (audioformat.getSampleSizeInBits() == 8) { - channels = AL.FORMAT_STEREO8; + channels = AL.AL_FORMAT_STEREO8; } else if (audioformat.getSampleSizeInBits() == 16) { - channels = AL.FORMAT_STEREO16; + channels = AL.AL_FORMAT_STEREO16; } else { assert false : "Illegal sample size"; } diff --git a/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java b/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java index 773839e5..30df2a91 100644 --- a/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java +++ b/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java @@ -98,7 +98,6 @@ public class FullScreenWindowedTest { // start of in windowed mode gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); gl.create(); - glu = new GLU(gl); glInit(); @@ -172,24 +171,24 @@ public class FullScreenWindowedTest { private void render() { //clear background - gl.clear(GL.COLOR_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); // draw white quad - gl.pushMatrix(); + GL.glPushMatrix(); { - gl.translatef(quadPosition.x, quadPosition.y, 0); - gl.rotated(angle, 0.0f, 0.0f, 1.0f); - gl.color3f(1.0f, 1.0f, 1.0f); - gl.begin(GL.QUADS); + GL.glTranslatef(quadPosition.x, quadPosition.y, 0); + GL.glRotated(angle, 0.0f, 0.0f, 1.0f); + GL.glColor3f(1.0f, 1.0f, 1.0f); + GL.glBegin(GL.GL_QUADS); { - gl.vertex2i(-50, -50); - gl.vertex2i(50, -50); - gl.vertex2i(50, 50); - gl.vertex2i(-50, 50); + GL.glVertex2i(-50, -50); + GL.glVertex2i(50, -50); + GL.glVertex2i(50, 50); + GL.glVertex2i(-50, 50); } - gl.end(); + GL.glEnd(); } - gl.popMatrix(); + GL.glPopMatrix(); } /** @@ -208,7 +207,6 @@ public class FullScreenWindowedTest { Display.setDisplayMode(mode); gl = new GL("Test", mode.bpp, 0, 0, 0); gl.create(); - glu = new GLU(gl); glInit(); @@ -227,7 +225,6 @@ public class FullScreenWindowedTest { Display.resetDisplayMode(); gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); gl.create(); - glu = new GLU(gl); glInit(); @@ -314,15 +311,15 @@ public class FullScreenWindowedTest { private void glInit() { // Go into orthographic projection mode. gl.determineAvailableExtensions(); - gl.matrixMode(GL.PROJECTION); - gl.loadIdentity(); - glu.ortho2D(0, mode.width, 0, mode.height); - gl.matrixMode(GL.MODELVIEW); - gl.loadIdentity(); - gl.viewport(0, 0, mode.width, mode.height); + GL.glMatrixMode(GL.GL_PROJECTION); + GL.glLoadIdentity(); + GLU.gluOrtho2D(0, mode.width, 0, mode.height); + GL.glMatrixMode(GL.GL_MODELVIEW); + GL.glLoadIdentity(); + GL.glViewport(0, 0, mode.width, mode.height); //set clear color to black - gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f); + GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //sync frame (only works on windows) if (GL.WGL_EXT_swap_control) { diff --git a/src/java/org/lwjgl/test/opengl/Game.java b/src/java/org/lwjgl/test/opengl/Game.java index 659b5caf..89b5b8ae 100644 --- a/src/java/org/lwjgl/test/opengl/Game.java +++ b/src/java/org/lwjgl/test/opengl/Game.java @@ -73,7 +73,6 @@ public final class Game { } public static final GL gl = new GL("LWJGL Game Example", 16, 0, 0,0); - public static final GLU glu = new GLU(gl); static { try { gl.create(); @@ -150,17 +149,17 @@ public final class Game { * All rendering is done in here */ private static void render() { - gl.clear(GL.COLOR_BUFFER_BIT); - gl.pushMatrix(); - gl.translatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f); - gl.rotatef(angle, 0, 0, 1.0f); - gl.begin(GL.QUADS); - gl.vertex2i(-50, -50); - gl.vertex2i(50, -50); - gl.vertex2i(50, 50); - gl.vertex2i(-50, 50); - gl.end(); - gl.popMatrix(); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); + GL.glPushMatrix(); + GL.glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f); + GL.glRotatef(angle, 0, 0, 1.0f); + GL.glBegin(GL.GL_QUADS); + GL.glVertex2i(-50, -50); + GL.glVertex2i(50, -50); + GL.glVertex2i(50, 50); + GL.glVertex2i(-50, 50); + GL.glEnd(); + GL.glPopMatrix(); } /** @@ -174,16 +173,15 @@ public final class Game { Sys.setProcessPriority(Sys.HIGH_PRIORITY); System.out.println("Timer resolution: " + Sys.getTimerResolution()); // Go into orthographic projection mode. - gl.matrixMode(GL.PROJECTION); - gl.loadIdentity(); - glu.ortho2D(0, Display.getWidth(), 0, Display.getHeight()); - gl.matrixMode(GL.MODELVIEW); - gl.loadIdentity(); - gl.viewport(0, 0, Display.getWidth(), Display.getHeight()); + GL.glMatrixMode(GL.GL_PROJECTION); + GL.glLoadIdentity(); + GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight()); + GL.glMatrixMode(GL.GL_MODELVIEW); + GL.glLoadIdentity(); + GL.glViewport(0, 0, Display.getWidth(), Display.getHeight()); ByteBuffer num_tex_units_buf = ByteBuffer.allocateDirect(4); num_tex_units_buf.order(ByteOrder.nativeOrder()); - int buf_addr = Sys.getDirectBufferAddress(num_tex_units_buf); - gl.getIntegerv(GL.MAX_TEXTURE_UNITS_ARB, buf_addr); + GL.glGetIntegerv(GL.GL_MAX_TEXTURE_UNITS_ARB, num_tex_units_buf.asIntBuffer()); System.out.println("Number of texture units: " + num_tex_units_buf.getInt()); // Fix the refresh rate to the display frequency. // gl.wglSwapIntervalEXT(1); diff --git a/src/java/org/lwjgl/test/opengl/Grass.java b/src/java/org/lwjgl/test/opengl/Grass.java index 42aeb657..612014db 100644 --- a/src/java/org/lwjgl/test/opengl/Grass.java +++ b/src/java/org/lwjgl/test/opengl/Grass.java @@ -89,7 +89,6 @@ public class Grass { } public static final GL gl = new GL("LWJGL Grass", 50, 50, 640, 480, 16, 0, 0,0); - public static final GLU glu = new GLU(gl); static { try { @@ -133,7 +132,7 @@ public class Grass { ByteBuffer byte_buf = ByteBuffer.allocateDirect(4); byte_buf.order(ByteOrder.nativeOrder()); System.out.println("Vertex program supported: " + gl.NV_vertex_program); - gl.genProgramsNV(1, Sys.getDirectBufferAddress(byte_buf)); + GL.glGenProgramsNV(1, byte_buf.asIntBuffer()); IntBuffer int_buf = byte_buf.asIntBuffer(); if (int_buf.get(0) == 0) throw new RuntimeException("Could not allocate new vertex program id!"); @@ -145,11 +144,11 @@ public class Grass { program_buf.rewind(); program_buf.put(program); program_buf.rewind(); - gl.loadProgramNV( - GL.VERTEX_PROGRAM_NV, + GL.glLoadProgramNV( + GL.GL_VERTEX_PROGRAM_NV, program_handle, program_buf.remaining(), - Sys.getDirectBufferAddress(program_buf)); + program_buf); /*gl.getIntegerv(GL.PROGRAM_ERROR_POSITION_NV, Sys.getDirectBufferAddress(int_buf)); System.out.println("error position: " + int_buf.get(0));*/ @@ -163,31 +162,31 @@ public class Grass { light_buf_f.rewind(); light_buf_f.put(LightDiffuse); - gl.lightfv( - GL.LIGHT0, - GL.DIFFUSE, - Sys.getDirectBufferAddress(light_buf_f)); + GL.glLightfv( + GL.GL_LIGHT0, + GL.GL_DIFFUSE, + light_buf_f); light_buf_f.rewind(); light_buf_f.put(LightPosition); - gl.lightfv( - GL.LIGHT0, - GL.POSITION, - Sys.getDirectBufferAddress(light_buf_f)); - gl.enable(GL.LIGHT0); + GL.glLightfv( + GL.GL_LIGHT0, + GL.GL_POSITION, + light_buf_f); + GL.glEnable(GL.GL_LIGHT0); - gl.enable(GL.LIGHTING); + GL.glEnable(GL.GL_LIGHTING); - gl.enable(GL.DEPTH_TEST); + GL.glEnable(GL.GL_DEPTH_TEST); - gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA); - gl.enable(GL.BLEND); + GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); + GL.glEnable(GL.GL_BLEND); - gl.matrixMode(GL.PROJECTION); - glu.perspective(40.0, 1.0, 1.0, 50.0); + GL.glMatrixMode(GL.GL_PROJECTION); + GLU.gluPerspective(40.0, 1.0, 1.0, 50.0); - gl.matrixMode(GL.MODELVIEW); + GL.glMatrixMode(GL.GL_MODELVIEW); - glu.lookAt(14.0, 10.0, -16.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); + GLU.gluLookAt(14.0, 10.0, -16.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); aslod.angle = 2.6179935f; aslod.value = 0.2f; @@ -201,7 +200,7 @@ public class Grass { degree *= (0.5 + myrand()); ptrAnimate(degree); - gl.clear(GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); //ptrDraw(); @@ -247,16 +246,16 @@ public class Grass { fRigid = ((fRigid = myrand()) < 0.2f) ? 0.2f : fRigid; if (myrand() < 0.3) - gl.begin(GL.LINE_STRIP); + GL.glBegin(GL.GL_LINE_STRIP); else - gl.begin(GL.QUAD_STRIP); + GL.glBegin(GL.GL_QUAD_STRIP); for (cFaces = 0; cFaces < numFaces; cFaces++) { for (cWidth = frndWidth; cWidth >= -frndWidth; cWidth -= (frndWidth * 2.0f)) { - gl.color4f(fX, fRigid, fZ, (float) cFaces / (float) numFaces); - gl.vertex3f( + GL.glColor4f(fX, fRigid, fZ, (float) cFaces / (float) numFaces); + GL.glVertex3f( (float) (((cFaces - 2) * 0.1f) * java.lang.Math.cos(fRotate) + (cWidth) * java.lang.Math.sin(fRotate)), @@ -267,7 +266,7 @@ public class Grass { } frndWidth -= fDecWidth; } - gl.end(); + GL.glEnd(); } @@ -275,112 +274,112 @@ public class Grass { float cI, cJ, fArea; fArea = 20.0f; - mesh = gl.genLists(1); - gl.newList(mesh, GL.COMPILE); + mesh = GL.glGenLists(1); + GL.glNewList(mesh, GL.GL_COMPILE); for (cI = -fArea / 2; cI < fArea / 2; cI += 0.25f) { for (cJ = -fArea / 2; cJ < fArea / 2; cJ += 0.25f) { genGrass(0.5f, 0.1f, cI, cJ); } } - gl.endList(); + GL.glEndList(); } private static void grsDraw() { - gl.enable(GL.VERTEX_PROGRAM_NV); - gl.bindProgramNV(GL.VERTEX_PROGRAM_NV, program_handle); - gl.trackMatrixNV( - GL.VERTEX_PROGRAM_NV, + GL.glEnable(GL.GL_VERTEX_PROGRAM_NV); + GL.glBindProgramNV(GL.GL_VERTEX_PROGRAM_NV, program_handle); + GL.glTrackMatrixNV( + GL.GL_VERTEX_PROGRAM_NV, 0, - GL.MODELVIEW_PROJECTION_NV, - GL.IDENTITY_NV); + GL.GL_MODELVIEW_PROJECTION_NV, + GL.GL_IDENTITY_NV); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 4, 0.0f, 0.0f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 5, 0.0f, 0.0f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 6, 1.763609f, 0.496495f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 7, -0.943599f, 3.203737f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 8, 4.101107f, 0.943413f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 9, -1.218603f, 6.259399f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 10, 7.214299f, 1.352961f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 11, -1.540748f, 10.080958f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 12, 10.880035f, 1.759046f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 13, -1.852705f, 14.468674f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 14, 14.292879f, 1.973329f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 15, -1.973387f, 18.506531f, 0.0f, 0.0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 16, (float) (java.lang.Math.sin(aslod.angle) * (aslod.value + aslod.ripple)), @@ -389,54 +388,54 @@ public class Grass { * (aslod.value + aslod.ripple)), 0.0f); - gl.programParameter4fNV(GL.VERTEX_PROGRAM_NV, 17, 1.7f, 5f, 2f, 0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV(GL.GL_VERTEX_PROGRAM_NV, 17, 1.7f, 5f, 2f, 0f); + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 18, -0.0187293f, 0.074261f, 0.2121144f, 1.570729f); - gl.programParameter4fNV(GL.VERTEX_PROGRAM_NV, 20, 0f, 0.5f, 1f, 0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV(GL.GL_VERTEX_PROGRAM_NV, 20, 0f, 0.5f, 1f, 0f); + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 21, 0.25f, -9f, 0.75f, 0.1591549f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 22, 24.9808f, -24.9808f, -60.14581f, 60.14581f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 23, 85.45379f, -85.45379f, -64.93935f, 64.93935f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 24, 19.73921f, -19.73921f, -1f, 1f); - gl.programParameter4fNV(GL.VERTEX_PROGRAM_NV, 25, 0f, 4f, 0f, 0f); - gl.programParameter4fNV( - GL.VERTEX_PROGRAM_NV, + GL.glProgramParameter4fNV(GL.GL_VERTEX_PROGRAM_NV, 25, 0f, 4f, 0f, 0f); + GL.glProgramParameter4fNV( + GL.GL_VERTEX_PROGRAM_NV, 19, 1f, 3.141593f, 0.5f, 1f); - gl.programParameter4fNV(GL.VERTEX_PROGRAM_NV, 26, 0.7f, 0.4f, 0f, 0f); - gl.callList(mesh); - gl.disable(GL.VERTEX_PROGRAM_NV); + GL.glProgramParameter4fNV(GL.GL_VERTEX_PROGRAM_NV, 26, 0.7f, 0.4f, 0f, 0f); + GL.glCallList(mesh); + GL.glDisable(GL.GL_VERTEX_PROGRAM_NV); } diff --git a/src/java/org/lwjgl/test/opengl/PbufferTest.java b/src/java/org/lwjgl/test/opengl/PbufferTest.java index 111d46ad..47ff8bcb 100644 --- a/src/java/org/lwjgl/test/opengl/PbufferTest.java +++ b/src/java/org/lwjgl/test/opengl/PbufferTest.java @@ -101,7 +101,6 @@ public class PbufferTest { gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); // gl = new GL("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); gl.create(); - glu = new GLU(gl); if ((Pbuffer.getPbufferCaps() & Pbuffer.PBUFFER_SUPPORTED) == 0) { System.out.println("No Pbuffer support!"); System.exit(1); @@ -189,49 +188,49 @@ public class PbufferTest { pbuffer.makeCurrent(); // Pbuffer rendering //clear background - gl.clear(GL.COLOR_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); // draw white quad - gl.pushMatrix(); + GL.glPushMatrix(); { - gl.translatef(quadPosition.x, quadPosition.y, 0); - gl.rotated(angle, 0.0f, 0.0f, 1.0f); - gl.color3f(1.0f, 1.0f, 1.0f); - gl.begin(GL.QUADS); + GL.glTranslatef(quadPosition.x, quadPosition.y, 0); + GL.glRotated(angle, 0.0f, 0.0f, 1.0f); + GL.glColor3f(1.0f, 1.0f, 1.0f); + GL.glBegin(GL.GL_QUADS); { - gl.vertex2i(-50, -50); - gl.vertex2i(50, -50); - gl.vertex2i(50, 50); - gl.vertex2i(-50, 50); + GL.glVertex2i(-50, -50); + GL.glVertex2i(50, -50); + GL.glVertex2i(50, 50); + GL.glVertex2i(-50, 50); } - gl.end(); + GL.glEnd(); } - gl.popMatrix(); - gl.copyTexImage2D(GL.TEXTURE_2D, 0, GL.RGB, 0, 0, 256, 256, 0); + GL.glPopMatrix(); + GL.glCopyTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGB, 0, 0, 256, 256, 0); Pbuffer.releaseContext(); // OpenGL window rendering - gl.clear(GL.COLOR_BUFFER_BIT); + GL.glClear(GL.GL_COLOR_BUFFER_BIT); // draw white quad - gl.pushMatrix(); + GL.glPushMatrix(); { - gl.translatef(quadPosition.x, quadPosition.y, 0); - gl.rotated(angle, 0.0f, 0.0f, 1.0f); - gl.color3f(1.0f, 1.0f, 0.0f); - gl.begin(GL.QUADS); + GL.glTranslatef(quadPosition.x, quadPosition.y, 0); + GL.glRotated(angle, 0.0f, 0.0f, 1.0f); + GL.glColor3f(1.0f, 1.0f, 0.0f); + GL.glBegin(GL.GL_QUADS); { - gl.texCoord2f(0f, 0f); - gl.vertex2i(-50, -50); - gl.texCoord2f(1f, 0f); - gl.vertex2i(50, -50); - gl.texCoord2f(1f, 1f); - gl.vertex2i(50, 50); - gl.texCoord2f(0f, 1f); - gl.vertex2i(-50, 50); + GL.glTexCoord2f(0f, 0f); + GL.glVertex2i(-50, -50); + GL.glTexCoord2f(1f, 0f); + GL.glVertex2i(50, -50); + GL.glTexCoord2f(1f, 1f); + GL.glVertex2i(50, 50); + GL.glTexCoord2f(0f, 1f); + GL.glVertex2i(-50, 50); } - gl.end(); + GL.glEnd(); } - gl.popMatrix(); + GL.glPopMatrix(); } private void initPbuffer() { @@ -239,7 +238,7 @@ public class PbufferTest { pbuffer = new Pbuffer(256, 256, mode.bpp, 0, 0, 0); pbuffer.makeCurrent(); initGLState(256, 256, 0.5f); - gl.bindTexture(GL.TEXTURE_2D, tex_handle); + GL.glBindTexture(GL.GL_TEXTURE_2D, tex_handle); Pbuffer.releaseContext(); } catch (Exception e) { e.printStackTrace(); @@ -267,7 +266,6 @@ public class PbufferTest { gl.create(); glInit(); initPbuffer(); - glu = new GLU(gl); Keyboard.create(); } catch (Exception e) { @@ -289,7 +287,6 @@ public class PbufferTest { gl.create(); glInit(); initPbuffer(); - glu = new GLU(gl); Keyboard.create(); @@ -344,7 +341,7 @@ public class PbufferTest { private void destroyTexture() { IntBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); buffer.put(0, tex_handle); - gl.deleteTextures(1, Sys.getDirectBufferAddress(buffer)); + GL.glDeleteTextures(1, buffer); } /** @@ -379,15 +376,15 @@ public class PbufferTest { } private void initGLState(int width, int height, float color) { - gl.matrixMode(GL.PROJECTION); - gl.loadIdentity(); - glu.ortho2D(0, mode.width, 0, mode.height); - gl.matrixMode(GL.MODELVIEW); - gl.loadIdentity(); - gl.viewport(0, 0, width, height); + GL.glMatrixMode(GL.GL_PROJECTION); + GL.glLoadIdentity(); + GLU.gluOrtho2D(0, mode.width, 0, mode.height); + GL.glMatrixMode(GL.GL_MODELVIEW); + GL.glLoadIdentity(); + GL.glViewport(0, 0, width, height); //set clear color to black - gl.clearColor(color, color, color, 0.0f); + GL.glClearColor(color, color, color, 0.0f); } /** @@ -400,17 +397,17 @@ public class PbufferTest { if (GL.WGL_EXT_swap_control) { GL.wglSwapIntervalEXT(1); } - gl.texEnvf(GL.TEXTURE_ENV, GL.TEXTURE_ENV_MODE, GL.REPLACE); - gl.enable(GL.TEXTURE_2D); + GL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE); + GL.glEnable(GL.GL_TEXTURE_2D); // Create shared texture IntBuffer buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); - gl.genTextures(1, Sys.getDirectBufferAddress(buffer)); + GL.glGenTextures(1, buffer); tex_handle = buffer.get(0); - gl.bindTexture(GL.TEXTURE_2D, tex_handle); - gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_WRAP_S, GL.CLAMP); - gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_WRAP_T, GL.CLAMP); - gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MIN_FILTER, GL.LINEAR); - gl.texParameteri(GL.TEXTURE_2D, GL.TEXTURE_MAG_FILTER, GL.LINEAR); + GL.glBindTexture(GL.GL_TEXTURE_2D, tex_handle); + GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP); + GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP); + GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); + GL.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); initGLState(mode.width, mode.height, 0f); }