Finished a weekend project: rewrote the SoundManager.
The SoundManager used to keep the AudioSystem's Line open for up to 30 seconds after a sound was played, maybe because I thought that opening the line was expensive, or because it makes an audible 'tick' in linux if no other sounds are playing. Well, it turns out that the sound looping bug is the result of some internal befuckery of Sun's caused by keeping the line open. Restructed the sound manager so that lines are opened every time a sound is to be played and then closed immediately after. This also allowed me to simplify a thing or two, and sounds should actually be more responsive, in a tiny way, since previously the dobj thread asked to play a sound, the sound manager thread would load the clip data and finally a data spooling thread would play the actual sound. Now there is no sound manager thread- so the dobj thread adds a sound to the queue and one of the playing threads wakes up, reads the data and plays the sound. Factored out all the music stuff into a new MusicManager. There was almost nothing shared between the two, and it was just annoying to have one monolithic manager that had all the logic and variables for both of these distinct functions. The music manager also no longer has a processing queue, everything takes place on the dobj thread. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3303 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in: