If I read your code correctly, you discover an unopened clip and open it before playing. It would be faster to open open clips and restart them. You may need to stop and reset their positions first, as shown in the JSmyth example in the playShootSFX () example.
I get a pretty good answer with SourceDataLines. The best part is that they start faster than an unopened clip, because they start immediately, and do not wait until ALL data for the sound is loaded into RAM (which happens every time you "open" the clip).
But yes, if you have many sounds that are often played back, a clip pool is the way to go. If you want them to overlap or always play until completion, you need a few copies. If not, stop, reset to 0 and restart. But do not continue the reopening! If you do this, you can also use SourceDataLine.
source share