Im making a game and i want to make a sounds class so i can call different sounds from different classes for example
Sounds.play1upSound();
how can i make a sound class? (for .wav mainly)
thanks
Printable View
Im making a game and i want to make a sounds class so i can call different sounds from different classes for example
Sounds.play1upSound();
how can i make a sound class? (for .wav mainly)
thanks
The following sample code might be helpful. I know java has a sound API but this is the easiest way to play a sound fileCode:import java.net.MalformedURLException;
public class Test {
public static void main(String[] args) throws MalformedURLException {
java.applet.AudioClip clip = java.applet.Applet
.newAudioClip(new java.net.URL(args[0]));
clip.play();
}
}
thanks