Cannot get Java to play a sound...
Here is the code... What is wrong? :-/
Code :
public static void music() {
AudioPlayer MGP = AudioPlayer.player;
AudioStream BGM;
AudioData MD;
ContinuousAudioDataStream loop = null;
try {
BGM = new AudioStream(new FileInputStream("track.au"));
MD = BGM.getData();
loop = new ContinuousAudioDataStream(MD);
} catch(IOException error) {}
MGP.start(loop);
}
Kind,
Regards Jump
Re: Cannot get Java to play a sound...
That empty catch exception might be the place to start...are there exceptions thrown?
Re: Cannot get Java to play a sound...
Aaah, I solved it.
Thanks for reminding me about the exception part :-)
Kind,
Regards Jump
Re: Cannot get Java to play a sound...
Hmm, now it's not working again O.O
It says:
java.io.IOException: could not create AudioData object
at sun.audio.AudioStream.getData(Unknown Source)
at aa.music(aa.java:48)
at aa.main(aa.java:22)
How can I solve this? The code looks exactly the same as when it worked :-/