Answers for "music loop java"

0

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();
Posted by: Guest on September-29-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language