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

2017/5/17

Greenfoot doesn´t support .Wav?

JanJet2000 JanJet2000

2017/5/17

#
Hey, I am currently working on a Tic Tac Toe Version which includes a duo player mode to play against your friend that sits right next to you or to play against the computer. I have 3 game modes for the solo player mode, easy medium and hard. I want to have a Menu Music and different sounds for each game mode. But I get this error as soon as I open Greenfoot with my wav files in the sounds file. Could not play sound file: file:/C:/Users/ASUS/Desktop/Tic%20Tac%20Toe%203.0/sounds/Exit%20Friendzone%20ft.%20Eden%20-%20Iris%20%5bNCS%20Release%5d.wav If you have a sound card installed, check your system settings. java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_FLOAT 44100.0 Hz, 32 bit, stereo, 8 bytes/frame, is supported. at javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:479) at greenfoot.sound.SoundStream.initialiseLine(SoundStream.java:436) at greenfoot.sound.SoundStream.<init>(SoundStream.java:102) at greenfoot.sound.SoundFactory.createSound(SoundFactory.java:112) at greenfoot.sound.SoundFactory.<init>(SoundFactory.java:65) at greenfoot.sound.SoundFactory.getInstance(SoundFactory.java:78) at greenfoot.gui.GreenfootFrame.makeFrame(GreenfootFrame.java:495) at greenfoot.gui.GreenfootFrame.<init>(GreenfootFrame.java:272) at greenfoot.gui.GreenfootFrame.getGreenfootFrame(GreenfootFrame.java:251) at greenfoot.core.GreenfootMain$2.run(GreenfootMain.java:214) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) What do I need to change?
Yehuda Yehuda

2017/5/17

#
Show the code trying to play the sound. Make sure the sound file is in the program directory sounds folder.
danpost danpost

2017/5/18

#
Remove the path of the file from your code -- only use what you have after "sounds/".
JanJet2000 JanJet2000

2017/5/18

#
GreenfootSound leichterSound = new GreenfootSound(""); leichterSound.play(); Greenfoot.playSound(" Nomyn - Daydreamer.wav"); That´s the code where it should be created and started, but it doesn´t work like this, I tried it with .play and just the normal .playSound but both are not working. (As I tried : .play(); I put the name.wav in the brackets...
Super_Hippo Super_Hippo

2017/5/18

#
You passed an empty String to the constructor of the GreenfootSound object. This can't work. You need to pass the name of the file there (what you did in line 3). Or you remove lines 1 and 2 and only use the 'Greenfoot.playSound...' line (maybe you have to remove the first space there).
JanJet2000 JanJet2000

2017/5/18

#
Fixed it by myself Needed to add the Name in the new GreenfootSound brackets... But still thank you
Yehuda Yehuda

2017/5/19

#
JanJet2000 wrote...
Fixed it by myself Needed to add the Name in the new GreenfootSound brackets... But still thank you
Naturally you have to say which sound you want to play, Greenfoot can't play a sound if you don't say which to play.
You need to login to post a reply.