updated to ALC10 instead of ALC
This commit is contained in:
parent
9d67fe978c
commit
2481ce4356
|
@ -34,7 +34,8 @@ package org.lwjgl.test.openal;
|
|||
import java.nio.IntBuffer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.openal.ALC;
|
||||
import org.lwjgl.openal.AL;
|
||||
import org.lwjgl.openal.ALC10;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -58,29 +59,29 @@ public class ALCTest extends BasicTest {
|
|||
*/
|
||||
protected void execute(String[] args) {
|
||||
//error stuff
|
||||
int lastError = ALC.ALC_NO_ERROR;
|
||||
int lastError = ALC10.ALC_NO_ERROR;
|
||||
|
||||
//create attribute list for context creation
|
||||
IntBuffer buffer = BufferUtils.createIntBuffer(7);
|
||||
|
||||
if ((lastError = ALC.alcGetError()) != ALC.ALC_NO_ERROR) {
|
||||
System.out.println("ALC Error: " + ALC.alcGetString(lastError));
|
||||
if ((lastError = ALC10.alcGetError(AL.getDevice())) != ALC10.ALC_NO_ERROR) {
|
||||
System.out.println("ALC Error: " + ALC10.alcGetString(AL.getDevice(), lastError));
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
//query
|
||||
System.out.println(
|
||||
"DEFAULT_DEVICE_SPECIFIER: "
|
||||
+ ALC.alcGetString(ALC.ALC_DEFAULT_DEVICE_SPECIFIER));
|
||||
+ ALC10.alcGetString(AL.getDevice(), ALC10.ALC_DEFAULT_DEVICE_SPECIFIER));
|
||||
System.out.println(
|
||||
"DEVICE_SPECIFIER: " + ALC.alcGetString(ALC.ALC_DEVICE_SPECIFIER));
|
||||
System.out.println("EXTENSIONS: " + ALC.alcGetString(ALC.ALC_EXTENSIONS));
|
||||
"DEVICE_SPECIFIER: " + ALC10.alcGetString(AL.getDevice(), ALC10.ALC_DEVICE_SPECIFIER));
|
||||
System.out.println("EXTENSIONS: " + ALC10.alcGetString(AL.getDevice(), ALC10.ALC_EXTENSIONS));
|
||||
|
||||
//mo query
|
||||
buffer.rewind();
|
||||
buffer.position(0);
|
||||
ALC.alcGetInteger(ALC.ALC_MAJOR_VERSION, buffer);
|
||||
ALC.alcGetInteger(ALC.ALC_MINOR_VERSION, (IntBuffer) buffer.position(1));
|
||||
ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MAJOR_VERSION, buffer);
|
||||
ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, (IntBuffer) buffer.position(1));
|
||||
|
||||
System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0));
|
||||
System.out.println("ALC_MINOR_VERSION: " + buffer.get(1));
|
||||
|
@ -91,7 +92,7 @@ public class ALCTest extends BasicTest {
|
|||
//get an enumerstion value
|
||||
System.out.println(
|
||||
"Value of ALC_MAJOR_VERSION: "
|
||||
+ ALC.alcGetEnumValue("ALC_MAJOR_VERSION"));
|
||||
+ ALC10.alcGetEnumValue(AL.getDevice(), "ALC_MAJOR_VERSION"));
|
||||
|
||||
alExit();
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import java.nio.FloatBuffer;
|
|||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.openal.AL;
|
||||
import org.lwjgl.openal.AL10;
|
||||
import org.lwjgl.openal.ALC10;
|
||||
import org.lwjgl.opengl.DisplayMode;
|
||||
|
||||
/**
|
||||
|
@ -53,22 +54,20 @@ public abstract class BasicTest {
|
|||
*/
|
||||
public BasicTest() {
|
||||
try {
|
||||
String[] imps = AL.getImplementations();
|
||||
if(imps.length > 0) {
|
||||
System.out.println("Available devices: ");
|
||||
for(int i=0; i<imps.length; i++) {
|
||||
System.out.println(" " + i + ": " + imps[i]);
|
||||
}
|
||||
}
|
||||
AL.create();
|
||||
|
||||
System.out.println("Default device: " + ALC10.alcGetString(null, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER));
|
||||
|
||||
if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATION_EXT")) {
|
||||
String[] devices = ALC10.alcGetString(null, ALC10.ALC_DEVICE_SPECIFIER).split("\0");
|
||||
System.out.println("Available devices: ");
|
||||
for(int i=0; i<devices.length; i++) {
|
||||
System.out.println(i +": " + devices[i]);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Unable to query available devices: " + e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
AL.create();
|
||||
} catch (Exception e) {
|
||||
System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e);
|
||||
return;
|
||||
System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue