Playsound string sound greenfoot3/11/2024 ![]() : No line matching interface SourceDataLine supporting format PCM_FLOAT 44100.0 Hz, 32 bit, stereo, 8 bytes/frame, is supported.Īt .getLine(AudioSystem.java:479)Īt (SoundStream.java:436)Īt .(SoundStream.java:102)Īt (SoundFactory.java:112)Īt .(SoundFactory.java:65)Īt (SoundFactory.java:78)Īt (GreenfootFrame.java:495)Īt .(GreenfootFrame.java:272)Īt (GreenfootFrame.java:251)Īt $2.run(GreenfootMain.java:214)Īt .dispatch(InvocationEvent.java:311)Īt (EventQueue.java:756)Īt $500(EventQueue.java:97)Īt $3.run(EventQueue.java:709)Īt $3.run(EventQueue.java:703)Īt (Native Method)Īt $JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)Īt (EventQueue.java:726)Īt (EventDispatchThread.java:201)Īt (EventDispatchThread.java:116)Īt (EventDispatchThread.java:105)Īt (EventDispatchThread.java:101)Īt (EventDispatchThread.java:93)Īt (EventDispatchThread. Putting it another way, you are saying 'play this sound' but then providing a whole bunch of sounds. If you have a sound card installed, check your system settings. Because the playSound method requires a String, not a String array. But I get this error as soon as I open Greenfoot with my wav files in the sounds file.Ĭould 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 add instance field to class GreenfootSound wind new GreenfootSound('wind. ![]() I want to have a Menu Music and different sounds for each game mode. To gain more control of the playing of a sound file, use the GreenfootSound constructor and methods. I have 3 game modes for the solo player mode, easy medium and hard. Getting a Graphics instance isn't impossible but it's an advanced technique it's better to use the Greenfoot API as danpost suggested.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. What this boils down to is that you need a Graphics instance before you can call the drawing methods, otherwise it's not clear what you're actually trying to draw on. You can't call any method just by putting the "thodName()" - you need to have an object reference, and then you use "thodName()" (the exception is 'static' methods, such as aySound()). It still wouldn't have worked, because you're using a method from an interface without any target object. Graphics.drawString("Hello World", 400, 300) However, a better try would have been this: static void: setSpeed(int speed) Legt die Ausführungsgeschwindigkeit fest. Graphics.drawString(String "Hello World", 400, 300) playSound(String soundFile) Spielt eine Sounddatei ab. ![]() ![]() You do not need to include the word "String" that is part of the method signature - just like you don't need to put 'int' in front of numbers. You have a few misunderstandings here, but one of the critical ones is that if a method requires a String parameter, it means that you must supply a String when you call the method. Yo I am also a student but I looked on the forums for help So basically, you need to get a recording of your sound and then put it in the sounds folder of your greenfoot project. (1) You cannot use aySound method You can only control the volume of a GreenfootSound object. Graphics.drawString(String Hello World, 400, 300) If you have ever found adding sound into Greenfoot difficult then this short video will give you the confidence you need. However, here are some things to keep in mind.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |