Hi,
now I've a problem with this sample:
http://lwjgl.org/wiki/index.php?title=Slick-Util_Library_-_Part_2_-_Loading_Sounds_for_LWJGLIt runs perfectly. But when I stop it, an error occurs. What please is the problem?
Here's the complete output:
Wed Dec 15 21:32:29 CET 2010 INFO:Initialising sounds..
Wed Dec 15 21:32:29 CET 2010 INFO:- Sound works
Wed Dec 15 21:32:29 CET 2010 INFO:- 64 OpenAL source available
Wed Dec 15 21:32:29 CET 2010 INFO:- Sounds source generated
ibxm alpha 45 (c)2006 mumart@gmail.com
Close requested
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x082e8f8c, pid=828, tid=3248
#
# JRE version: 6.0_22-b04
# Java VM: Java HotSpot(TM) Client VM (17.1-b03 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [OpenAL32.dll+0x18f8c]
#
# An error report file with more information is saved as:
# D:\java\eclipse\hs_err_pid828.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
I modified the source to check whether the error really happens at the moment of termination. Here's my actual source:
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.openal.Audio;
import org.newdawn.slick.openal.AudioLoader;
import org.newdawn.slick.openal.SoundStore;
public class SoundExample {
/** The ogg sound effect */
private Audio oggEffect;
/** The wav sound effect */
private Audio wavEffect;
/** The aif source effect */
private Audio aifEffect;
/** The ogg stream thats been loaded */
private Audio oggStream;
/** The mod stream thats been loaded */
private Audio modStream;
/**
* Start the test
*/
public void start() {
initGL(800,600);
init();
while (true) {
update();
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
render();
Display.update();
Display.sync(100);
if (Display.isCloseRequested()) {
System.out.println("Close requested");
Display.destroy();
System.exit(0);
}
}
}
/**
* Initialise the GL display
*
* @param width The width of the display
* @param height The height of the display
*/
private void initGL(int width, int height) {
try {
Display.setDisplayMode(new DisplayMode(width,height));
Display.create();
Display.setVSyncEnabled(true);
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(0);
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,width,height);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, width, height, 0, 1, -1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
/**
* Initialise resources
*/
public void init() {
try {
// you can play oggs by loading the complete thing into
// a sound
oggEffect = AudioLoader.getAudio("OGG", new FileInputStream("testdata/restart.ogg"));
// or setting up a stream to read from. Note that the argument becomes
// a URL here so it can be reopened when the stream is complete. Probably
// should have reset the stream by thats not how the original stuff worked
oggStream = AudioLoader.getStreamingAudio("OGG", new File("testdata/bongos.ogg").toURL());
// can load mods (XM, MOD) using ibxm which is then played through OpenAL. MODs
// are always streamed based on the way IBXM works
modStream = AudioLoader.getStreamingAudio("MOD", new File("testdata/SMB-X.XM").toURL());
// playing as music uses that reserved source to play the sound. The first
// two arguments are pitch and gain, the boolean is whether to loop the content
modStream.playAsMusic(1.0f, 1.0f, true);
// you can play aifs by loading the complete thing into
// a sound
aifEffect = AudioLoader.getAudio("AIF", new FileInputStream("testdata/burp.aif"));
// you can play wavs by loading the complete thing into
// a sound
wavEffect = AudioLoader.getAudio("WAV", new FileInputStream("testdata/cbrown01.wav"));
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Game loop update
*/
public void update() {
while (Keyboard.next()) {
if (Keyboard.getEventKeyState()) {
if (Keyboard.getEventKey() == Keyboard.KEY_Q) {
// play as a one off sound effect
oggEffect.playAsSoundEffect(1.0f, 1.0f, false);
}
if (Keyboard.getEventKey() == Keyboard.KEY_W) {
// replace the music thats curretly playing with
// the ogg
oggStream.playAsMusic(1.0f, 1.0f, true);
}
if (Keyboard.getEventKey() == Keyboard.KEY_E) {
// replace the music thats curretly playing with
// the mod
modStream.playAsMusic(1.0f, 1.0f, true);
}
if (Keyboard.getEventKey() == Keyboard.KEY_R) {
// play as a one off sound effect
aifEffect.playAsSoundEffect(1.0f, 1.0f, false);
}
if (Keyboard.getEventKey() == Keyboard.KEY_T) {
// play as a one off sound effect
wavEffect.playAsSoundEffect(1.0f, 1.0f, false);
}
}
try{
Thread.sleep(100);
}catch(InterruptedException e){
System.out.println("Sleep Interrupted");
}
}
// polling is required to allow streaming to get a chance to
// queue buffers.
SoundStore.get().poll(0);
}
/**
* Game loop render
*/
public void render() {
}
/**
* Main method
*/
public static void main(String[] argv) {
SoundExample soundExample = new SoundExample();
soundExample.start();
}
}
//Edit: Here the complete log:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x082e8f8c, pid=828, tid=3248
#
# JRE version: 6.0_22-b04
# Java VM: Java HotSpot(TM) Client VM (17.1-b03 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [OpenAL32.dll+0x18f8c]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread (0x02afa400): VMThread [stack: 0x02be0000,0x02c30000] [id=3248]
siginfo: ExceptionCode=0xc0000005, reading address 0x083decd0
Registers:
EAX=0x083decd0, EBX=0x7c911000, ECX=0x00000000, EDX=0x00000000
ESP=0x02c2f9b8, EBP=0x00000000, ESI=0x08322a30, EDI=0x00000000
EIP=0x082e8f8c, EFLAGS=0x00010206
Top of Stack: (sp=0x02c2f9b8)
0x02c2f9b8: 08322eb0 08330020 08324640 082dbc26
0x02c2f9c8: 08330020 08330020 08330020 7c9110e0
0x02c2f9d8: 00000000 082dc23e 08324640 00000001
0x02c2f9e8: 785837ee 02c2fa50 00000000 082dc3b2
0x02c2f9f8: 08330020 00000000 082d0000 082dc3d6
0x02c2fa08: 00000000 082dc44b 082e9f4f 082d0000
0x02c2fa18: 00000000 00000001 4fad0cdf 00000000
0x02c2fa28: 02c2fa70 001a37e8 c0000005 00000001
Instructions: (pc=0x082e8f8c)
0x082e8f7c: 00 51 e8 ed e9 ff ff 8b 46 08 89 7e 10 89 7e 0c
0x082e8f8c: 8b 10 83 c4 04 50 8b 42 08 ff d0 8b 46 04 89 7e
Stack: [0x02be0000,0x02c30000], sp=0x02c2f9b8, free space=13e02c2f52ck
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [OpenAL32.dll+0x18f8c]
[error occurred during error reporting (printing native stack), id 0xc0000005]
VM_Operation (0x0090fb20): Exit, mode: safepoint, requested by thread 0x003a6c00
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x02b0cc00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3384, stack(0x02dc0000,0x02e10000)]
0x02b08800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2268, stack(0x02d70000,0x02dc0000)]
0x02b05400 JavaThread "Attach Listener" daemon [_thread_blocked, id=804, stack(0x02d20000,0x02d70000)]
0x02b04000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3296, stack(0x02cd0000,0x02d20000)]
0x02b00400 JavaThread "Finalizer" daemon [_thread_blocked, id=3388, stack(0x02c80000,0x02cd0000)]
0x02afbc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=888, stack(0x02c30000,0x02c80000)]
0x003a6c00 JavaThread "main" [_thread_blocked, id=812, stack(0x008c0000,0x00910000)]
Other Threads:
=>0x02afa400 VMThread [stack: 0x02be0000,0x02c30000] [id=3248]
VM state:at safepoint (shutting down)
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
[0x003a5cc0] Threads_lock - owner thread: 0x02afa400
Heap
def new generation total 4928K, used 4416K [0x22990000, 0x22ee0000, 0x27ee0000)
eden space 4416K, 100% used [0x22990000, 0x22de0000, 0x22de0000)
from space 512K, 0% used [0x22de0000, 0x22de0000, 0x22e60000)
to space 512K, 0% used [0x22e60000, 0x22e60000, 0x22ee0000)
tenured generation total 10944K, used 0K [0x27ee0000, 0x28990000, 0x32990000)
the space 10944K, 0% used [0x27ee0000, 0x27ee0000, 0x27ee0200, 0x28990000)
compacting perm gen total 12288K, used 1412K [0x32990000, 0x33590000, 0x36990000)
the space 12288K, 11% used [0x32990000, 0x32af1198, 0x32af1200, 0x33590000)
ro space 10240K, 51% used [0x36990000, 0x36ebbaf8, 0x36ebbc00, 0x37390000)
rw space 12288K, 54% used [0x37390000, 0x37a276d8, 0x37a27800, 0x37f90000)
Dynamic libraries:
0x00400000 - 0x00424000 C:\Programme\Java\jre6\bin\javaw.exe
0x7c910000 - 0x7c9c9000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c908000 C:\WINDOWS\system32\kernel32.dll
0x77da0000 - 0x77e4a000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e50000 - 0x77ee3000 C:\WINDOWS\system32\RPCRT4.dll
0x77fc0000 - 0x77fd1000 C:\WINDOWS\system32\Secur32.dll
0x7e360000 - 0x7e3f1000 C:\WINDOWS\system32\USER32.dll
0x77ef0000 - 0x77f39000 C:\WINDOWS\system32\GDI32.dll
0x76330000 - 0x7634d000 C:\WINDOWS\system32\IMM32.DLL
0x7c340000 - 0x7c396000 C:\Programme\Java\jre6\bin\msvcr71.dll
0x6d7f0000 - 0x6da97000 C:\Programme\Java\jre6\bin\client\jvm.dll
0x76af0000 - 0x76b1e000 C:\WINDOWS\system32\WINMM.dll
0x6d7a0000 - 0x6d7ac000 C:\Programme\Java\jre6\bin\verify.dll
0x6d320000 - 0x6d33f000 C:\Programme\Java\jre6\bin\java.dll
0x6d280000 - 0x6d288000 C:\Programme\Java\jre6\bin\hpi.dll
0x76bb0000 - 0x76bbb000 C:\WINDOWS\system32\PSAPI.DLL
0x6d7e0000 - 0x6d7ef000 C:\Programme\Java\jre6\bin\zip.dll
0x10000000 - 0x10071000 D:\java\lwjgl\native\windows\lwjgl.dll
0x773a0000 - 0x774a3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\COMCTL32.dll
0x77be0000 - 0x77c38000 C:\WINDOWS\system32\msvcrt.dll
0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll
0x5f0d0000 - 0x5f19c000 C:\WINDOWS\system32\OPENGL32.dll
0x68fc0000 - 0x68fe0000 C:\WINDOWS\system32\GLU32.dll
0x736d0000 - 0x7371b000 C:\WINDOWS\system32\DDRAW.dll
0x73b30000 - 0x73b36000 C:\WINDOWS\system32\DCIMAN32.dll
0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll
0x5b0f0000 - 0x5b128000 C:\WINDOWS\system32\uxtheme.dll
0x75250000 - 0x7527e000 C:\WINDOWS\system32\msctfime.ime
0x774b0000 - 0x775ee000 C:\WINDOWS\system32\ole32.dll
0x69030000 - 0x69ad7000 C:\WINDOWS\system32\atioglxx.dll
0x71a10000 - 0x71a27000 C:\WINDOWS\system32\WS2_32.dll
0x71a00000 - 0x71a08000 C:\WINDOWS\system32\WS2HELP.dll
0x73aa0000 - 0x73ab5000 C:\WINDOWS\system32\mscms.dll
0x72f70000 - 0x72f96000 C:\WINDOWS\system32\WINSPOOL.DRV
0x58d90000 - 0x58dd1000 C:\WINDOWS\system32\icm32.dll
0x082d0000 - 0x0830a000 D:\java\lwjgl\native\windows\OpenAL32.dll
0x78520000 - 0x785c3000 C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375\MSVCR90.dll
0x7e670000 - 0x7ee91000 C:\WINDOWS\system32\SHELL32.dll
0x73e70000 - 0x73ecc000 C:\WINDOWS\system32\dsound.dll
0x72c90000 - 0x72c99000 C:\WINDOWS\system32\wdmaud.drv
0x76bf0000 - 0x76c1e000 C:\WINDOWS\system32\WINTRUST.dll
0x77a50000 - 0x77ae6000 C:\WINDOWS\system32\CRYPT32.dll
0x77af0000 - 0x77b02000 C:\WINDOWS\system32\MSASN1.dll
0x76c50000 - 0x76c78000 C:\WINDOWS\system32\IMAGEHLP.dll
0x72c80000 - 0x72c88000 C:\WINDOWS\system32\msacm32.drv
0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll
0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll
0x73e40000 - 0x73e44000 C:\WINDOWS\system32\KsUser.dll
VM Arguments:
jvm_args: -Djava.library.path=..\lwjgl\native\windows -Dfile.encoding=Cp1252
java_command: SoundExample
Launcher Type: SUN_STANDARD
Environment Variables:
CLASSPATH=.;.;C:\PROGRA~1\JMF21~1.1E\lib\sound.jar;C:\PROGRA~1\JMF21~1.1E\lib\jmf.jar;C:\PROGRA~1\JMF21~1.1E\lib;D:\java\lwjgl\jar\AppleJavaExtensions.jar;D:\java\lwjgl\jar\jinput.jar;D:\java\lwjgl\jar\lwjgl-debug.jar;D:\java\lwjgl\jar\lwjgl.jar;D:\java\lwjgl\jar\lwjgl_test.jar;D:\java\lwjgl\jar\lwjgl_util.jar;D:\java\lwjgl\jar\lwjgl_util_applet.jar;D:\java\lwjgl\jar\lzma.jar;D:\java\lwjgl\slick\lib\jorbis-0.0.15.jar;D:\java\lwjgl\slick\lib\jogg-0.0.7.jar;D:\java\lwjgl\slick\lib\ibxm.jar;
PATH=C:/Programme/Java/jre6/bin/client;C:/Programme/Java/jre6/bin;C:/Programme/Java/jre6/lib/i386;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\ATI Technologies\ATI.ACE\Core-Static;C:\Programme\Java\jdk1.6.0_22\bin
USERNAME=Admin
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 104 Stepping 2, AuthenticAMD
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 3
CPU:total 2 (2 cores per cpu, 1 threads per core) family 15 model 104 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, mmxext, 3dnow, 3dnowext
Memory: 4k page, physical 1964068k(1183636k free), swap 3903180k(3264216k free)
vm_info: Java HotSpot(TM) Client VM (17.1-b03) for windows-x86 JRE (1.6.0_22-b04), built on Sep 15 2010 00:56:36 by "java_re" with MS VC++ 7.1 (VS2003)
time: Wed Dec 15 21:32:35 2010
elapsed time: 6 seconds