Nick-O-Rama

makeSound()

Aug 25th, 2015
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1.     import java.io.InputStream;
  2.     import sun.audio.AudioPlayer;
  3.     import sun.audio.AudioStream;
  4.     private InputStream inputStream;
  5.     private AudioStream audioStream;
  6.  
  7.     public void makeSound() {
  8.         try {
  9.             inputStream = getClass().getResourceAsStream("jump.wav");
  10.             audioStream = new AudioStream(inputStream);
  11.             AudioPlayer.player.start(audioStream);
  12.         }
  13.         catch (Exception e) {
  14.             System.out.println("ERROR!!!");
  15.         }
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment