本文整理汇总了Java中org.lwjgl.openal.ALC10.ALC_NO_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java ALC10.ALC_NO_ERROR属性的具体用法?Java ALC10.ALC_NO_ERROR怎么用?Java ALC10.ALC_NO_ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.lwjgl.openal.ALC10
的用法示例。
在下文中一共展示了ALC10.ALC_NO_ERROR属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
/**
* 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();
}
示例2: execute
/**
* Runs the actual test, using supplied arguments
*/
protected void execute(String[] args) {
int lastError = ALC10.ALC_NO_ERROR;
IntBuffer sampleCount = BufferUtils.createIntBuffer(1);
int state = AL10.AL_PLAYING;
int FMT = AL10.AL_FORMAT_MONO16;
int FMTSIZE = 16/8;
int FREQ = 44100;
int TIME = 5;
int SAMPS = (FREQ * TIME);
ByteBuffer buf = BufferUtils.createByteBuffer(SAMPS * FMTSIZE);
// check that capture is available
if(!ALC10.alcIsExtensionPresent(AL.getDevice(), "ALC_EXT_CAPTURE")) {
throw new OpenALException("ALC_EXT_CAPTURE extension not available");
}
// get list of devices
String[] captureDevices = ALC10.alcGetString(null, ALC11.ALC_CAPTURE_DEVICE_SPECIFIER).split("\0");
System.out.println("Available Capture Devices: ");
for(int i=0; i<captureDevices.length; i++) {
System.out.println(i + ": " + captureDevices[i]);
}
String defaultRecorder = ALC10.alcGetString(AL.getDevice(), ALC11.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
System.out.println("Default capture device: " + defaultRecorder);
ALCdevice device = ALC11.alcCaptureOpenDevice(null, FREQ, FMT, SAMPS);
if(device != null) {
// record some sound
// =====================================
System.out.print("Recording using " + ALC10.alcGetString(device, ALC11.ALC_CAPTURE_DEVICE_SPECIFIER) + "...");
ALC11.alcCaptureStart(device);
while (sampleCount.get(0) < SAMPS) {
pause(1000);
ALC10.alcGetInteger(device, ALC11.ALC_CAPTURE_SAMPLES, sampleCount);
}
System.out.println("done");
ALC11.alcCaptureStop(device);
// capure the samples
ALC11.alcCaptureSamples(device, buf, SAMPS);
ALC11.alcCaptureCloseDevice(device);
// -------------------------------------
// play back recording
// ===================
IntBuffer buffers = BufferUtils.createIntBuffer(1);
IntBuffer sources = BufferUtils.createIntBuffer(1);
buffers.position(0).limit(1);
AL10.alGenBuffers(buffers);
sources.position(0).limit(1);
AL10.alGenSources(sources);
System.out.print("Playing...");
AL10.alBufferData(buffers.get(0), FMT, buf, FREQ);
AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0));
AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_FALSE);
AL10.alSourcePlay(sources.get(0));
while (state == AL10.AL_PLAYING)
{
pause(100);
state = AL10.alGetSourcei(sources.get(0), AL10.AL_SOURCE_STATE);
}
System.out.println("done");
AL10.alDeleteSources(sources);
AL10.alDeleteBuffers(buffers);
}
alExit();
}