Okay so I'm trying to get a sound file looped forever whilst the application is open. This is currently the piece of code I've got which runs the sound file.
public class Game {
public static void main(String[] args) {
JFrame window = new JFrame("Josh's 2D College Project");
window.setContentPane(new GamePanel());
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setResizable(false);
window.pack();
window.setVisible(true);
try{
File file = new File("C:/Users/Josh Scott (Zinotia)/Desktop/2D College Project/Resources/Sounds/BGSong.mp3");
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
try{
Player player = new Player(bis);
player.play();
} catch(JavaLayerException ex) {}
} catch(IOException e){}
}
}
I'm using JavaZoom's JavaLayer in order to play the Mp3 file. Could anyone possibly give me another way to loop & use the sound file either with a different way or using the JavaLayer.