audio - Can't get music to play in java -
i'm trying background music play in text adventure making. however, cant sound class work.
import sun.audio.*; import java.io.*; public class sound { public static void music() { audioplayer mgp = audioplayer.player; audiostream bgm; audiodata md; continuousaudiodatastream loop = null; try { inputstream test = new fileinputstream(new file "trainerredmusic.wav"); bgm = new audiostream(test); audioplayer.player.start(bgm); } catch(filenotfoundexception e){ system.out.print(e.tostring()); } catch(ioexception error) { system.out.print(error.tostring()); } mgp.start(loop); } }
i have scoured internet looking simple guide, nothing works doing. trying run .wav file in background of text adventure. help?
Comments
Post a Comment