music loop java
// Makes a music loop
Thread music = new Thread() {
public void run() {
Clip clip;
try {
AudioInputStream input = AudioSystem.getAudioInputStream(new File("music.wav"));
clip = AudioSystem.getClip();
clip.open(input);
clip.loop(Clip.LOOP_CONTINUOUSLY);
clip.start();
} catch (UnsupportedAudioFileException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (LineUnavailableException e) {
e.printStackTrace();
}
}
};
music.start();