Problems with Sound

Started by Manja, March 09, 2005, 15:00:40

Previous topic - Next topic

Manja

hi everyone. i've got a question about the sound features of OpenAL. i'm trying to use it to incorporate it into a game that i'm making. but when i try it out, i get these errors. now i looked at some example code and i'm doing everything that i'm supposed to, but when i call the WaveData.create() function, it returns a null. even though i've specified the path of the file that i wanna play.

are there any know issues with this thing or am i forgetting to do something? anyway, this is the error i get.


java.io.IOException: Stream closed
   at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:134)
   at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
   at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
   at java.io.DataInputStream.readInt(DataInputStream.java:353)
   at com.sun.media.sound.WaveFileReader.getFMT(WaveFileReader.java:244)
   at com.sun.media.sound.WaveFileReader.getAudioInputStream(WaveFileReader.java:160)
   at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1094)
   at org.lwjgl.test.openal.WaveData.create(WaveData.java:93)
   at SoundManager.addSound(SoundManager.java:160)
   at frmMain.<init>(frmMain.java:34)
   at frmMain$2.run(frmMain.java:77)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

i'm totally stuck on this so any help would be appreciated.

Matzon

is the file actually there? - is it a wave pcm file ?

curtis

I'm having the same trouble, the file is exactly where specified, works fine on my computer in college, works fine on 2 of my friends' computers but doesn't work on my home pc. You wouldn't happen to have a sound blaster live 5.1 would you?

princec

That error is a straightforward case of "File Not Found" obscured by the famously crap "java.io.IOException: Stream closed" exception.

Cas :)

Matzon

nope - I am on some integrated ac 97 thingy
anyway - make SURE it's pcm audio! - a wav file can contain ANY encoding, even MP3 - but the wavedata class only reads ordinary pcm audio.

Manja

i specified the correct path so it's not that. it also says in properties that the file is pcm. it does behave like it's a file not found thing. but i'm 100% sure that the path is correct. i've tried ten different ways of specifying the path and none of them have worked? there must be something stupid that i'm not doing. or that i am doing...

mcsquared

Hi

Just wanted to say that I was having the same problem as this.  I'm not sure exactly why it is caused but it seems that the WaveData class sometimes has problems locating the file you specify.  I don't know if this a real problem within the class that needs to be corrected or not. (The demo on the website worked fine for me, but I started having problems when using WaveData in my own project  ???)

If anyone is interested, I got around this problem by first creating a FileInputStream from the file and then feeding that into the WaveData.create() method.