sound freezes the program
i have a game program working on... just add the sounds but the program freezes after some time..... here is the code i am using to initialize the sound and calling it
tune = this.getClass().getResourceAsStream("/Dragon1/res/scn/punch2.wav"
buffer2 = new byte;
tune.read(buffer2, 0, buffer2.length);
sound2 = new Sound(buffer2, Sound.FORMAT_WAV);
later when i call it i use the code
if(sound2.getState() == Sound.SOUND_STOPPED)
some time it freezes the program in the first call and other times it freezes the program after some time playing sounds OKey.
Also as you can see that i have just loaded the sound once in the program and calling it againa again in the program. do i have to initialze or load sound again and again every time i want to play it