Guest User

Untitled

a guest
Jan 24th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public Audio playMusic() {
  2. try {
  3. micros = 0;
  4. File musicfile = Retris.getTexturepackHandler().getMusic(filepath);
  5. if(musicfile.exists()) {
  6. AudioInputStream audioInput = AudioSystem.getAudioInputStream(musicfile);
  7. clip = AudioSystem.getClip();
  8. clip.open(audioInput);
  9. clip.start();
  10. clip.loop(Clip.LOOP_CONTINUOUSLY);
  11. } else {
  12. System.err.println("The musicfile at "" + filepath + "" does not exist!");
  13. }
  14. } catch(Exception e) {
  15. e.printStackTrace();
  16. }
  17. return this;
  18. }
Add Comment
Please, Sign In to add comment