本文整理汇总了Java中org.lwjgl.openal.ALC.destroy方法的典型用法代码示例。如果您正苦于以下问题:Java ALC.destroy方法的具体用法?Java ALC.destroy怎么用?Java ALC.destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.openal.ALC
的用法示例。
在下文中一共展示了ALC.destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: destroy
import org.lwjgl.openal.ALC; //导入方法依赖的package包/类
public static void destroy()
{
for (int i = 0; i < audioPlayers.size(); i++)
{
audioPlayers.get(i).destroy();
}
audioPlayers.clear();
alcCloseDevice(device);
alcDestroyContext(context);
ALC.destroy();
}
示例2: run
import org.lwjgl.openal.ALC; //导入方法依赖的package包/类
public static void run() {
glEnable(GL_BLEND);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClearColor(0.0f, 0.98f, 0.60f, 0.0f);
// int vertexShader = Resources.getShader("res/shaders/shadow_vertex_shader.glsl", GL_VERTEX_SHADER);
// int fragmentShader = Resources.getShader("res/shaders/shadow_fragment_shader.glsl", GL_FRAGMENT_SHADER);
// int program = glCreateProgram();
// glAttachShader(program, vertexShader);
// glAttachShader(program, fragmentShader);
// glLinkProgram(program);
// glValidateProgram(program);
// int status = glGetProgrami(program, GL_LINK_STATUS);
// System.out.println(status == GL_TRUE);
// glUseProgram(program);
float lastUpdateTime = (float)glfwGetTime();
while(glfwWindowShouldClose(window) == GL_FALSE) {
tick((float)glfwGetTime() - lastUpdateTime);
draw();
lastUpdateTime = (float)glfwGetTime();
}
glDisable(GL_LINE_SMOOTH);
glDisable(GL_POLYGON_SMOOTH);
glDisable(GL_BLEND);
glfwDestroyWindow(window);
glfwTerminate();
context.destroy();
ALC.destroy();
}
示例3: main
import org.lwjgl.openal.ALC; //导入方法依赖的package包/类
public static void main(String[] args) {
System.setProperty("org.lwjgl.librarypath", new File("natives/windows").getAbsolutePath());
String deviceName = ALC10.alcGetString(0, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER);
long device = ALC10.alcOpenDevice(deviceName);
long context = ALC10.alcCreateContext(device, new int[] {0});
ALC10.alcMakeContextCurrent(context);
ALCCapabilities alcCaps = ALC.createCapabilities(device);
ALCapabilities alCaps = AL.createCapabilities(alcCaps);
if (alCaps.OpenAL10) {
String file = "C:\\Users\\Isaac\\Desktop\\workspace\\assets\\audio\\gunshot2.ogg";
MemoryStack.stackPush();
IntBuffer channelsBuf = MemoryStack.stackMallocInt(1);
MemoryStack.stackPush();
IntBuffer sampleRateBuf = MemoryStack.stackMallocInt(1);
ShortBuffer audioBuffer = STBVorbis.stb_vorbis_decode_filename(file, channelsBuf, sampleRateBuf);
int channels = channelsBuf.get();
int sampleRate = sampleRateBuf.get();
MemoryStack.stackPop();
MemoryStack.stackPop();
int format = -1;
if (channels == 1) {
format = AL10.AL_FORMAT_MONO16;
} else if (channels == 2) {
format = AL10.AL_FORMAT_STEREO16;
}
int buffer = AL10.alGenBuffers();
AL10.alBufferData(buffer, format, audioBuffer, sampleRate);
Stdlib.free(audioBuffer);
int[] sources = new int[4];
AL10.alGenSources(sources);
for (int source : sources) {
AL10.alSourcei(source, AL10.AL_BUFFER, buffer);
AL10.alSourcei(source, AL10.AL_LOOPING, AL10.AL_TRUE);
}
float length = (float) (AL10.alGetBufferi(buffer, AL10.AL_SIZE) / 2 / channels) / sampleRate;
try {
AL10.alSourcePlay(sources[0]);
Thread.sleep((long) (length * 250));
AL10.alSourcePlay(sources[1]);
Thread.sleep((long) (length * 250));
AL10.alSourcePlay(sources[2]);
Thread.sleep((long) (length * 250));
AL10.alSourcePlay(sources[3]);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {}
new Scanner(System.in).nextLine();
AL10.alSourceStopv(sources);
AL10.alDeleteSources(sources);
AL10.alDeleteBuffers(buffer);
}
ALC10.alcDestroyContext(context);
ALC10.alcCloseDevice(device);
ALC.destroy();
}