Night Game: Music Integration
Here is a quick status on audio:
We've have been doing the basic audio work on the PC where it's faster. We've not gone to the extreme of hooking up DirectSound to actually play the audio data, but it is useful to work out the logic of managing the tracks and the decoding of data on the PC.
So far, we've have hooked up the Ogg Vorbis decoder to supply the track manager with raw audio sample data from the compressed track.
As audio is consumed, the Track Manager calls the decoder and says, "Hey I need some samples" and the Ogg Vorbis decoder provides those samples (or less if it reaches the end of the track).
When the audio track has been played to the end, the Ogg Vorbis decoder seeks to the beginning of the loaded track, but returns an indication to the Track Manager that the end of the song has been reached. For the ambiance track (beach, rain, wind sounds, etc.) the system immediately calls the decoder again to get more samples (from the beginning of the file) so the track will effectively loop. For music, it takes that opportunity to select and queue the next music track to play.
The plan is to finish this stage of playing sequential music tracks, looping ambient tracks, unloading all tracks and loading all tracks, and testing to ensure we don't run out of memory while playing the game.
We've played the PC version with the decoding stuff running and noticed a hitch, but we were expecting it because it's reading 5 seconds worth of audio every 5 seconds. The plan is to break the audio buffer in to 10 mini-buffers (or frames) and then fill a single buffer at a time so it will be more like reading 1 second worth of audio every second.
Before we do that, we want to test that the PC still behaves correctly and the tracks are managed properly across levels and worlds.
Up next (in the days ahead):
Test PC management of tracks across levels and worlds.
Increase frequency of reads of smaller sizes and verify that hitch disappears.
Switch over to Wii and test.
Hook up a mixer that mixes the audio data from the audio tracks that are playing. (This is another major piece)
Test audio quality.
Hook up sound engine for playing sound effects.