0

I'm not even sure if the problem is that it's not rewinding properly. I have a Sounds enumerator/class which lets me load all sound effects and then play them at will, and in my game, I initialize them and then each time I want to play one, I play it in its own thread so it doesn't freeze the rest of the game.

The problem is that the first time I hold down or click the mouse to shoot (and thus, play the sound), it plays the sound, even repeatedly, as it's supposed to. But after I release the mouse button and try again, the sound no longer plays.

Does anyone know what the cause of this could be? Here are some code snippets showing the Sounds class and the piece of my code where I am playing the sound.

Sounds class: http://pastebin.com/Hqt5dPQ6 Playing the sound: http://pastebin.com/Lex9ZmzJ

I appreciate any help, as I all but dropped this project a couple of months ago because I wasn't making any progress due to this one stupid problem.

Darin Beaudreau
  • 375
  • 7
  • 30
  • I think you'll find Clip.start() is dispatched to it's own thread by default. You don't need to spawn new threads. – Nikki May 22 '13 at 03:38
  • That's the thing, though... until I made that change, the game froze every time it played a sound. – Darin Beaudreau May 22 '13 at 05:01
  • Darin I had a quick look over your code and I'm not seeing the issue though I suspect it has to do with the threading/sync. The only thing I can suggest is restructuring how your audio plays. GL – Nikki May 22 '13 at 08:10

0 Answers0