New OpenAL programming model:

no context/device fiddling
 easier initialization
This commit is contained in:
Brian Matzon 2003-04-27 18:37:38 +00:00
parent b705ea51d0
commit 866e55ad22
21 changed files with 1123 additions and 1175 deletions

View File

@ -13,7 +13,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'Light Weight Java Game Library' nor the names of
* * Neither the name of 'Lightweight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@ -29,7 +29,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.lwjgl.openal;
package org.lwjgl.openal;
import org.lwjgl.Sys;
/**
* $Id$
@ -40,10 +42,69 @@
* @version $Revision$
*/
public class AL extends CoreAL {
/** ALC instance. */
protected ALC alc;
/** ALCdevice instance. */
protected ALCdevice device;
/** Current ALCcontext. */
protected ALCcontext context;
/**
* String that requests a certain device or device configuration.
* If null is specified, the implementation will provide an
* implementation specific default. */
protected String deviceArguments;
/** Frequency for mixing output buffer, in units of Hz. */
protected int contextFrequency;
/** Refresh intervalls, in units of Hz. */
protected int contextRefresh;
/** Flag, indicating a synchronous context. */
protected int contextSynchronized;
/**
* Creates an OpenAL instance
*
* @param deviceArguments Arguments supplied to native device
* @param contextFrequency Frequency for mixing output buffer, in units of Hz (Common values include 11025, 22050, and 44100).
* @param contextRefresh Refresh intervalls, in units of Hz.
* @param contextSynchronized Flag, indicating a synchronous context.*
*/
public AL(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized) {
this.deviceArguments = deviceArguments;
this.contextFrequency = contextFrequency;
this.contextRefresh = contextRefresh;
this.contextSynchronized = contextSynchronized ? ALC.TRUE : ALC.FALSE;
}
/**
* @see org.lwjgl.openal.BaseAL#create()
*/
public void create() throws OpenALException {
super.create();
/**
* Nothing to se here - please move along
*/
public AL() {
}
alc = new ALC(this);
alc.create();
device = alc.openDevice(deviceArguments);
context = alc.createContext(device.device,
Sys.getDirectBufferAddress(
ALCcontext.createAttributeList(contextFrequency, contextRefresh, contextSynchronized)));
alc.makeContextCurrent(context.context);
}
/**
* Retrieves the AL Context class
*/
public ALC getALC() {
return alc;
}
}

View File

@ -13,7 +13,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'Light Weight Java Game Library' nor the names of
* * Neither the name of 'Lightweight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@ -42,230 +42,251 @@ package org.lwjgl.openal;
*/
public class ALC {
/** Has the ALC object been created? */
protected static boolean created;
/** Bad value */
public static final int INVALID = -1;
/** Boolean False */
public static final int FALSE = 0;
/** Boolean True */
public static final int TRUE = 1;
/** Errors: No Error */
public static final int NO_ERROR = FALSE;
public static final int MAJOR_VERSION = 0x1000;
public static final int MINOR_VERSION = 0x1001;
public static final int ATTRIBUTES_SIZE = 0x1002;
public static final int ALL_ATTRIBUTES = 0x1003;
public static final int DEFAULT_DEVICE_SPECIFIER = 0x1004;
public static final int DEVICE_SPECIFIER = 0x1005;
public static final int EXTENSIONS = 0x1006;
public static final int FREQUENCY = 0x1007;
public static final int REFRESH = 0x1008;
public static final int SYNC = 0x1009;
/** The device argument does not name a valid device */
public static final int INVALID_DEVICE = 0xA001;
/** The context argument does not name a valid context */
public static final int INVALID_CONTEXT = 0xA002;
/**
* A function was called at inappropriate time, or in an inappropriate way,
* causing an illegal state. This can be an incompatible ALenum, object ID,
* and/or function.
*/
public static final int INVALID_ENUM = 0xA003;
/**
* Illegal value passed as an argument to an AL call.
* Applies to parameter values, but not to enumerations.
*/
public static final int INVALID_VALUE = 0xA004;
/**
* A function could not be completed, because there is not enough
* memory available.
*/
public static final int OUT_OF_MEMORY = 0xA005;
protected static boolean created;
/** Parent AL instance */
protected AL al = null;
/** Bad value */
public static final int INVALID = -1;
/** Boolean False */
public static final int FALSE = 0;
/** Boolean True */
public static final int TRUE = 1;
/** Errors: No Error */
public static final int NO_ERROR = FALSE;
public static final int MAJOR_VERSION = 0x1000;
public static final int MINOR_VERSION = 0x1001;
public static final int ATTRIBUTES_SIZE = 0x1002;
public static final int ALL_ATTRIBUTES = 0x1003;
public static final int DEFAULT_DEVICE_SPECIFIER = 0x1004;
public static final int DEVICE_SPECIFIER = 0x1005;
public static final int EXTENSIONS = 0x1006;
public static final int FREQUENCY = 0x1007;
public static final int REFRESH = 0x1008;
public static final int SYNC = 0x1009;
/** The device argument does not name a valid device */
public static final int INVALID_DEVICE = 0xA001;
/** The context argument does not name a valid context */
public static final int INVALID_CONTEXT = 0xA002;
/**
* A function was called at inappropriate time, or in an inappropriate way,
* causing an illegal state. This can be an incompatible ALenum, object ID,
* and/or function.
*/
public static final int INVALID_ENUM = 0xA003;
/**
* Illegal value passed as an argument to an AL call.
* Applies to parameter values, but not to enumerations.
*/
public static final int INVALID_VALUE = 0xA004;
/**
* A function could not be completed, because there is not enough
* memory available.
*/
public static final int OUT_OF_MEMORY = 0xA005;
static {
initialize();
}
/** Creates a new instance of ALC */
public ALC() {
}
/**
* Override to provide any initialization code after creation.
*/
/** Creates a new instance of ALC */
protected ALC(AL al) {
this.al = al;
}
/**
* Override to provide any initialization code after creation.
*/
protected void init() {
}
/**
* Static initialization
*/
private static void initialize() {
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
}
/**
* Creates the ALC instance
*
* @throws Exception if a failiure occured in the ALC creation process
*/
public void create() throws Exception {
/**
* Creates the ALC instance
*
* @throws Exception if a failiure occured in the ALC creation process
*/
protected void create() throws OpenALException {
if (created) {
return;
}
}
if (!nCreate()) {
throw new Exception("ALC instance could not be created.");
}
created = true;
init();
throw new OpenALException("ALC instance could not be created.");
}
init();
created = true;
}
/**
* Native method to create ALC instance
*
* @return true if the ALC creation process succeeded
*/
protected native boolean nCreate();
/**
* Calls whatever destruction rutines that are needed
*/
public void destroy() {
protected void destroy() {
if (!created) {
return;
}
created = false;
nDestroy();
}
created = false;
nDestroy();
}
/**
* Native method the destroy the ALC
*/
protected native void nDestroy();
protected native void nDestroy();
/**
* Returns strings related to the context.
*
* @param pname Property to get
* @return String property from device
*/
public String getString(int pname) {
return nGetString(al.device.device, pname);
}
native String nGetString(int device, int pname);
/**
* Returns integers related to the context.
*
* @param pname Property to get
* @param size Size of destination buffer provided
* @param integerdata address of ByteBuffer to write integers to
*/
public void getIntegerv(int pname, int size, int integerdata) {
nGetIntegerv(al.device.device, pname, size, integerdata);
}
/**
* Returns strings related to the context.
*
* @param device ALCdevice to query
* @param pname Property to get
* @return String property from device
*/
public native String getString(ALCdevice device, int pname);
/**
* Returns integers related to the context.
*
* @param device ALCdevice to query
* @param pname Property to get
* @param size Size of destination buffer provided
* @param integerdata address of ByteBuffer to write integers to
*/
public native void getIntegerv(ALCdevice device, int pname, int size, int integerdata);
/**
* Opens the named device. If null is specied, the implementation will
* provide an implementation specic default.
*
* @param devicename name of device to open
* @return opened device, or null
*/
public native ALCdevice openDevice(String devicename);
/**
* Closes the supplied device.
*
* @param device ALCdevice to close
*/
public native void closeDevice(ALCdevice device);
/**
* Creates a context using a specified device.
*
* @param device ALCdevice to associate context to
* @param attrList address of ByteBuffer to read attributes from
* @return New context, or null if creation failed
*/
public native ALCcontext createContext(ALCdevice device, int attrList);
/**
* Makes the supplied context the current one
*
* @param context ALCcontext to make current
* @return true if successfull, false if not
*/
public native boolean makeContextCurrent(ALCcontext context);
/**
* Tells a context to begin processing.
*
* @param context context that should begin processing
*/
public native void processContext(ALCcontext context);
/**
* Gets the current context
*
* @return Current ALCcontext
*/
public native ALCcontext getCurrentContext();
/**
* Retrives the device associated with the supplied context
*
* @param context ALCcontext to get device for
* @param ALCdevice associated with context
*/
public native ALCdevice getContextsDevice(ALCcontext context);
/**
* Suspends processing on supplied context
*
* @param context ALCcontext to suspend
*/
public native void suspendContext(ALCcontext context);
/**
* Destroys supplied context
*
* @param context ALCcontext to Destroy
*/
public native void destroyContext(ALCcontext context);
/**
* Retrieves the current context error state.
*
* @param device ALDdevice associated with context
* @return Errorcode from ALC statemachine
*/
public native int getError(ALCdevice device);
/**
* Query if a specified context extension is available.
*
* @param device device to query for extension
* @param extName name of extension to find
* @return true if extension is available, false if not
*/
public native boolean isExtensionPresent(ALCdevice device, String extName);
/**
* retrieves the enum value for a specified enumeration name.
*
* @param device Device to query
* @param enumName name of enum to find
* @return value of enumeration
*/
public native int getEnumValue(ALCdevice device, String enumName);
native void nGetIntegerv(int device, int pname, int size, int integerdata);
/**
* Opens the named device. If null is specied, the implementation will
* provide an implementation specic default.
*
* @param devicename name of device to open
* @return opened device, or null
*/
native ALCdevice openDevice(String devicename);
/**
* Closes the supplied device.
*
* @param device address of native device to close
*/
native void closeDevice(int device);
/**
* Creates a context using a specified device.
*
* @param device address of device to associate context to
* @param attrList address of ByteBuffer to read attributes from
* @return New context, or null if creation failed
*/
native ALCcontext createContext(int device, int attrList);
/**
* Makes the supplied context the current one
*
* @param context address of context to make current
* @return true if successfull, false if not
*/
native boolean makeContextCurrent(int context);
/**
* Tells a context to begin processing.
*/
public void processContext() {
nProcessContext(al.context.context);
}
native void nProcessContext(int context);
/**
* Gets the current context
*
* @return Current ALCcontext
*/
native ALCcontext getCurrentContext();
/**
* Retrives the device associated with the supplied context
*
* @param context address of context to get device for
* @param ALCdevice associated with context
*/
native ALCdevice getContextsDevice(int context);
/**
* Suspends processing on supplied context
*
* @param context address of context to suspend
*/
native void suspendContext(int context);
/**
* Destroys supplied context
*
* @param context address of context to Destroy
*/
native void destroyContext(int context);
/**
* Retrieves the current context error state.
*
* @return Errorcode from ALC statemachine
*/
public int getError() {
return nGetError(al.device.device);
}
native int nGetError(int device);
/**
* Query if a specified context extension is available.
*
* @param extName name of extension to find
* @return true if extension is available, false if not
*/
public boolean isExtensionPresent(String extName) {
return nIsExtensionPresent(al.device.device, extName);
}
native boolean nIsExtensionPresent(int device, String extName);
/**
* retrieves the enum value for a specified enumeration name.
*
* @param enumName name of enum to find
* @return value of enumeration
*/
public int getEnumValue(String enumName) {
return nGetEnumValue(al.device.device, enumName);
}
native int nGetEnumValue(int device, String enumName);
}

