This site requires JavaScript, please enable it in your browser!
Greenfoot back
Gevater_Tod4711
Gevater_Tod4711 wrote ...

2012/9/11

Problem with GreenfootSounds

1
2
Gevater_Tod4711 Gevater_Tod4711

2012/9/11

#
Hi all, I still got the problem that some of my sounds don't realy work like I want them to. Now I want to catch the exceptions the soundfiles throw but my problem is that the exceptions are thrown while the sound are playing, not if I start or stop them. I already catch the exceptions thrown by starting and stoping the sounds, but is there a way to catch these other exceptions?
erdelf erdelf

2012/9/11

#
well, which exceptions does it throw during playing? I only now the error that the file is not found
Gevater_Tod4711 Gevater_Tod4711

2012/9/11

#
The exception is: Exception in thread "SoundStream:file:/D:/..." java.lang.IllegalArgumentException: Could not open sound file: file:/D:/..." Caused by: java.io.IOException: javazoom.jl.decoder.BitstreamException: Bitstream errorcode 102 I think there was an error in the stream to open the file but only sometimes this hapens. And while playing the sound.
SPower SPower

2012/9/11

#
What kind of file are you trying to open?
Gevater_Tod4711 Gevater_Tod4711

2012/9/11

#
It's an mp3 file. Most times it opens the file but sometimes not. I don't realy understand why.
SPower SPower

2012/9/11

#
I also had a problem like that (in my case, it threw an exception sometimes when the music was playing). I don't know why, maybe it's because of the file, maybe it's a bug in GreenfootSound, maybe something else.
Gevater_Tod4711 Gevater_Tod4711

2012/9/11

#
ok but do you know a way to catch these exceptions? It realy sucks.
SPower SPower

2012/9/11

#
try {
    // code
} catch (Exception e) {}
Gevater_Tod4711 Gevater_Tod4711

2012/9/11

#
yea thats clear. I know how to catch exceptions but only if I have code. The exception is thrown while running the soundfile and I don't know how to catch this.
SPower SPower

2012/9/11

#
Does the program still continue after the printed out exception?
Gevater_Tod4711 Gevater_Tod4711

2012/9/11

#
yes it doe's but however the exception realy sucks. (I haven't used e.printStackTrace if you thought is was that)
SPower SPower

2012/9/11

#
Then you've got the exact same problem as I have. The exception is caught somewhere, but there's printStackTrace called somewhere. There's nothing I really can do for you, maybe somebody of the greenfoot team does.
Gevater_Tod4711 Gevater_Tod4711

2012/9/11

#
So you think greenfoot catches the exception and prints the stacks content on the terminal? Yes that would realy make sence. I don't understand why Greenfoot doe's that but it would be an answer. Thank you SPower.
davmac davmac

2012/9/11

#
That exception is coming out of the Javazoom / JLayer library, which is included with Greenfoot for MP3 support. It may be buggy.
Gevater_Tod4711 Gevater_Tod4711

2012/9/11

#
ok that means I can't do anything right? However thank you for answering.
There are more replies on the next page.
1
2