Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test
In directory usw-pr-cvs1:/tmp/cvs-serv31220/org/lwjgl/openal/test
Modified Files:
ALCTest.java
Log Message:
add: last test added. ALCTest complete sans some stuff that doesn't work on win32 - awaiting fix from OpenAL people
Index: ALCTest.java
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALCTest.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALCTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ALCTest.java 27 Aug 2002 17:49:53 -0000 1.1
+++ ALCTest.java 27 Aug 2002 23:21:03 -0000 1.2
@@ -35,8 +35,10 @@
import org.lwjgl.openal.ALC;
import org.lwjgl.openal.ALCcontext;
import org.lwjgl.openal.ALCdevice;
+import org.lwjgl.Sys;
import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
/**
* $Id$
*
@@ -69,17 +71,18 @@
}
//create attribute list for context creation
- ByteBuffer buffer = ByteBuffer.allocate(28);
+ ByteBuffer buffer = ByteBuffer.allocateDirect(28);
+ buffer.order(ByteOrder.nativeOrder());
buffer.putInt(ALC.FREQUENCY);
buffer.putInt(44100);
- buffer.putInt(ALC.SYNC);
- buffer.putInt(ALC.FALSE);
buffer.putInt(ALC.REFRESH);
buffer.putInt(15);
+ buffer.putInt(ALC.SYNC);
+ buffer.putInt(ALC.FALSE);
buffer.putInt(0); //terminating int
- //create a context
- context = alc.createContext(device, org.lwjgl.Sys.getDirectBufferAddress(buffer));
+ //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);
@@ -94,31 +97,27 @@
alc.makeContextCurrent(context);
//process
- //NOTE - weird bug exposed!
- //calling alcProcessContext on a non suspended context hangs
- //this is a OpenAL specific bug - not our code
- //alc.processContext(context);
+ alc.processContext(context);
//suspend
alc.suspendContext(context);
- //process again
- alc.processContext(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 - hmmmmm don't get alcGetIntegerv
- /*buffer.rewind();
- alc.getIntegerv(device, ALC.MAJOR_VERSION, 32, org.lwjgl.Sys.getDirectBufferAddress(buffer));
+ //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);
+
System.out.println("ALC_MAJOR_VERSION: " + buffer.getInt());
-
- alc.getIntegerv(device, ALC.MINOR_VERSION, 4, org.lwjgl.Sys.getDirectBufferAddress(buffer));
System.out.println("ALC_MINOR_VERSION: " + buffer.getInt());
- */
+ //no check for ALC_ALL_ATTRIBUTES / ALC_ATTRIBUTES_SIZE since it
+ //is buggy on win32 - my dev platform
+
//check current context
ALCcontext currentContext = alc.getCurrentContext();
if(context.context != currentContext.context) {
@@ -131,7 +130,10 @@
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"));
//close context again
alc.destroyContext(context);
|