First you create a new sound like this: GreenfootSound sound new GreenfootSound ('filename') // the filename is the same as the one you would use in the playSound method You should create this sound as a global one (at the top of your code). In the Component 2 exam of the WJEC / Eduqas 2016 specification, an audio file will be placed in the sounds folder already. 5 aySound ('FUEL. The GreenfootSound constructor needs a string representing the full filename of the sound file. If you want the sound to stop you have to use the class GreenfootSound. Sound files must be placed the sounds folder of your Greenfoot project to be used in the game. But I dont know so much about Greenfoots SoundBuffers or what ever throws the Exception. If you have the variable outside the method, it will be available to all your code inside the class, and wont ever change unless you tell it to. But what makes me suprise: sometimes the sounds work like I want them to, but also sometimes they dont. The sound keeps looping because you made a variable inside a method, that turns back to false every time the method is called (which is every frame). I am trying to create a simple mp3 player in green foot and use buttons to control the volume. would should happen is: If I click on the image it should change the image and start or stop the sound. I got the sounds from YouTube (free YouTube to MP3 converter). The exeption is only thrown if I play soundfiles longer than about 1 minute. Greenfoot Discuss aySound ('FUEL.mp3') not working About Documentation Download Discuss Scenarios sashvanth wrote. Hi, I am trying to create a sound control. I've got a problem with some GreenfootSounds: sometimes I get this exception:Įxception in thread "SoundStream:file:/D:/Daten/Schule/Informatik/Java/Greenfoot-Szenarien/StarWars%20Szenarios/Star%20Wars%20Szenario%20V6.6/sounds/Mass%20Effect%203%20Soundtrack%20-%20The%20View%20of%20Palaven%20OST%20Music%205-2.mp3" : Could not open sound file: file:/D:/Daten/Schule/Informatik/Java/Greenfoot-Szenarien/StarWars%20Szenarios/Star%20Wars%20Szenario%20V6.6/sounds/Mass%20Effect%203%20Soundtrack%20-%20The%20View%20of%20Palaven%20OST%20Music%205-2.mp3Īt (SoundExceptionHandler.java:66)Īt (SoundStream.java:374)Ĭaused by: java.io.IOException: javazoom.jl.decoder.BitstreamException: Bitstream errorcode 102Īt (Mp3AudioInputStream.java:223)Īt (SoundStream.java:302)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |