Hi there, im developing a space shooter and have just recently learned how to include sounds, it works fine except when firing the same soundclip over and over again very fast.
Here is the code I use for the sound:
This code above is within the class that "owns" that sound, it superclass has a method to generate the sound:
For some reason there is less distortion when I reassign sound to JApplet.newAudioClip(url).
now the main class can call that method to play the sound. My
thread calls this method every 60ms while I hold down right mouse button generating a machinegun firing sound.
This works great except the game stops responding every once in awhile for about 5ms or something, not that serious but noteworthy.
How can I accomplish this task without that distortion? That is replay the same sound clip every 60ms.
By the way the soundclip is in .wav format, lowest quality.