View File

@ -13,7 +13,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'Light Weight Java Game Library' nor the names of
* * Neither the name of 'Lightweight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@ -29,7 +29,10 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.lwjgl.openal;
package org.lwjgl.openal;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
* $Id$
@ -39,7 +42,7 @@
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
*/
public class ALCcontext {
class ALCcontext {
/** address of actual context */
public final int context;
@ -51,5 +54,19 @@ public class ALCcontext {
*/
public ALCcontext(int context) {
this.context = context;
}
}
}
public static ByteBuffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) {
ByteBuffer attribList = ByteBuffer.allocateDirect(7*4).order(ByteOrder.nativeOrder());
attribList.putInt(ALC.FREQUENCY);
attribList.putInt(contextFrequency);
attribList.putInt(ALC.REFRESH);
attribList.putInt(contextRefresh);
attribList.putInt(ALC.SYNC);
attribList.putInt(contextSynchronized);
attribList.putInt(0); //terminating int
return attribList;
}
}

View File

@ -13,7 +13,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'Light Weight Java Game Library' nor the names of
* * Neither the name of 'Lightweight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@ -29,7 +29,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.lwjgl.openal;
package org.lwjgl.openal;
/**
* $Id$
@ -39,7 +39,7 @@
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
*/
public class ALCdevice {
class ALCdevice {
/** address of actual device */
public final int device;
@ -52,4 +52,4 @@ public class ALCdevice {
public ALCdevice(int device) {
this.device = device;
}
}
}

View File

@ -47,83 +47,87 @@ import java.util.StringTokenizer;
* @version $Revision$
*/
public abstract class BaseAL {
/** Has the ALC object been created? */
protected static boolean created;
/** Have we been created? */
protected static boolean created;
static {
initialize();
}
/**
* Override to provide any initialization code after creation.
*/
protected void init() throws OpenALException {
}
/**
* Static initialization
*/
private static void initialize() {
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
}
/**
* Creates the AL instance
*
* @throws Exception if a failiure occured in the AL creation process
*/
public void create() throws OpenALException {
if (created) {
return;
}
static {
initialize();
}
// need to pass path of possible locations of OAL to native side
String libpath = System.getProperty("java.library.path");
String seperator = System.getProperty("path.separator");
String libname;
/**
* Override to provide any initialization code after creation.
*/
protected void init() throws Exception {
}
// libname is hardcoded atm - this will change in a near future...
libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1)
? "libopenal.so"
: "OpenAL32.dll";
/**
* Static initialization
*/
private static void initialize() {
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
}
StringTokenizer st = new StringTokenizer(libpath, seperator);
//create needed string array
String[] oalPaths = new String[st.countTokens()+1];
/**
* Creates the AL instance
*
* @throws Exception if a failiure occured in the AL creation process
*/
public void create() throws Exception {
if (created) {
return;
}
//build paths
for(int i=0;i<oalPaths.length - 1;i++) {
oalPaths[i] = st.nextToken() + File.separator + libname;
}
// need to pass path of possible locations of OAL to native side
String libpath = System.getProperty("java.library.path");
String seperator = System.getProperty("path.separator");
String libname;
// libname is hardcoded atm - this will change in a near future...
libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) ? "libopenal.so" : "OpenAL32.dll";
StringTokenizer st = new StringTokenizer(libpath, seperator);
//create needed string array
String[] oalPaths = new String[st.countTokens() + 1];
//build paths
for (int i = 0; i < oalPaths.length - 1; i++) {
oalPaths[i] = st.nextToken() + File.separator + libname;
}
//add cwd path
oalPaths[oalPaths.length - 1] = libname;
if (!nCreate(oalPaths)) {
throw new Exception("AL instance could not be created.");
}
init();
created = true;
}
/**
* Native method to create AL instance
*
* @return true if the AL creation process succeeded
*/
protected native boolean nCreate(String[] oalPaths);
/**
* Calls whatever destruction rutines that are needed
*/
public void destroy() {
if (!created) {
return;
}
created = false;
nDestroy();
}
/**
* Native method the destroy the AL
*/
protected native void nDestroy();
}
//add cwd path
oalPaths[oalPaths.length-1] = libname;
if (!nCreate(oalPaths)) {
throw new OpenALException("AL instance could not be created.");
}
init();
created = true;
}
/**
* Native method to create AL instance
*
* @param oalPaths Array of strings containing paths to search for OpenAL library
* @return true if the AL creation process succeeded
*/
protected native boolean nCreate(String[] oalPaths);
/**
* Calls whatever destruction rutines that are needed
*/
public void destroy() {
if (!created) {
return;
}
created = false;
nDestroy();
}
/**
* Native method the destroy the AL
*/
protected native void nDestroy();
}

View File

