LWJGL and org.lwjgl.test.openal.wavedata

Ok, forgive the newbie here. I’ve about given up trying to use the regular java sound api, and so am now trying OpenAL in lwjgl. I was going through lesson3, trying to figure out to use multiple sounds in a game, when I ran into a problem:

The example for lesson3 uses the import org.lwjgl.test.openal.wavedata. Unfortunately, this doesn’t seem to exist as Eclipse is giving me a no go. Has something changed? Or am I just doing something seriously wrong?

And I have gone into the project properties and added the lwjgl.jar into the libraries (as per the lwjgl documentation) and the appropriate arguments into the run parameters. Did I miss something?

You need to add lwjgl_test.jar too. WaveData is located in there

Yep, that fixed the problem… once thing though - does that mean I have to load the lwjgl_test.jar just to play any sounds in my games?

Also, now that it’s working, I still can’t run the lesson3 demo. It gives the following:

java.io.IOException: Stream closed
at java.io.BufferedInputStream.getInIfOpen(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.DataInputStream.readInt(Unknown Source)
at com.sun.media.sound.WaveFileReader.getFMT(Unknown Source)
at com.sun.media.sound.WaveFileReader.getAudioInputStream(Unknown Source)
at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
at org.lwjgl.test.openal.WaveData.create(Unknown Source)
at lesson3.Lesson3.loadALData(Lesson3.java:90)
at lesson3.Lesson3.execute(Lesson3.java:184)
at lesson3.Lesson3.main(Lesson3.java:220)
Exception in thread “main” java.lang.NullPointerException
at lesson3.Lesson3.loadALData(Lesson3.java:91)
at lesson3.Lesson3.execute(Lesson3.java:184)
at lesson3.Lesson3.main(Lesson3.java:220)

I’m guessing it can’t find the wav files, but I’ve tried everything. I even did:

String battle = getClass().getResource("Battle.wav").getPath();
System.out.println(battle);
WaveData waveFile = WaveData.create(battle);
AL10.alBufferData(buffer.get(BATTLE), waveFile.format, waveFile.data, waveFile.samplerate);
waveFile.dispose();

To make sure I had the right path. Any ideas?

I got it!! I actually got it!! I got sound to work via OpenAL!!! I even wrote it into a resusable object!!! Wow! I actually got it!!

Sorry, this is exciting for those of us who still make regular break-throughs.

The problem from up above is that I’m using Eclipse, and had accidentally created my sound folder under the package rather than the project.

;D ;D ;D ;D ;D ;D ;D ;D ;D