Hai!
I got some problems with making sounds…
I found no tutorial but someone had posted here a great peice of code that I followed.
I tried, using AudioSystem to add a "checkpoint" sound…
Now it doesnt work…
It give me null exception, even tho I can copy the path and play the file from it!
It it the method or something that is null? :?
Heres the code:
private void setupSound() {
String path = "C:\Users\Andreas\Desktop\RaceGame\";
AudioTrack audBgMusic = AudioSystem.getSystem().createAudioTrack(path +"audio\Checkpoint.wav", false);
AudioSystem.getSystem().getMusicQueue().setRepeatType(RepeatType.ONE);
System.out.println(audBgMusic);
audBgMusic.setType(TrackType.MUSIC);
audBgMusic.setRelative(false);
audBgMusic.setLooping(true);
AudioSystem.getSystem().getMusicQueue().addTrack(audBgMusic);
AudioSystem.getSystem().getMusicQueue().play();
}
Very simple indead :D