Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [SOLVED] OpenAL sound problems. (Also using Slick Util and LWJGL)  (Read 25760 times)
0 Members and 1 Guest are viewing this topic.
Offline EmanP

Junior Member


Projects: 2
Exp: 3 years


Satisfaction never guaranteed.


« Posted 2013-07-28 22:29:21 »

I have looked up a thousand and one different different ways to reproduce sound in LWJGL. None of them seem to work. It almost seems futile. All of them seemed to give errors, and those which didn't, threw a NullPointerException to my WAV sound.

I have decided to stick with this tutorial by the Ninja Cave - http://www.lwjgl.org/wiki/index.php?title=Slick-Util_Library_-_Part_2_-_Loading_Sounds_for_LWJGL

Issue is, I've tried it on my game, and it seemed to fail. So, I copied the entire tutorial on a seperate class, changed the sound names to fit with the sound I had (I only used the WAV format and omitted the rest), and ran the program.

It game me this message:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
Mon Jul 29 01:31:50 EEST 2013 INFO:Initialising sounds..
Mon Jul 29 01:31:50 EEST 2013 INFO:- Sound works
Mon Jul 29 01:31:50 EEST 2013 INFO:- 64 OpenAL source available
Mon Jul 29 01:31:50 EEST 2013 INFO:- Sounds source generated
java.lang.NoSuchMethodError: org.lwjgl.LWJGLUtil.log(Ljava/lang/String;)V
   at org.newdawn.slick.openal.WaveData.create(WaveData.java:126)
   at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:713)
   at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:683)
   at org.newdawn.slick.openal.AudioLoader.getAudio(AudioLoader.java:54)
   at spacegameII.SpaceGameII.main(SpaceGameII.java:83)


Any help would be greatly appreciated.

Signed- EmanP
Offline philfrei
« Reply #1 - Posted 2013-07-28 23:19:19 »

I'm just pegging a position so as to get updates. I am in the process of converting my game to libgdx and this will include my sound library, so I am very curious what the issues turn out to be. It will probably be a week or so before I know if my sounds work in the context of libgdx.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline davedes
« Reply #2 - Posted 2013-07-29 01:16:28 »

Looks like a simple JAR mismatch; SlickUtil is expecting an older version of LWJGL.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline EmanP

Junior Member


Projects: 2
Exp: 3 years


Satisfaction never guaranteed.


« Reply #3 - Posted 2013-08-15 00:18:58 »

I would've liked to reply sooner, but I wasn't notified about this page, how are the .jars mismatched if they came from the exact same zip file? I've also tried overwriting the lwjgl .jars too, along with their natives(with versions 2.90, 2.85, and 2.81), and they don't seem to work..

Signed- EmanP
Offline philfrei
« Reply #4 - Posted 2013-08-15 00:40:28 »

Quick check: are you using Eclipse? Have you linked the libraries? I am putting the needed jars in "Referenced Libraries", as part of the build path. (I ask because the error message says there is trouble locating the needed classes.)

I am going to try the tutorial you linked now. I just ran the "LWJGL Basics" for the first time earlier this week--haven't tried the "Slick" tutorials yet.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline philfrei
« Reply #5 - Posted 2013-08-15 01:28:57 »

OK, I got the tutorial to work. It is playing something...gack! I'm not sure each sound is exactly as it should be. There is no visual interface to speak of, just a blank screen. Ah-hah! You are supposed to play QWERT keys to get the various sounds. Yep. They all work.  Shocked

Steps I took (there is probably a simpler way):

1) Download the complete Slick.zip. From within (slick/testdata/...) I copied the audio data files listed in the SoundExample program into a folder in the Eclipse project which I also named "testdata".

I had set up my project with a package named "lwjglTutorials" and put the tutorial class source file there. Setting the required testdata folder at src/lwgjlTutorials/testdata did NOT work. However, the program was able to find the resources when I changed the location to "src/testdata". (Have to look at the API for ResourceLoader() to find out exactly what is expected here.)

2) I linked as an "external jar" the following jars, all which can be found in either the Slick/lib or slick-util/lib folder:
  jogg-0.0.7.jar
  jorbis-0.0.15.jar
  ibxm.jar

Earlier I had linked lwjgl.jar and slick-util.jar.

That's a lot to do--perhaps there was a simpler way to set this up without requiring all the additional steps.

Hope that gets you rolling. If not, I'm happy to try and help further.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline EmanP

Junior Member


Projects: 2
Exp: 3 years


Satisfaction never guaranteed.


« Reply #6 - Posted 2013-08-15 11:26:56 »

I am using Eclipse, I made SURE to add them to the referenced libraries, otherwise the rest of my game wouldn't work, and I even went as far as adding a few of the slick util libraries as well. Sound did not work.

I was using a wav file, and each time it would say:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
Thu Aug 15 14:25:32 EEST 2013 INFO:Use Java PNG Loader = true
Thu Aug 15 14:25:32 EEST 2013 INFO:Initialising sounds..
Thu Aug 15 14:25:32 EEST 2013 INFO:- Sound works
Thu Aug 15 14:25:32 EEST 2013 INFO:- 64 OpenAL source available
Thu Aug 15 14:25:32 EEST 2013 INFO:- Sounds source generated
javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input stream
Thu Aug 15 14:25:32 EEST 2013 ERROR:null
java.lang.NullPointerException
   at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:715)
   at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:683)
   at org.newdawn.slick.openal.AudioLoader.getAudio(AudioLoader.java:54)
   at spacegameII.SpaceGameII.playSound(SpaceGameII.java:127)
   at spacegameII.SpaceGameII.main(SpaceGameII.java:103)
   at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
   at org.newdawn.slick.openal.WaveData.create(WaveData.java:123)
   at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:713)
   at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:683)
   at org.newdawn.slick.openal.AudioLoader.getAudio(AudioLoader.java:54)
   at spacegameII.SpaceGameII.playSound(SpaceGameII.java:127)
   at spacegameII.SpaceGameII.main(SpaceGameII.java:103)
java.io.IOException: Failed to load: java.io.BufferedInputStream@13dd7d1
   at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:721)
   at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:683)
   at org.newdawn.slick.openal.AudioLoader.getAudio(AudioLoader.java:54)
   at spacegameII.SpaceGameII.playSound(SpaceGameII.java:127)
   at spacegameII.SpaceGameII.main(SpaceGameII.java:103)
Caused by: java.lang.NullPointerException
   at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:715)
   ... 4 more


But then I saw a .wav file inside the slick.zip (not slick-util.zip), and tried it out, and it did in fact work. It turns out my .wav files were transferred from MP3 files before. So that likely messed up the bytecode. Thank you very much for solving my issue.

Signed- EmanP
Offline philfrei
« Reply #7 - Posted 2013-08-15 11:46:31 »

Glad to hear you got it to work!

One other thought (maybe you already know this):

Check if the .wav that didn't play is 16-bit, 24-bit or 32-bit encoding. Java will usually balk unless the wav file is 16-bit. Converting from one to another can be done with Audacity (free DAW).


"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline EmanP

Junior Member


Projects: 2
Exp: 3 years


Satisfaction never guaranteed.


« Reply #8 - Posted 2013-08-15 11:51:26 »

I'll take that in note when I make my own sounds for my game Cheesy

Signed- EmanP
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (12 views)
2014-08-28 18:26:30

CopyableCougar4 (24 views)
2014-08-22 19:31:30

atombrot (37 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (29 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (28 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!