Sherwoodwt / SpaceGame

Just a Space game written in Java
1 stars 0 forks source link

Sounds Effects #20

Open Sherwoodwt opened 8 years ago

Sherwoodwt commented 8 years ago

Where sounds are needed -shooting -blowing up -missle existence (volume based on speed) -POSSIBLE background music depending on difficulty

Sherwoodwt commented 7 years ago

Sound currently added, doesn't work correctly.

stop is called in shoot method before start recalled to replay clip. stop causes thread to wait until sound clip is finished playing to stop it. This means that the main game thread pauses when you hit shoot button again before audio is finished.

One idea is to have a class that handles playback of an audio file, and maybe has a thread pool. This pool plays threads synchronously, killing and disposing of them as they finish. Clip loaded in memory at construction, started at invocation.