HI

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[8000];
tune.read(buffer2, 0, buffer2.length);
sound2 = new Sound(buffer2, Sound.FORMAT_WAV);
sound2.init(buffer2, Sound.FORMAT_WAV);



later when i call it i use the code


if(sound2.getState() == Sound.SOUND_STOPPED)
{
sound2.play(1);
}


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

pls help

Shahzad