@ -81,7 +81,7 @@ public interface BaseALConstants {
/**
* Specify the pitch to be applied, either at source,
* or on mixer results, at listener.
* or on mixer results, at listener.
* Range: [0.5-2.0]
* Default: 1.0
*/
@ -90,11 +90,11 @@ public interface BaseALConstants {
/**
* Specify the current location in three dimensional space.
* OpenAL, like OpenGL, uses a right handed coordinate system,
* where in a frontal default view X (thumb) points right,
* Y points up (index finger), and Z points towards the
* viewer/camera (middle finger).
* where in a frontal default view X (thumb) points right,
* Y points up (index finger), and Z points towards the
* viewer/camera (middle finger).
* To switch from a left handed coordinate system, flip the
* sign on the Z coordinate.
* sign on the Z coordinate.
* Listener position is always in the world coordinate system.
*/
public static final int POSITION = 0x1004;
@ -128,8 +128,8 @@ public interface BaseALConstants {
* Each division by 2 equals an attenuation of -6dB.
* Each multiplicaton with 2 equals an amplification of +6dB.
* A value of 0.0 is meaningless with respect to a logarithmic
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
*/
public static final int GAIN = 0x100A;
@ -179,8 +179,8 @@ public interface BaseALConstants {
* Each division by 2 equals an attenuation of -6dB.
* Each multiplicaton with 2 equals an amplification of +6dB.
* A value of 0.0 is meaningless with respect to a logarithmic
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
* scale; it is interpreted as zero volume - the channel
* is effectively disabled.
*/
public static final int CONE_OUTER_GAIN = 0x1022;
@ -234,40 +234,40 @@ public interface BaseALConstants {
/**
* Sound buffers: frequency, in units of Hertz [Hz].
* This is the number of samples per second. Half of the
* sample frequency marks the maximum significant
* frequency component.
* sample frequency marks the maximum significant
* frequency component.
*/
public static final int FREQUENCY = 0x2001;
/**
* Sound buffers: frequency, in units of Hertz [Hz].
* This is the number of samples per second. Half of the
* sample frequency marks the maximum significant
* frequency component.
* sample frequency marks the maximum significant
* frequency component.
*/
public static final int BITS = 0x2002;
/**
* Sound buffers: frequency, in units of Hertz [Hz].
* This is the number of samples per second. Half of the
* sample frequency marks the maximum significant
* frequency component.
* sample frequency marks the maximum significant
* frequency component.
*/
public static final int CHANNELS = 0x2003;
/**
* Sound buffers: frequency, in units of Hertz [Hz].
* This is the number of samples per second. Half of the
* sample frequency marks the maximum significant
* frequency component.
* sample frequency marks the maximum significant
* frequency component.
*/
public static final int SIZE = 0x2004;
/**
* Sound buffers: frequency, in units of Hertz [Hz].
* This is the number of samples per second. Half of the
* sample frequency marks the maximum significant
* frequency component.
* sample frequency marks the maximum significant
* frequency component.
*/
public static final int DATA = 0x2005;
@ -295,14 +295,10 @@ public interface BaseALConstants {
/** Errors: No Error. */
public static final int NO_ERROR = FALSE;
/**
* Illegal name passed as an argument to an AL call.
*/
/** Illegal name passed as an argument to an AL call. */
public static final int INVALID_NAME = 0xA001;
/**
* Illegal enum passed as an argument to an AL call.
*/
/** Illegal enum passed as an argument to an AL call. */
public static final int INVALID_ENUM = 0xA002;
/**
@ -337,19 +333,13 @@ public interface BaseALConstants {
/** Context strings: Extensions */
public static final int EXTENSIONS = 0xB004;
/**
* Doppler scale. Default 1.0
*/
/** Doppler scale. Default 1.0 */
public static final int DOPPLER_FACTOR = 0xC000;
/**
* Doppler velocity. Default 1.0
*/
/** Doppler velocity. Default 1.0 */
public static final int DOPPLER_VELOCITY = 0xC001;
/**
* Distance model. Default INVERSE_DISTANCE_CLAMPED
*/
/** Distance model. Default INVERSE_DISTANCE_CLAMPED */
public static final int DISTANCE_MODEL = 0xD000;
/** Distance model */

View File

@ -41,444 +41,455 @@ package org.lwjgl.openal;
* @version $Revision$
*/
public class CoreAL extends BaseAL implements BaseALConstants {
/** Creates a new instance of CoreAL */
public CoreAL() {
}
/**
* Enables a feature of the OpenAL driver.
*
* @param capability name of a capability to enable
*/
public native void enable(int capability);
/**
* Disables a feature of the OpenAL driver.
*
* @param capability name of a capability to disable
*/
public native void disable(int capability);
/**
* Checks if a specific feature is enabled in the OpenAL driver.
*
* @param capability name of a capability to check
* @return true if named feature is enabled
*/
public native boolean isEnabled(int capability);
/**
* Hinting for implementation
* NOTE: This method is a NOP, but is provided for completeness.
*
* @param target FIXME
* @param mode FIXME
*/
public native void hint(int target, int mode);
/**
* Returns a boolean OpenAL state.
*
* @param parameter state to be queried
* @return boolean state described by pname will be returned.
*/
public native boolean getBoolean(int pname);
/**
* Returns an int OpenAL state.
*
* @param parameter state to be queried
* @return int state described by pname will be returned.
*/
public native int getInteger(int pname);
/**
* Returns a float OpenAL state.
*
* @param parameter state to be queried
* @return float state described by pname will be returned.
*/
public native float getFloat(int pname);
/**
* Returns a double OpenAL state.
*
* @param parameter state to be queried
* @return double state described by pname will be returned.
*/
public native double getDouble(int pname);
/**
* Returns a boolean OpenAL state.
*
* @param parameter state to be queried
* @param data address of ByteBuffer to place the booleans in
*/
public native void getBooleanv(int pname, int data);
/**
* Returns an integer OpenAL state.
*
* @param parameter state to be queried
* @param data address of ByteBuffer to place the integers in
*/
public native void getIntegerv(int pname, int data);
/**
* Returns a floating point OpenAL state.
*
* @param parameter state to be queried
* @param data address of ByteBuffer to place the floats in
*/
public native void getFloatv(int pname, int data);
/**
* Returns a double OpenAL state.
*
* @param parameter state to be queried
* @param data address of ByteBuffer to place the floats in
*/
public native void getDoublev(int pname, int data);
/**
* Retrieve an OpenAL string property.
*
* @param pname The property to be returned
* @return OpenAL String property
*/
public native String getString(int pname);
/**
* Retrieve the current error state and then clears the error state.
*
* @return current error state
*/
public native int getError();
/** Creates a new instance of CoreAL */
public CoreAL() {
super();
}
/**
* Test if a specific extension is available for the OpenAL driver.
*
* @param fname String describing the desired extension
* @return true if extension is available, false if not
*/
public native boolean isExtensionPresent(String fname);
/**
* Returns the enumeration value of an OpenAL enum described by a string.
*
* @param ename String describing an OpenAL enum
* @return Actual int for the described enumeration name
*/
public native int getEnumValue(String ename);
/**
* Sets an integer property of the listener
*
* @param pname name of the attribute to be set
* @param integer value to set the attribute to
*/
public native void listeneri(int pname, int value);
/**
* Sets a floating point property of the listener
*
* @param pname name of the attribute to be set
* @param value floating point value to set the attribute to
*/
public native void listenerf(int pname, float value);
/**
* Sets a floating point property of the listener
*
* @param pname name of the attribute to be set
* @param v1 value value 1
* @param v2 value value 2
* @param v3 float value 3
*/
public native void listener3f(int pname, float v1, float v2, float v3);
/**
* Sets a floating point vector property of the listener
*
* @param pname name of the attribute to be set
* @param floatdata bytebuffer address to read floats from
*/
public native void listenerfv(int pname, int floatdata);
/**
* Gets an integer property of the listener.
*
* @param pname name of the attribute to be retrieved
* @param integerdata bytebuffer address to write integer to
*/
public native void getListeneri(int pname, int integerdata);
/**
* Gets a floating point property of the listener.
*
* @param pname name of the attribute to be retrieved
* @param floatdata bytebuffer address to write float to
*/
public native void getListenerf(int pname, int floatdata);
/**
* Retrieves a set of three floating point values from a
* property of the listener.
*
* @param pname name of the attribute to be retrieved
* @param v1 bytebuffer address to write float 1 to
* @param v2 bytebuffer address to write float 2 to
* @param v3 bytebuffer address to write float 3 to
*/
public native void getListener3f(int pname, int v1, int v2, int v3);
/**
* Retrieves a floating point vector property of the listener.
*
* @param pname name of the attribute to be retrieved
* @param floatdata bytebuffer address to write floats to
*/
public native void getListenerfv(int pname, int floatdata);
/**
* Generate one or more sources.
*
* @param n number of sources to generate
* @param sources array holding sources
*/
public native void genSources(int n, int sources);
/**
* Delete one or more sources.
*
* @param n Number of sources to delete
* @param source Source array to delete from
*/
public native void deleteSources(int n, int source);
/**
* Enables a feature of the OpenAL driver.
*
* @param capability name of a capability to enable
*/
public native void enable(int capability);
/**
* Tests if a source is valid.
*
* @param id id of source to be testes for validity
* @return true if id is valid, false if not
*/
public native boolean isSource(int id);
/**
* Set an integer property of a source.
*
* @param source Source to det property on
* @param pname property to set
* @param value value of property
*/
public native void sourcei(int source, int pname, int value);
/**
* Set a floating point property of a source.
*
* @param source Source to det property on
* @param pname property to set
* @param value value of property
*/
public native void sourcef(int source, int pname, float value);
/**
* Sets a source property requiring three floating point values.
*
* @param source Source to set property on
* @param pname property to set
* @param v1 value 1 of property
* @param v2 value 2 of property
* @param v3 value 3 of property
*/
public native void source3f(int source, int pname, float v1, float v2, float v3);
/**
* Sets a floating point vector property of a source.
*
* @param source source whichs attribute is being set
* @param pname name of the attribute being set
* @param floatdata bytebuffer address to read floats from
*/
public native void sourcefv(int source, int pname, int floatdata);
/**
* Retrieves an integer property of a source.
*
* @param source source to get property from
* @param pname name of property
* @param integerdata bytebuffer address to write integer to
*/
public native void getSourcei(int source, int pname, int integerdata);
/**
* Retrieves a floating point property of a source.
*
* @param source source to get property from
* @param pname name of property
* @param floatdata bytebuffer address to write float to
*/
public native void getSourcef(int source, int pname, int floatdata);
/**
* Gets a floating point vector property from a Source object.
*
* @param source Source to get property from
* @param pname property to get
* @param floatdata bytebuffer address to write floats to
*/
public native void getSourcefv(int source, int pname, int floatdata);
/**
* Plays a set of sources.
*
* @param n number of sources to play
* @param source array of sources to play
*/
public native void sourcePlayv(int n, int sources);
/**
* Disables a feature of the OpenAL driver.
*
* @param capability name of a capability to disable
*/
public native void disable(int capability);
/**
* Pauses a set of sources.
*
* @param n number of sources to pause
* @param source array of sources to pause
*/
public native void sourcePausev(int n, int sources);
/**
* Checks if a specific feature is enabled in the OpenAL driver.
*
* @param capability name of a capability to check
* @return true if named feature is enabled
*/
public native boolean isEnabled(int capability);
/**
* Stops a set of sources.
*
* @param n number of sources to stop
* @param source array of sources to stop
*/
public native void sourceStopv(int n, int sources);
/**
* Rewinds a set of sources.
*
* @param n number of sources to rewind
* @param source array of sources to rewind
*/
public native void sourceRewindv(int n, int sources);
/**
* Play a source.
*
* @param source Source to play
*/
public native void sourcePlay(int source);
/**
* Hinting for implementation
* NOTE: This method is a NOP, but is provided for completeness.
*
* @param target FIXME
* @param mode FIXME
*/
public native void hint(int target, int mode);
/**
* Pauses a source.
*
* @param source Source to pause
*/
public native void sourcePause(int source);
/**
* Stops a source.
*
* @param source Source to stop
*/
public native void sourceStop(int source);
/**
* Rewinds a source.
*
* @param source Source to rewind
*/
public native void sourceRewind(int source);
/**
* Returns a boolean OpenAL state.
*
* @param parameter state to be queried
* @return boolean state described by pname will be returned.
*/
public native boolean getBoolean(int pname);
/**
* Generate one or more buffers.
*
* @param n number of buffers to generate
* @param buffers array holding buffers
*/
public native void genBuffers(int n, int buffers);
/**
* Delete one or more buffers.
*
* @param n Number of buffers to delete
* @param buffers Buffer array to delete from
*/
public native void deleteBuffers(int n, int buffers);
/**
* Tests if buffer is valid.
*
* @param buffer buffer to be tested for validity
* @return true if supplied buffer is valid, false if not
*/
public native boolean isBuffer(int buffer);
/**
* Fill a buffer with audio data.
*
* @param buffer Buffer to fill
* @param format format sound data is in
* @param data location of data (pointer)
* @param size size of data segment
* @param freq frequency of data
*/
public native void bufferData(int buffer, int format, int data, int size, int freq);
/**
* Retrieves an integer property from a buffer.
*
* @param buffer buffer to get property from
* @param pname name of property to retrieve
* @param integerdata bytebuffer address to write integer to
*/
public native void getBufferi(int buffer, int pname, int integerdata);
/**
* Returns an int OpenAL state.
*
* @param parameter state to be queried
* @return int state described by pname will be returned.
*/
public native int getInteger(int pname);
/**
* Retrieves a floating point property from a buffer.
*
* @param buffer buffer to get property from
* @param pname name of property to retrieve
* @param floatdata bytebuffer address to write float to
*/
public native void getBufferf(int buffer, int pname, int floatdata);
/**
* Queues a set of buffers on a source.
*
* @param source source to queue buffers onto
* @param n number of buffers to be queued
* @param buffers buffers to be queued
*/
public native void sourceQueueBuffers(int source, int n, int buffers);
/**
* Unqueues a set of buffers attached to a source.
*
* @param source source to unqueue buffers from
* @param n number of buffers to be unqueued
* @param buffers buffers to be unqueued
*/
public native void sourceUnqueueBuffers(int source, int n, int buffers);
/**
* Selects the OpenAL distance model.
*
* @param value distance model to be set
*/
public native void distanceModel(int value);
/**
* Selects the OpenAL Doppler factor value.
*
* @param value Doppler scale value to set
*/
public native void dopplerFactor(float value);
/**
* Selects the OpenAL Doppler velocity value.
*
* @param value Doppler velocity value to set
*/
public native void dopplerVelocity(float value);
/**
* Returns a float OpenAL state.
*
* @param parameter state to be queried
* @return float state described by pname will be returned.
*/
public native float getFloat(int pname);
/**
* Returns a double OpenAL state.
*
* @param parameter state to be queried
* @return double state described by pname will be returned.
*/
public native double getDouble(int pname);
/**
* Returns a boolean OpenAL state.
*
* @param parameter state to be queried
* @param data address of ByteBuffer to place the booleans in
*/
public native void getBooleanv(int pname, int data);
/**
* Returns an integer OpenAL state.
*
* @param parameter state to be queried
* @param data address of ByteBuffer to place the integers in
*/
public native void getIntegerv(int pname, int data);
/**
* Returns a floating point OpenAL state.
*
* @param parameter state to be queried
* @param data address of ByteBuffer to place the floats in
*/
public native void getFloatv(int pname, int data);
/**
* Returns a double OpenAL state.
*
* @param parameter state to be queried
* @param data address of ByteBuffer to place the floats in
*/
public native void getDoublev(int pname, int data);
/**
* Retrieve an OpenAL string property.
*
* @param pname The property to be returned
* @return OpenAL String property
*/
public native String getString(int pname);
/**
* Retrieve the current error state and then clears the error state.
*
* @return current error state
*/
public native int getError();
/**
* Test if a specific extension is available for the OpenAL driver.
*
* @param fname String describing the desired extension
* @return true if extension is available, false if not
*/
public native boolean isExtensionPresent(String fname);
/**
* Returns the enumeration value of an OpenAL enum described by a string.
*
* @param ename String describing an OpenAL enum
* @return Actual int for the described enumeration name
*/
public native int getEnumValue(String ename);
/**
* Sets an integer property of the listener
*
* @param pname name of the attribute to be set
* @param integer value to set the attribute to
*/
public native void listeneri(int pname, int value);
/**
* Sets a floating point property of the listener
*
* @param pname name of the attribute to be set
* @param value floating point value to set the attribute to
*/
public native void listenerf(int pname, float value);
/**
* Sets a floating point property of the listener
*
* @param pname name of the attribute to be set
* @param v1 value value 1
* @param v2 value value 2
* @param v3 float value 3
*/
public native void listener3f(int pname, float v1, float v2, float v3);
/**
* Sets a floating point vector property of the listener
*
* @param pname name of the attribute to be set
* @param floatdata bytebuffer address to read floats from
*/
public native void listenerfv(int pname, int floatdata);
/**
* Gets an integer property of the listener.
*
* @param pname name of the attribute to be retrieved
* @param integerdata bytebuffer address to write integer to
*/
public native void getListeneri(int pname, int integerdata);
/**
* Gets a floating point property of the listener.
*
* @param pname name of the attribute to be retrieved
* @param floatdata bytebuffer address to write float to
*/
public native void getListenerf(int pname, int floatdata);
/**
* Retrieves a set of three floating point values from a
* property of the listener.
*
* @param pname name of the attribute to be retrieved
* @param v1 bytebuffer address to write float 1 to
* @param v2 bytebuffer address to write float 2 to
* @param v3 bytebuffer address to write float 3 to
*/
public native void getListener3f(int pname, int v1, int v2, int v3);
/**
* Retrieves a floating point vector property of the listener.
*
* @param pname name of the attribute to be retrieved
* @param floatdata bytebuffer address to write floats to
*/
public native void getListenerfv(int pname, int floatdata);
/**
* Generate one or more sources.
*
* @param n number of sources to generate
* @param sources array holding sources
*/
public native void genSources(int n, int sources);
/**
* Delete one or more sources.
*
* @param n Number of sources to delete
* @param source Source array to delete from
*/
public native void deleteSources(int n, int source);
/**
* Tests if a source is valid.
*
* @param id id of source to be testes for validity
* @return true if id is valid, false if not
*/
public native boolean isSource(int id);
/**
* Set an integer property of a source.
*
* @param source Source to det property on
* @param pname property to set
* @param value value of property
*/
public native void sourcei(int source, int pname, int value);
/**
* Set a floating point property of a source.
*
* @param source Source to det property on
* @param pname property to set
* @param value value of property
*/
public native void sourcef(int source, int pname, float value);
/**
* Sets a source property requiring three floating point values.
*
* @param source Source to set property on
* @param pname property to set
* @param v1 value 1 of property
* @param v2 value 2 of property
* @param v3 value 3 of property
*/
public native void source3f(
int source,
int pname,
float v1,
float v2,
float v3);
/**
* Sets a floating point vector property of a source.
*
* @param source source whichs attribute is being set
* @param pname name of the attribute being set
* @param floatdata bytebuffer address to read floats from
*/
public native void sourcefv(int source, int pname, int floatdata);
/**
* Retrieves an integer property of a source.
*
* @param source source to get property from
* @param pname name of property
* @param integerdata bytebuffer address to write integer to
*/
public native void getSourcei(int source, int pname, int integerdata);
/**
* Retrieves a floating point property of a source.
*
* @param source source to get property from
* @param pname name of property
* @param floatdata bytebuffer address to write float to
*/
public native void getSourcef(int source, int pname, int floatdata);
/**
* Gets a floating point vector property from a Source object.
*
* @param source Source to get property from
* @param pname property to get
* @param floatdata bytebuffer address to write floats to
*/
public native void getSourcefv(int source, int pname, int floatdata);
/**
* Plays a set of sources.
*
* @param n number of sources to play
* @param source array of sources to play
*/
public native void sourcePlayv(int n, int sources);
/**
* Pauses a set of sources.
*
* @param n number of sources to pause
* @param source array of sources to pause
*/
public native void sourcePausev(int n, int sources);
/**
* Stops a set of sources.
*
* @param n number of sources to stop
* @param source array of sources to stop
*/
public native void sourceStopv(int n, int sources);
/**
* Rewinds a set of sources.
*
* @param n number of sources to rewind
* @param source array of sources to rewind
*/
public native void sourceRewindv(int n, int sources);
/**
* Play a source.
*
* @param source Source to play
*/
public native void sourcePlay(int source);
/**
* Pauses a source.
*
* @param source Source to pause
*/
public native void sourcePause(int source);
/**
* Stops a source.
*
* @param source Source to stop
*/
public native void sourceStop(int source);
/**
* Rewinds a source.
*
* @param source Source to rewind
*/
public native void sourceRewind(int source);
/**
* Generate one or more buffers.
*
* @param n number of buffers to generate
* @param buffers array holding buffers
*/
public native void genBuffers(int n, int buffers);
/**
* Delete one or more buffers.
*
* @param n Number of buffers to delete
* @param buffers Buffer array to delete from
*/
public native void deleteBuffers(int n, int buffers);
/**
* Tests if buffer is valid.
*
* @param buffer buffer to be tested for validity
* @return true if supplied buffer is valid, false if not
*/
public native boolean isBuffer(int buffer);
/**
* Fill a buffer with audio data.
*
* @param buffer Buffer to fill
* @param format format sound data is in
* @param data location of data (pointer)
* @param size size of data segment
* @param freq frequency of data
*/
public native void bufferData(
int buffer,
int format,
int data,
int size,
int freq);
/**
* Retrieves an integer property from a buffer.
*
* @param buffer buffer to get property from
* @param pname name of property to retrieve
* @param integerdata bytebuffer address to write integer to
*/
public native void getBufferi(int buffer, int pname, int integerdata);
/**
* Retrieves a floating point property from a buffer.
*
* @param buffer buffer to get property from
* @param pname name of property to retrieve
* @param floatdata bytebuffer address to write float to
*/
public native void getBufferf(int buffer, int pname, int floatdata);
/**
* Queues a set of buffers on a source.
*
* @param source source to queue buffers onto
* @param n number of buffers to be queued
* @param buffers buffers to be queued
*/
public native void sourceQueueBuffers(int source, int n, int buffers);
/**
* Unqueues a set of buffers attached to a source.
*
* @param source source to unqueue buffers from
* @param n number of buffers to be unqueued
* @param buffers buffers to be unqueued
*/
public native void sourceUnqueueBuffers(int source, int n, int buffers);
/**
* Selects the OpenAL distance model.
*
* @param value distance model to be set
*/
public native void distanceModel(int value);
/**
* Selects the OpenAL Doppler factor value.
*
* @param value Doppler scale value to set
*/
public native void dopplerFactor(float value);
/**
* Selects the OpenAL Doppler velocity value.
*
* @param value Doppler velocity value to set
*/
public native void dopplerVelocity(float value);
}

View File

@ -32,8 +32,6 @@
package org.lwjgl.test.openal;
import org.lwjgl.openal.ALC;
import org.lwjgl.openal.ALCcontext;
import org.lwjgl.openal.ALCdevice;
import org.lwjgl.Sys;
import java.nio.IntBuffer;
@ -47,102 +45,73 @@ import java.nio.IntBuffer;
* @version $Revision$
*/
public class ALCTest extends BasicTest {
/**
* Creates an instance of ALCTest
*/
public ALCTest() {
super();
}
/**
* Runs the actual test, using supplied arguments
*/
protected void execute(String[] args) {
//error stuff
int lastError = ALC.NO_ERROR;
//create a device
device = alc.openDevice(null);
if(device == null) {
System.out.println("Unable to create device");
System.exit(-1);
}
//create attribute list for context creation
IntBuffer buffer = createIntBuffer(7);
buffer.put(ALC.FREQUENCY);
buffer.put(44100);
buffer.put(ALC.REFRESH);
buffer.put(15);
buffer.put(ALC.SYNC);
buffer.put(ALC.FALSE);
buffer.put(0); //terminating int
//create a context, using above attributes
context = alc.createContext(device, Sys.getDirectBufferAddress(buffer));
if(context == null) {
System.out.println("Unable to create context");
System.exit(-1);
}
if((lastError = alc.getError(device)) != ALC.NO_ERROR) {
System.out.println("ALC Error: " + alc.getString(device, lastError));
System.exit(-1);
}
//make current
alc.makeContextCurrent(context);
//process
alc.processContext(context);
//suspend
// alc.suspendContext(context);
//query
System.out.println("DEFAULT_DEVICE_SPECIFIER: " + alc.getString(device, ALC.DEFAULT_DEVICE_SPECIFIER));
System.out.println("DEVICE_SPECIFIER: " + alc.getString(device, ALC.DEVICE_SPECIFIER));
System.out.println("EXTENSIONS: " + alc.getString(device, ALC.EXTENSIONS));
//mo query
buffer.rewind();
alc.getIntegerv(device, ALC.MAJOR_VERSION, 4, Sys.getDirectBufferAddress(buffer));
alc.getIntegerv(device, ALC.MINOR_VERSION, 4, Sys.getDirectBufferAddress(buffer)+4);
/** instance of alc */
private ALC alc;
System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0));
System.out.println("ALC_MINOR_VERSION: " + buffer.get(1));
//no check for ALC_ALL_ATTRIBUTES / ALC_ATTRIBUTES_SIZE since it
//is buggy on win32 - my dev platform
/**
* Creates an instance of ALCTest
*/
public ALCTest() {
super();
alc = al.getALC();
}
//check current context
ALCcontext currentContext = alc.getCurrentContext();
if(context.context != currentContext.context) {
System.out.println("Serious error! - context copy != current context");
System.exit(-1);
}
/**
* Runs the actual test, using supplied arguments
*/
protected void execute(String[] args) {
//error stuff
int lastError = ALC.NO_ERROR;
//check contexts device
ALCdevice currentDevice = alc.getContextsDevice(context);
if(device.device != currentDevice.device) {
System.out.println("Serious error! - device copy != current contexts device");
System.exit(-1);
}
//get an enumerstion value
System.out.println("Value of ALC_MAJOR_VERSION: " + alc.getEnumValue(device, "ALC_MAJOR_VERSION"));
alExit();
}
/**
* main entry point
*
* @param args String array containing arguments
*/
public static void main(String[] args) {
ALCTest alcTest = new ALCTest();
alcTest.execute(args);
}
//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));
System.exit(-1);
}
//query
System.out.println(
"DEFAULT_DEVICE_SPECIFIER: "
+ alc.getString(ALC.DEFAULT_DEVICE_SPECIFIER));
System.out.println(
"DEVICE_SPECIFIER: " + alc.getString(ALC.DEVICE_SPECIFIER));
System.out.println("EXTENSIONS: " + alc.getString(ALC.EXTENSIONS));
//mo query
buffer.rewind();
alc.getIntegerv(
ALC.MAJOR_VERSION,
4,
Sys.getDirectBufferAddress(buffer));
alc.getIntegerv(
ALC.MINOR_VERSION,
4,
Sys.getDirectBufferAddress(buffer) + 4);
System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0));
System.out.println("ALC_MINOR_VERSION: " + buffer.get(1));
//no check for ALC_ALL_ATTRIBUTES / ALC_ATTRIBUTES_SIZE since it
//is buggy on win32 - my dev platform
//get an enumerstion value
System.out.println(
"Value of ALC_MAJOR_VERSION: "
+ alc.getEnumValue("ALC_MAJOR_VERSION"));
alExit();
}
/**
* main entry point
*
* @param args String array containing arguments
*/
public static void main(String[] args) {
ALCTest alcTest = new ALCTest();
alcTest.execute(args);
}
}

View File

@ -33,8 +33,6 @@ package org.lwjgl.test.openal;
import org.lwjgl.openal.AL;
import org.lwjgl.openal.ALC;
import org.lwjgl.openal.ALCcontext;
import org.lwjgl.openal.ALCdevice;
import org.lwjgl.openal.eax.EAX;
import org.lwjgl.openal.eax.EAXBufferProperties;
import org.lwjgl.openal.eax.EAXListenerProperties;
@ -280,8 +278,6 @@ public class ALTest extends BasicTest {
String szFnName;
int ch = -1;
int error;
ALCcontext context;
ALCdevice device;
FloatBuffer listenerPos = createFloatBuffer(3);
listenerPos.put(new float[] {0.0f, 0.0f, 0.0f});
@ -296,17 +292,6 @@ public class ALTest extends BasicTest {
System.out.print("=======================\n\n");
// Initialize Open AL manually
//Open device
device = alc.openDevice(null);
if (device == null) {
System.out.println("Could not create ALC device");
System.exit(-1);
}
//Create context(s)
context = alc.createContext(device, 0);
//Set active context
alc.makeContextCurrent(context);
// Clear Error Code
al.getError();
@ -518,16 +503,16 @@ public class ALTest extends BasicTest {
System.out.print("\nQ to quit\n\n\n");
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
eatInput();
} catch (IOException ioe) {
}
switch (ch) {
case 'A':
case 'a':
fullAutoTests();
break;
case 'B':
case 'b':
semiAutoTests();
break;
case '1':
@ -567,7 +552,7 @@ public class ALTest extends BasicTest {
default:
break;
}
} while (ch != 'Q');
} while (ch != 'q');
}
protected void fullAutoTests() {
@ -963,7 +948,7 @@ public class ALTest extends BasicTest {
while (true) {
ch = CRToContinue();
if ((ch == 'S') || (ch == 's')) {
if (ch == 's') {
return 0;
}
if (ch == 10) {
@ -976,7 +961,7 @@ public class ALTest extends BasicTest {
int current = -1;
try {
//read one, and eat the rest
current = System.in.read();
current = Character.toLowerCase((char) System.in.read());
eatInput();
} catch (Exception e) {
}
@ -1004,11 +989,7 @@ public class ALTest extends BasicTest {
String tempString;
ALCcontext pContext;
ALCdevice pDevice;
pContext = alc.getCurrentContext();
pDevice = alc.getContextsDevice(pContext);
tempString = alc.getString(pDevice, ALC.DEVICE_SPECIFIER);
tempString = alc.getString(ALC.DEVICE_SPECIFIER);
System.out.print("OpenAL Context Device Specifier is '" + tempString + "'\n");
tempString = al.getString(AL.RENDERER);
System.out.print("OpenAL Renderer is '" + tempString + "'\n");
@ -1869,7 +1850,7 @@ public class ALTest extends BasicTest {
do {
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
} catch (IOException ioe) {
}
@ -1895,7 +1876,7 @@ public class ALTest extends BasicTest {
displayALError("alSourceStop source 1 : ", error);
break;
}
} while (ch != 'Q');
} while (ch != 'q');
// Release resources
al.sourceStopv(2, Sys.getDirectBufferAddress(source));
@ -2006,7 +1987,7 @@ public class ALTest extends BasicTest {
System.out.print("\nSource 0 : Not looping Source 1 : Not looping\n");
do {
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
} catch (IOException ioe) {
}
@ -2056,7 +2037,7 @@ public class ALTest extends BasicTest {
al.sourcei(source.get(1), AL.LOOPING, bLooping1);
break;
}
} while (ch != 'Q');
} while (ch != 'q');
System.out.print("\n");
@ -2171,12 +2152,12 @@ public class ALTest extends BasicTest {
System.out.print("Press '8' to remove occlusion from source 0 (DEFERRED)\n");
System.out.print("Press '9' to obstruct source 1 (IMMEDIATE)\n");
System.out.print("Press '0' to remove obstruction from source 1 (IMMEDIATE)\n");
System.out.print("Press 'c' to COMMIT EAX settings\n");
System.out.print("Press 'q' to quit\n\n");
System.out.print("Press 'C' to COMMIT EAX settings\n");
System.out.print("Press 'Q' to quit\n\n");
do {
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
} catch (IOException ioe) {
}
switch (ch) {
@ -2244,7 +2225,7 @@ public class ALTest extends BasicTest {
displayALError("eaxSet EAXBUFFER_OBSTRUCTION : \n", error);
break;
case 'C':
case 'c':
// Commit settings on source 0
eax.eaxSet(EAX.BUFFER_GUID, EAXBufferProperties.COMMITDEFERREDSETTINGS,
source.get(0), 0, 0);
@ -2258,7 +2239,7 @@ public class ALTest extends BasicTest {
displayALError("eaxSet EAXLISTENER_COMMITDEFERREDSETTINGSENVIRONMENT : \n", error);
break;
}
} while (ch != 'Q');
} while (ch != 'q');
// reset EAX level
Room.put(0, -10000);
@ -2363,7 +2344,7 @@ public class ALTest extends BasicTest {
do {
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
} catch (IOException ioe) {
}
switch (ch) {
@ -2423,7 +2404,7 @@ public class ALTest extends BasicTest {
if ((error = al.getError()) != AL.NO_ERROR)
displayALError("alSourceQueueBuffers 1 (buffer 0) : ", error);
break;
case 'A':
case 'a':
// Unqueue first Buffer
al.sourceUnqueueBuffers(source.get(0), 1, Sys.getDirectBufferAddress(buffersremoved));
@ -2446,7 +2427,7 @@ public class ALTest extends BasicTest {
System.out.print("\nRemoved Buffer " + buffersremoved.get(0) + " from queue\n");
}
break;
case 'B':
case 'b':
// Unqueue first 2 Buffers
al.sourceUnqueueBuffers(source.get(0), 2, Sys.getDirectBufferAddress(buffersremoved));
@ -2472,7 +2453,7 @@ public class ALTest extends BasicTest {
System.out.print("\nRemoved Buffers " + buffersremoved.get(0) + " and " + buffersremoved.get(1) + " from queue\n");
}
break;
case 'C':
case 'c':
// Unqueue first 3 Buffers
al.sourceUnqueueBuffers(source.get(0), 3, Sys.getDirectBufferAddress(buffersremoved));
if ((error = al.getError()) != AL.NO_ERROR)
@ -2499,7 +2480,7 @@ public class ALTest extends BasicTest {
buffersremoved.get(2) +" from queue\n");
}
break;
case 'D':
case 'd':
// Unqueue first 4 Buffers
al.sourceUnqueueBuffers(source.get(0), 4, Sys.getDirectBufferAddress(buffersremoved));
@ -2529,7 +2510,7 @@ public class ALTest extends BasicTest {
" from queue\n");
}
break;
case 'E':
case 'e':
// Unqueue first 5 Buffers
al.sourceUnqueueBuffers(source.get(0), 5, Sys.getDirectBufferAddress(buffersremoved));
@ -2560,7 +2541,7 @@ public class ALTest extends BasicTest {
" from queue\n");
}
break;
case 'F':
case 'f':
al.sourcei(source.get(0), AL.BUFFER, 0);
if ((error = al.getError()) != AL.NO_ERROR)
displayALError("alSource AL_BUFFER NULL : ", error);
@ -2593,7 +2574,7 @@ public class ALTest extends BasicTest {
BuffersInQueue.clear();
break;
}
} while (ch != 'Q');
} while (ch != 'q');
// Release resources
al.sourceStop(source.get(0));
@ -2650,7 +2631,7 @@ public class ALTest extends BasicTest {
do {
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
} catch (IOException ioe) {
}
@ -2690,7 +2671,7 @@ public class ALTest extends BasicTest {
displayALError("alSourceStop 0 : ", error);
break;
}
} while (ch != 'Q');
} while (ch != 'q');
// Release resources
al.sourceStopv(1, Sys.getDirectBufferAddress(source));
@ -2751,7 +2732,7 @@ public class ALTest extends BasicTest {
do {
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
} catch (IOException ioe) {
}
@ -2773,7 +2754,7 @@ public class ALTest extends BasicTest {
displayALError("alSourcef source 0 AL PITCH 0.5: ", error);
break;
}
} while (ch != 'Q');
} while (ch != 'q');
// Release resources
al.sourceStopv(1, Sys.getDirectBufferAddress(source));
@ -2824,7 +2805,7 @@ public class ALTest extends BasicTest {
do {
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
} catch (IOException ioe) {
}
@ -2964,7 +2945,7 @@ public class ALTest extends BasicTest {
break;
}
} while (ch != 'Q');
} while (ch != 'q');
// Release resources
al.sourceStop(source.get(0));
@ -3066,7 +3047,7 @@ public class ALTest extends BasicTest {
do {
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
} catch (IOException ioe) {
}
@ -3111,28 +3092,28 @@ public class ALTest extends BasicTest {
if ((error = al.getError()) != AL.NO_ERROR)
displayALError("alSourcef 0 AL_GAIN 0.0 : \n", error);
break;
case 'A':
case 'a':
al.listenerf(AL.GAIN,1.0f);
if ((error = al.getError()) != AL.NO_ERROR)
displayALError("alListenerf AL_GAIN 1.0 : \n", error);
break;
case 'B':
case 'b':
al.listenerf(AL.GAIN,0.5f);
if ((error = al.getError()) != AL.NO_ERROR)
displayALError("alListenerf AL_GAIN 0.5 : \n", error);
break;
case 'C':
case 'c':
al.listenerf(AL.GAIN,0.25f);
if ((error = al.getError()) != AL.NO_ERROR)
displayALError("alListenerf AL_GAIN 0.25 : \n", error);
break;
case 'D':
case 'd':
al.listenerf(AL.GAIN,0.0f);
if ((error = al.getError()) != AL.NO_ERROR)
displayALError("alListenerf AL_GAIN 0.0 : \n", error);
break;
}
} while (ch != 'Q');
} while (ch != 'q');
// Reset & Release resources
al.listenerf(AL.GAIN,1.0f);
@ -3207,7 +3188,7 @@ public class ALTest extends BasicTest {
do {
try {
ch = System.in.read();
ch = Character.toLowerCase((char) System.in.read());
} catch (IOException ioe) {
}
switch (ch) {
@ -3227,7 +3208,7 @@ public class ALTest extends BasicTest {
displayALError("alSourceStopv : ", error);
break;
}
} while (ch != 'Q');
} while (ch != 'q');
// Delete the Sources
al.deleteSources(numSources, Sys.getDirectBufferAddress(Sources));

View File

@ -33,8 +33,6 @@ package org.lwjgl.test.openal;
import org.lwjgl.openal.AL;
import org.lwjgl.openal.ALC;
import org.lwjgl.openal.ALCcontext;
import org.lwjgl.openal.ALCdevice;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@ -53,79 +51,27 @@ public abstract class BasicTest {
/** OpenAL instance */
protected AL al;
/** OpenAL Context instance */
/** OpenALC instance */
protected ALC alc;
/** OpenAL context */
protected ALCcontext context;
/** OpenAL device */
protected ALCdevice device;
/**
* Creates an instance of PlayTest
*/
public BasicTest() {
al = new AL();
al = new AL(null, 44100, 40, false);
try {
al.create();
} catch (Exception e) {
e.printStackTrace();
return;
}
alc = new ALC();
try {
alc.create();
} catch (Exception e) {
e.printStackTrace();
return;
}
}
/**
* Initializes OpenAL
*/
protected void alInitialize() {
//get default device
device = alc.openDevice(null);
if(device == null) {
throw new RuntimeException("Error creating device");
}
//create context (no attributes specified)
context = alc.createContext(device, 0);
if(context == null) {
throw new RuntimeException("Error creating context");
}
//make context current
alc.makeContextCurrent(context);
if(alc.getError(device) != ALC.NO_ERROR) {
throw new RuntimeException("An error occurred while making context current");
}
}
/**
* Shutdowns OpenAL
*/
protected void alExit() {
//Get active context
context = alc.getCurrentContext();
//Get device for active context
device = alc.getContextsDevice(context);
//Disable context
alc.makeContextCurrent(null);
//Release context(s)
alc.destroyContext(context);
//Close device
alc.closeDevice(device);
al.destroy();
}
/**

View File

@ -54,8 +54,6 @@ public class EAXTest extends BasicTest {
* Runs the actual test, using supplied arguments
*/
protected void execute(String[] args) {
alInitialize();
EAX eax = new EAX();
try {
eax.create();

View File

@ -83,10 +83,6 @@ public class MovingSoundTest extends BasicTest {
IntBuffer Env = null;
EAXBufferProperties eaxBufferProp = null;
//initialize AL, using ALC
alInitialize();
//initialize keyboard
try {
Keyboard.create();

View File

@ -35,8 +35,6 @@ import org.lwjgl.Sys;
import org.lwjgl.openal.AL;
import org.lwjgl.openal.ALC;
import org.lwjgl.openal.ALCcontext;
import org.lwjgl.openal.ALCdevice;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@ -59,18 +57,11 @@ public class OpenALCreationTest {
/** OpenAL Context instance */
protected ALC alc;
/** OpenAL context */
protected ALCcontext context;
/** OpenAL device */
protected ALCdevice device;
/**
* Creates an instance of OpenALCreationTest
*/
public OpenALCreationTest() {
al = new AL();
alc = new ALC();
al = new AL(null, 44100, 15, false);
}
public void alInitialize() {
@ -80,51 +71,9 @@ public class OpenALCreationTest {
e.printStackTrace();
return;
}
try {
alc.create();
} catch (Exception e) {
e.printStackTrace();
return;
}
// get default device
device = alc.openDevice(null);
if (device == null) {
throw new RuntimeException("Error creating device");
}
//create context (no attributes specified)
context = alc.createContext(device, 0);
if (context == null) {
throw new RuntimeException("Error creating context");
}
//make context current
alc.makeContextCurrent(context);
if (alc.getError(device) != ALC.NO_ERROR) {
throw new RuntimeException("An error occurred while making context current");
}
}
public void alExit() {
//Get active context
context = alc.getCurrentContext();
//Get device for active context
device = alc.getContextsDevice(context);
//Disable context
alc.makeContextCurrent(null);
//Release context(s)
alc.destroyContext(context);
//Close device
alc.closeDevice(device);
// destroy al/c
alc.destroy();
al.destroy();
}

View File

@ -64,10 +64,7 @@ public class PlayTest extends BasicTest {
}
int lastError;
//initialize AL, using ALC
alInitialize();
//create 1 buffer and 1 source
IntBuffer buffers = createIntBuffer(1);
IntBuffer sources = createIntBuffer(1);

View File

@ -71,9 +71,6 @@ public class PlayTestMemory extends BasicTest {
int lastError;
//initialize AL, using ALC
alInitialize();
//create 1 buffer and 1 source
IntBuffer buffers = createIntBuffer(1);
IntBuffer sources = createIntBuffer(1);

View File

@ -70,9 +70,6 @@ public class SourceLimitTest extends BasicTest {
}
}
//initialize AL
alInitialize();
System.out.print("Creating " + sourcesToCreate + " in one go...");
CreateAllSources();

View File

@ -63,8 +63,6 @@ public class StressTest extends BasicTest {
*/
protected void execute(String[] args) {
alInitialize();
createSources();
createBuffers();
@ -134,7 +132,7 @@ public class StressTest extends BasicTest {
al.sourcei(sources.get(0), AL.BUFFER, buffers.get(0));
al.sourcePlay(sources.get(0));
while (System.currentTimeMillis() - startTime < (60000 * 60)) {
while (System.currentTimeMillis() - startTime < (2000)) {
randomBuffer = getRandomBuffer();
System.out.println("random:" + randomBuffer);
@ -175,6 +173,12 @@ public class StressTest extends BasicTest {
System.out.println("========================");
}
}
//stop all sources
for (int i = 0; i < 4; i++) {
al.sourceStop(sources.get(i));
System.out.println("Stopping source " + (i+1));
}
//test done - ask for user input
try {
@ -188,10 +192,6 @@ public class StressTest extends BasicTest {
} catch (Exception e) {
}
//stop all sources
for (int i = 0; i < 4; i++) {
al.sourceStop(sources.get(i));
}
al.deleteSources(4, Sys.getDirectBufferAddress(sources));
al.deleteBuffers(10, Sys.getDirectBufferAddress(buffers));
}

View File

@ -74,11 +74,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nDestroy (JNIEnv *env, jobject
* C Specification:
* ALubyte * alcGetString(ALCdevice *device, ALenum token);
*/
JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_getString (JNIEnv *env, jobject obj, jobject device, jint token) {
jclass class_device = env->GetObjectClass(device);
jfieldID field_device = env->GetFieldID(class_device, "device", "I");
jint deviceaddress = env->GetIntField(device, field_device);
JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_nGetString (JNIEnv *env, jobject obj, jint deviceaddress, jint token) {
const char* alcString = (const char*) alcGetString((ALCdevice*) deviceaddress, (ALenum) token);
if(alcString == NULL) {
return NULL;
@ -96,11 +92,7 @@ JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_getString (JNIEnv *env, jobj
* C Specification:
* ALvoid alcGetIntegerv(ALCdevice *device, ALenum token, ALsizei size, ALint *dest);
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_getIntegerv (JNIEnv *env, jobject obj, jobject device, jint token, jint size, jint dest) {
jclass device_class = env->GetObjectClass(device);
jfieldID device_field = env->GetFieldID(device_class, "device", "I");
jint deviceaddress = env->GetIntField(device, device_field);
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nGetIntegerv (JNIEnv *env, jobject obj, jint deviceaddress, jint token, jint size, jint dest) {
alcGetIntegerv((ALCdevice*) deviceaddress, (ALenum) token, (ALsizei) size, (ALint*) dest);
CHECK_ALC_ERROR
}
@ -157,11 +149,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_openDevice (JNIEnv *env, job
* C Specification:
* void alcCloseDevice( ALCdevice *dev );
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_closeDevice (JNIEnv *env, jobject obj, jobject device) {
jclass device_class = env->GetObjectClass(device);
jfieldID device_field = env->GetFieldID(device_class, "device", "I");
jint deviceaddress = env->GetIntField(device, device_field);
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_closeDevice (JNIEnv *env, jobject obj, jint deviceaddress) {
alcCloseDevice((ALCdevice*) deviceaddress);
CHECK_ALC_ERROR
}
@ -172,12 +160,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_closeDevice (JNIEnv *env, jobje
* C Specification:
* ALCcontext* alcCreateContext( ALCdevice *dev, ALint* attrlist );
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_createContext (JNIEnv *env, jobject obj, jobject device, jint attrlist) {
/* get device address */
jclass device_class = env->GetObjectClass(device);
jfieldID device_field = env->GetFieldID(device_class, "device", "I");
jint deviceaddress = env->GetIntField(device, device_field);
JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_createContext (JNIEnv *env, jobject obj, jint deviceaddress, jint attrlist) {
ALCcontext* context = alcCreateContext((ALCdevice*) deviceaddress, (ALint*) attrlist);
/* if error - get out */
@ -207,16 +190,10 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_createContext (JNIEnv *env,
* C Specification:
* ALCboolean alcMakeContextCurrent(ALCcontext *context);
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_makeContextCurrent (JNIEnv *env, jobject obj, jobject context) {
if(context == NULL) {
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_makeContextCurrent (JNIEnv *env, jobject obj, jint contextaddress) {
if(contextaddress == NULL) {
return alcMakeContextCurrent(NULL);
}
/* get context address */
jclass context_class = env->GetObjectClass(context);
jfieldID context_field = env->GetFieldID(context_class, "context", "I");
jint contextaddress = env->GetIntField(context, context_field);
return alcMakeContextCurrent((ALCcontext*) contextaddress);
}
@ -226,12 +203,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_makeContextCurrent (JNIEnv
* C Specification:
* void alcProcessContext(ALCcontext *context);
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_processContext (JNIEnv *env, jobject obj, jobject context) {
/* get context address */
jclass context_class = env->GetObjectClass(context);
jfieldID context_field = env->GetFieldID(context_class, "context", "I");
jint contextaddress = env->GetIntField(context, context_field);
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nProcessContext (JNIEnv *env, jobject obj, jint contextaddress) {
alcProcessContext((ALCcontext*) contextaddress);
}
@ -269,12 +241,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getCurrentContext (JNIEnv *e
* C Specification:
* ALCdevice* alcGetContextsDevice(ALCcontext *context);
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getContextsDevice (JNIEnv *env, jobject obj, jobject context) {
/* get context address */
jclass context_class = env->GetObjectClass(context);
jfieldID context_field = env->GetFieldID(context_class, "context", "I");
jint contextaddress = env->GetIntField(context, context_field);
JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getContextsDevice (JNIEnv *env, jobject obj, jint contextaddress) {
ALCdevice* device = alcGetContextsDevice((ALCcontext*) contextaddress);
if(device == NULL) {
@ -302,12 +269,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getContextsDevice (JNIEnv *e
* C Specification:
* void alcSuspendContext(ALCcontext *context);
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_suspendContext (JNIEnv *env, jobject obj, jobject context) {
/* get context address */
jclass context_class = env->GetObjectClass(context);
jfieldID context_field = env->GetFieldID(context_class, "context", "I");
jint contextaddress = env->GetIntField(context, context_field);
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_suspendContext (JNIEnv *env, jobject obj, jint contextaddress) {
alcSuspendContext((ALCcontext*) contextaddress);
}
@ -317,12 +279,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_suspendContext (JNIEnv *env, jo
* C Specification:
* void alcDestroyContext(ALCcontext *context);
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_destroyContext (JNIEnv *env, jobject obj, jobject context) {
/* get context address */
jclass context_class = env->GetObjectClass(context);
jfieldID context_field = env->GetFieldID(context_class, "context", "I");
jint contextaddress = env->GetIntField(context, context_field);
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_destroyContext (JNIEnv *env, jobject obj, jint contextaddress) {
alcDestroyContext((ALCcontext*) contextaddress);
}
@ -332,12 +289,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_destroyContext (JNIEnv *env, jo
* C Specification:
* ALCenum alcGetError(ALCdevice *device);
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getError (JNIEnv *env, jobject obj, jobject device) {
/* get device address */
jclass device_class = env->GetObjectClass(device);
jfieldID device_field = env->GetFieldID(device_class, "device", "I");
jint deviceaddress = env->GetIntField(device, device_field);
JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nGetError (JNIEnv *env, jobject obj, jint deviceaddress) {
jint result = alcGetError((ALCdevice*) deviceaddress);
CHECK_ALC_ERROR
return result;
@ -349,12 +301,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getError (JNIEnv *env, jobject
* C Specification:
* ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName);
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_isExtensionPresent (JNIEnv *env, jobject obj, jobject device, jstring extName) {
/* get device address */
jclass device_class = env->GetObjectClass(device);
jfieldID device_field = env->GetFieldID(device_class, "device", "I");
jint deviceaddress = env->GetIntField(device, device_field);
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_nIsExtensionPresent (JNIEnv *env, jobject obj, jint deviceaddress, jstring extName) {
/* get extension */
ALubyte* functionname = (ALubyte*) (env->GetStringUTFChars(extName, 0));
@ -372,12 +319,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_isExtensionPresent (JNIEnv
* C Specification:
* ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName);
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getEnumValue (JNIEnv *env, jobject obj, jobject device, jstring enumName) {
/* get device address */
jclass device_class = env->GetObjectClass(device);
jfieldID device_field = env->GetFieldID(device_class, "device", "I");
jint deviceaddress = env->GetIntField(device, device_field);
JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nGetEnumValue (JNIEnv *env, jobject obj, jint deviceaddress, jstring enumName) {
/* get extension */
ALubyte* enumerationname = (ALubyte*) (env->GetStringUTFChars(enumName, 0));

View File

@ -1,3 +1,35 @@
/*
* Copyright (c) 2002 Lightweight Java Game Library Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'Lightweight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_openal_ALC */
@ -7,6 +39,45 @@
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: created */
#undef org_lwjgl_openal_ALC_INVALID
#define org_lwjgl_openal_ALC_INVALID -1L
#undef org_lwjgl_openal_ALC_FALSE
#define org_lwjgl_openal_ALC_FALSE 0L
#undef org_lwjgl_openal_ALC_TRUE
#define org_lwjgl_openal_ALC_TRUE 1L
#undef org_lwjgl_openal_ALC_NO_ERROR
#define org_lwjgl_openal_ALC_NO_ERROR 0L
#undef org_lwjgl_openal_ALC_MAJOR_VERSION
#define org_lwjgl_openal_ALC_MAJOR_VERSION 4096L
#undef org_lwjgl_openal_ALC_MINOR_VERSION
#define org_lwjgl_openal_ALC_MINOR_VERSION 4097L
#undef org_lwjgl_openal_ALC_ATTRIBUTES_SIZE
#define org_lwjgl_openal_ALC_ATTRIBUTES_SIZE 4098L
#undef org_lwjgl_openal_ALC_ALL_ATTRIBUTES
#define org_lwjgl_openal_ALC_ALL_ATTRIBUTES 4099L
#undef org_lwjgl_openal_ALC_DEFAULT_DEVICE_SPECIFIER
#define org_lwjgl_openal_ALC_DEFAULT_DEVICE_SPECIFIER 4100L
#undef org_lwjgl_openal_ALC_DEVICE_SPECIFIER
#define org_lwjgl_openal_ALC_DEVICE_SPECIFIER 4101L
#undef org_lwjgl_openal_ALC_EXTENSIONS
#define org_lwjgl_openal_ALC_EXTENSIONS 4102L
#undef org_lwjgl_openal_ALC_FREQUENCY
#define org_lwjgl_openal_ALC_FREQUENCY 4103L
#undef org_lwjgl_openal_ALC_REFRESH
#define org_lwjgl_openal_ALC_REFRESH 4104L
#undef org_lwjgl_openal_ALC_SYNC
#define org_lwjgl_openal_ALC_SYNC 4105L
#undef org_lwjgl_openal_ALC_INVALID_DEVICE
#define org_lwjgl_openal_ALC_INVALID_DEVICE 40961L
#undef org_lwjgl_openal_ALC_INVALID_CONTEXT
#define org_lwjgl_openal_ALC_INVALID_CONTEXT 40962L
#undef org_lwjgl_openal_ALC_INVALID_ENUM
#define org_lwjgl_openal_ALC_INVALID_ENUM 40963L
#undef org_lwjgl_openal_ALC_INVALID_VALUE
#define org_lwjgl_openal_ALC_INVALID_VALUE 40964L
#undef org_lwjgl_openal_ALC_OUT_OF_MEMORY
#define org_lwjgl_openal_ALC_OUT_OF_MEMORY 40965L
/*
* Class: org_lwjgl_openal_ALC
* Method: nCreate
@ -25,19 +96,19 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nDestroy
/*
* Class: org_lwjgl_openal_ALC
* Method: getString
* Signature: (Lorg/lwjgl/openal/ALCdevice;I)Ljava/lang/String;
* Method: nGetString
* Signature: (II)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_getString
(JNIEnv *, jobject, jobject, jint);
JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_nGetString
(JNIEnv *, jobject, jint, jint);
/*
* Class: org_lwjgl_openal_ALC
* Method: getIntegerv
* Signature: (Lorg/lwjgl/openal/ALCdevice;III)V
* Method: nGetIntegerv
* Signature: (IIII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_getIntegerv
(JNIEnv *, jobject, jobject, jint, jint, jint);
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nGetIntegerv
(JNIEnv *, jobject, jint, jint, jint, jint);
/*
* Class: org_lwjgl_openal_ALC
@ -50,34 +121,34 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_openDevice
/*
* Class: org_lwjgl_openal_ALC
* Method: closeDevice
* Signature: (Lorg/lwjgl/openal/ALCdevice;)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_closeDevice
(JNIEnv *, jobject, jobject);
(JNIEnv *, jobject, jint);
/*
* Class: org_lwjgl_openal_ALC
* Method: createContext
* Signature: (Lorg/lwjgl/openal/ALCdevice;I)Lorg/lwjgl/openal/ALCcontext;
* Signature: (II)Lorg/lwjgl/openal/ALCcontext;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_createContext
(JNIEnv *, jobject, jobject, jint);
(JNIEnv *, jobject, jint, jint);
/*
* Class: org_lwjgl_openal_ALC
* Method: makeContextCurrent
* Signature: (Lorg/lwjgl/openal/ALCcontext;)Z
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_makeContextCurrent
(JNIEnv *, jobject, jobject);
(JNIEnv *, jobject, jint);
/*
* Class: org_lwjgl_openal_ALC
* Method: processContext
* Signature: (Lorg/lwjgl/openal/ALCcontext;)V
* Method: nProcessContext
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_processContext
(JNIEnv *, jobject, jobject);
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nProcessContext
(JNIEnv *, jobject, jint);
/*
* Class: org_lwjgl_openal_ALC
@ -90,50 +161,50 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getCurrentContext
/*
* Class: org_lwjgl_openal_ALC
* Method: getContextsDevice
* Signature: (Lorg/lwjgl/openal/ALCcontext;)Lorg/lwjgl/openal/ALCdevice;
* Signature: (I)Lorg/lwjgl/openal/ALCdevice;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getContextsDevice
(JNIEnv *, jobject, jobject);
(JNIEnv *, jobject, jint);
/*
* Class: org_lwjgl_openal_ALC
* Method: suspendContext
* Signature: (Lorg/lwjgl/openal/ALCcontext;)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_suspendContext
(JNIEnv *, jobject, jobject);
(JNIEnv *, jobject, jint);
/*
* Class: org_lwjgl_openal_ALC
* Method: destroyContext
* Signature: (Lorg/lwjgl/openal/ALCcontext;)V
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_destroyContext
(JNIEnv *, jobject, jobject);
(JNIEnv *, jobject, jint);
/*
* Class: org_lwjgl_openal_ALC
* Method: getError
* Signature: (Lorg/lwjgl/openal/ALCdevice;)I
* Method: nGetError
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getError
(JNIEnv *, jobject, jobject);
JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nGetError
(JNIEnv *, jobject, jint);
/*
* Class: org_lwjgl_openal_ALC
* Method: isExtensionPresent
* Signature: (Lorg/lwjgl/openal/ALCdevice;Ljava/lang/String;)Z
* Method: nIsExtensionPresent
* Signature: (ILjava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_isExtensionPresent
(JNIEnv *, jobject, jobject, jstring);
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_nIsExtensionPresent
(JNIEnv *, jobject, jint, jstring);
/*
* Class: org_lwjgl_openal_ALC
* Method: getEnumValue
* Signature: (Lorg/lwjgl/openal/ALCdevice;Ljava/lang/String;)I
* Method: nGetEnumValue
* Signature: (ILjava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getEnumValue
(JNIEnv *, jobject, jobject, jstring);
JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nGetEnumValue
(JNIEnv *, jobject, jint, jstring);
#ifdef __cplusplus
}

View File

@ -1,31 +1,31 @@
/*
* Copyright (c) 2002 Light Weight Java Game Library Project
/*
* Copyright (c) 2002 Lightweight Java Game Library Project
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'Light Weight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* * Neither the name of 'Lightweight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@ -43,7 +43,7 @@ extern "C" {
/*
* Class: org_lwjgl_openal_BaseAL
* Method: nCreate
* Signature: ()Z
* Signature: ([Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_BaseAL_nCreate
(JNIEnv *, jobject, jobjectArray);

View File

@ -1,31 +1,31 @@
/*
* Copyright (c) 2002 Light Weight Java Game Library Project
/*
* Copyright (c) 2002 Lightweight Java Game Library Project
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'Light Weight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* * Neither the name of 'Lightweight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@ -39,6 +39,7 @@
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: created */
/*
* Class: org_lwjgl_openal_CoreAL
* Method: enable