我已經使用OpenAL爲我的應用程序實現了聲音。看起來它工作正常,直到我關閉應用程序並試圖清理每個聲音相關的對象。基本上我有一個清理方法是這樣的:用aclCloseDevice關閉設備時發生致命錯誤
public void cleanup(){
//looping through sources and deleting them like this:
alSourceStop(id);
alDeleteSources(id);
//ids of sources and buffers are not the same they are in different classes
//looping through buffers and deleting them like this:
alDeleteBuffers(id);
//destroying context
alcDestroyContext(context);
//closing device
alcCloseDevice(device);
}
當我評論alcCloseDevice
了,我得到這樣的消息:
AL lib: (EE) alc_cleanup: 1 device not closed
如果我把它留在原來的位置:
A fatal error has been detected by the Java Runtime Environment ... Failed to write core dump ...
等等
我在Windows 7 64bit操作系統上使用LWJGL 3.1.0以及所有OpenGL和OpenAL相關的st uff由一個線程管理。
我成立這個樣子的:
device = alcOpenDevice((ByteBuffer)null);
ALCCapabilities caps = ALC.createCapabilities(device);
context = alcCreateContext(device, (IntBuffer)null);
alcMakeContextCurrent(context);
AL.createCapabilities(caps);
設備和上下文沒有問題產生。
這樣創建緩衝區:
id = alGenBuffers();
try(STBVorbisInfo info = STBVorbisInfo.malloc()){
ShortBuffer buffer = /*decoding ogg here without problem*/
alBufferData(id, info.channels() == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, buffer, info.sample_rate());
}
還設置了源和聽衆,但我並不認爲會對它產生任何影響,實際上並沒有創造任何源與聽者的錯誤關閉裝置的結果。
您正在使用哪種版本的LWJGL? – Vallentin
你可以添加更多的上下文,比如哪個操作系統?另外你如何設置OpenAL?一切都由同一個線程執行嗎?因爲我無法複製你的問題。 – Vallentin
@Vallentin我編輯了我的問題以提供更多的信息,當我關閉應用程序時,這個錯誤日誌文件也生成了,可惜它沒有告訴我很多,但我可以提供它,如果有幫助的話。 – eldo