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

2013/1/1

Problem with playLoop()

Rodeurhalt Rodeurhalt

2013/1/1

#
Hi! I want to play a sound in a loop, so I used playLoop(). It works but each time the sound repeat an error occur : Exception in thread "SoundStream:file:/C:/Users/Loïc/Desktop/TowerDefense-2.0-Loïc%20Rosset%203A1/Tower%20Defense/sounds/Strength%20of%20a%20Thousand%20Men.mp3" java.lang.ArrayIndexOutOfBoundsException: 580 at javazoom.jl.decoder.LayerIIIDecoder.huffman_decode(LayerIIIDecoder.java:795) at javazoom.jl.decoder.LayerIIIDecoder.decode(LayerIIIDecoder.java:278) at javazoom.jl.decoder.LayerIIIDecoder.decodeFrame(LayerIIIDecoder.java:219) at javazoom.jl.decoder.Decoder.decodeFrame(Decoder.java:147) at greenfoot.sound.Mp3AudioInputStream.read(Mp3AudioInputStream.java:230) at greenfoot.sound.SoundStream.run(SoundStream.java:302) at java.lang.Thread.run(Thread.java:722) Here is my code for the sound:
private GreenfootSound gameSound1= new GreenfootSound("Strength of a Thousand Men.mp3");
public void act()
{
gameSound1.playLoop();
}
danpost danpost

2013/1/1

#
Line 4 should not be placed in the 'act' method. This command is usually placed in the world constructor or in the overriden method 'public void started()'.
Rodeurhalt Rodeurhalt

2013/1/1

#
Ok I place it in the world constructor but the error still occur :/ And now, the sound doesn't repeat.
vonmeth vonmeth

2013/1/1

#
Try taking the tags off the mp3. It is a problem with the decoder.
danpost danpost

2013/1/1

#
There are probably information tags in the 'mp3' file that Greenfoot/Java does not like. Try re-saving the sound file withouth them and try again.
Rodeurhalt Rodeurhalt

2013/1/1

#
What do you mean by taking the tags off the mp3 ?
private GreenfootSound gameSound1= new GreenfootSound("Strength of a Thousand Men");
Like this ? It doesnt work :/ java.lang.IllegalArgumentException: Could not open sound file: Strength of a Thousand Men Caused by: java.io.FileNotFoundException: Could not find file: Strength of a Thousand Men Danpost => Ok i'll try
Rodeurhalt Rodeurhalt

2013/1/1

#
I deleted all the informations of the mp3 file but the error still occur :(
vonmeth vonmeth

2013/1/1

#
If you are sure you got rid of all the tags, then try saving it in a different format.
Rodeurhalt Rodeurhalt

2013/1/1

#
YAY! It works ! :D I used the program ID3KILL to make sure that the tags would be deleted and now it works. :) Thank you very much and I wish you a happy new year ! :D
You need to login to post a reply.