@r035198x
Thank you. Though my problem persists. I will provide some code for you; if you're willing to continue to help me.
-
public class Audio {
-
public static void main(String args[]) throws IOException, UnsupportedAudioFileException, LineUnavailableException{
-
Clip clip = AudioSystem.getClip();
-
// getAudioInputStream() also accepts a File or InputStream
-
AudioInputStream ais = AudioSystem.getAudioInputStream((new File("Fanfare for the Common Man.wav")));
-
clip.open(ais);
-
clip.loop(Clip.LOOP_CONTINUOUSLY);
-
SwingUtilities.invokeLater(new Runnable() {
-
public void run() {
-
// A GUI element to prevent the Clip's daemon Thread
-
// from terminating at the end of the main()
-
JOptionPane.showMessageDialog(null, "Close to exit!");
-
}
-
});
-
-
}
-
}
-
I am still getting this as a result: Exception in thread "main" javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file
at javax.sound.sampled.AudioSystem.getAudioInputStrea m(Unknown Source)
at Game2.Audio.main(Audio.java:30)
Am I doing something wrong? I have tried other methods of adding sound, however I keep hitting the same codeblock. And Thanks for everything.
-CodeNoob