本文整理汇总了Java中org.lwjgl.openal.ALC10类的典型用法代码示例。如果您正苦于以下问题:Java ALC10类的具体用法?Java ALC10怎么用?Java ALC10使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ALC10类属于org.lwjgl.openal包,在下文中一共展示了ALC10类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
private void initialize(){
device = alcOpenDevice((ByteBuffer)null);
if(device == 0L){
Application.error("Unable to open default audio device");
return;
}
ALCCapabilities deviceCaps = ALC.createCapabilities(device);
if(!deviceCaps.OpenALC10){
Application.error("OpenALC10 Unsupported");
return;
}
context = alcCreateContext(device, (IntBuffer)null);
if(context == 0L){
Application.error("Unable to create ALC Context");
return;
}
ALC10.alcMakeContextCurrent(context);
AL.createCapabilities(deviceCaps);
}
示例2: BasicTest
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
/**
* Creates an instance of PlayTest
*/
protected BasicTest() {
try {
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 create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e);
return;
}
}
示例3: SoundPlayer
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
public SoundPlayer() {
this.device = ALC10.alcOpenDevice((ByteBuffer) null);
if (this.device == 0) {
throw new IllegalStateException("Failed to open the default device.");
}
this.context = ALC10.alcCreateContext(this.device, (IntBuffer) null);
if (this.context == 0) {
throw new IllegalStateException("no context?");
}
ALC10.alcMakeContextCurrent(this.context);
ALCCapabilities deviceCaps = ALC.createCapabilities(this.device);
AL.createCapabilities(deviceCaps);
String deviceSpecifier = ALC10.alcGetString(this.device, ALC10.ALC_DEVICE_SPECIFIER);
System.err.println("Using device " + deviceSpecifier);
System.out.println("ALC_FREQUENCY: " + alcGetInteger(this.device, ALC_FREQUENCY) + "Hz");
System.out.println("ALC_REFRESH: " + alcGetInteger(this.device, ALC_REFRESH) + "Hz");
System.out.println("ALC_SYNC: " + (alcGetInteger(this.device, ALC_SYNC) == ALC_TRUE));
System.out.println("ALC_MONO_SOURCES: " + alcGetInteger(this.device, ALC_MONO_SOURCES));
System.out.println("ALC_STEREO_SOURCES: " + alcGetInteger(this.device, ALC_STEREO_SOURCES));
}
示例4: execute
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
/**
* Runs the actual test, using supplied arguments
*/
protected void execute(String[] args) {
//error stuff
int lastError = ALC10.ALC_NO_ERROR;
//create attribute list for context creation
IntBuffer buffer = BufferUtils.createIntBuffer(7);
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: "
+ ALC10.alcGetString(AL.getDevice(), ALC10.ALC_DEFAULT_DEVICE_SPECIFIER));
System.out.println(
"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);
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));
//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: "
+ ALC10.alcGetEnumValue(AL.getDevice(), "ALC_MAJOR_VERSION"));
alExit();
}
示例5: printALCInfo
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
private void printALCInfo() {
IntBuffer version = BufferUtils.createIntBuffer(2);
ALCdevice device;
if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATION_EXT")) {
if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATE_ALL_EXT")) {
printDevices(ALC11.ALC_ALL_DEVICES_SPECIFIER, "playback");
} else {
printDevices(ALC10.ALC_DEVICE_SPECIFIER, "playback");
}
printDevices(ALC11.ALC_CAPTURE_DEVICE_SPECIFIER, "capture");
} else {
System.out.println("No device enumeration available");
}
device = ALC10.alcGetContextsDevice(ALC10.alcGetCurrentContext());
checkForErrors();
System.out.println("Default playback device: " + ALC10.alcGetString(device, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER));
System.out.println("Default capture device: " + ALC10.alcGetString(device, ALC11.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER));
ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MAJOR_VERSION, version);
ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, (IntBuffer) version.position(1));
checkForErrors();
System.out.println("ALC version: " + version.get(0) + "." + version.get(1));
System.out.println("ALC extensions:");
String[] extensions = ALC10.alcGetString(device, ALC10.ALC_EXTENSIONS).split(" ");
for ( String extension : extensions ) {
if ( extension.trim().length() == 0 ) {
continue;
}
System.out.println(" " + extension);
}
checkForErrors();
}
示例6: printDevices
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
private void printDevices(int which, String kind) {
String[] devices = ALC10.alcGetString(null, which).split("\0");
checkForErrors();
System.out.println("Available " + kind + " devices: ");
for ( String device : devices ) {
System.out.println(" " + device);
}
}
示例7: setupEfx
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
/**
* Loads OpenAL and makes sure ALC_EXT_EFX is supported.
*/
private static void setupEfx() throws Exception {
// Load and create OpenAL
if (!AL.isCreated()) {
AL.create();
}
// Query for Effect Extension
if (!ALC10.alcIsExtensionPresent(AL.getDevice(), EFX10.ALC_EXT_EFX_NAME)) {
throw new Exception("No ALC_EXT_EFX supported by driver.");
}
System.out.println("ALC_EXT_EFX found.");
}
示例8: initAudioEngine
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
public static void initAudioEngine(){
device = ALC10.alcOpenDevice((ByteBuffer) null);
if (device == NULL)
throw new IllegalStateException("Failed to open default audio device");
deviceCaps = ALC.createCapabilities(device);
if (!deviceCaps.OpenALC10)
throw new IllegalStateException("Device is not OpenALC10 capable.");
System.out.println("OpenALC10: " + deviceCaps.OpenALC10);
System.out.println("OpenALC11: " + deviceCaps.OpenALC11);
System.out.println("caps.ALC_EXT_EFX = " + deviceCaps.ALC_EXT_EFX);
if (deviceCaps.OpenALC11){
List<String> devices = ALUtil.getStringList(NULL, ALC_ALL_DEVICES_SPECIFIER);
if (devices == null)
System.err.println("Whoops, something went wrong with the audio device."); //more specific error
else {
for (int i = 0; i < devices.size(); i++)
System.out.println(i + ": " + devices.get(i));
}
}
String defaultDeviceSpecifier = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
if (defaultDeviceSpecifier == null)
System.err.println("Whoops, something went wrong with the audio device."); //more specific error
System.out.println("Default audio device: " + defaultDeviceSpecifier);
context = alcCreateContext(device, (IntBuffer) null);
alcMakeContextCurrent(context);
AL.createCapabilities(deviceCaps);
System.out.println("ALC_FREQUENCY: " + alcGetInteger(device, ALC_FREQUENCY) + "Hz");
System.out.println("ALC_REFRESH: " + alcGetInteger(device, ALC_REFRESH) + "Hz");
System.out.println("ALC_SYNC: " + (alcGetInteger(device, ALC_SYNC) == ALC_TRUE));
System.out.println("ALC_MONO_SOURCES: " + alcGetInteger(device, ALC_MONO_SOURCES));
System.out.println("ALC_STEREO_SOURCES: " + alcGetInteger(device, ALC_STEREO_SOURCES));
}
示例9: create
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
public static ALContext create() {
ALContext context = new ALContext();
// AL.createCapabilities(context._device.getID());
context._device = ALH.alhGetDefaultDevice();
if (context._device == null) {
return (null);
}
context._id = ALC10.alcCreateContext(context._device.getID(), (IntBuffer) null);
context._listener = new ALListener();
context._capac = ALC.createCapabilities(context._device.getID());
return (context);
}
示例10: onDestroy
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
@Override
public void onDestroy() {
if (ALC10.alcCloseDevice(this._id)) {
Logger.get().log(Level.FINE, "Device closed properly: " + this._id);
} else {
Logger.get().log(Level.ERROR, "Failed to close device: " + this._id);
}
}
示例11: alhGetDefaultDevice
import org.lwjgl.openal.ALC10; //导入依赖的package包/类
/** get the device with this specifier */
public static ALDevice alhGetDefaultDevice() {
try {
ALDevice device = new ALDevice(ALC10.alcOpenDevice((ByteBuffer) null));
_objects.add(device);
return (device);
} catch (Exception e) {
Logger.get().log(Logger.Level.ERROR, e.getLocalizedMessage());
return (null);
}
}