Monday, September 19, 2011

Sound Update

I've bitten the bullet and begun some work on the new DirectSound port. Right now it's pretty basic; it can load a sound, play it (without any consideration of volume, attenuation, entity channels, etc), stop it when done, and unload it during shutdown.

The really nice thing about the choice of DirectSound is that it can painlessly coexist with the old sound system during changeover. All I have to do is check if a buffer has been allocated for the sound in question, and - if so - play from that instead of using the old system. Reverting back to the old system is just a matter of commenting out one line of code.

I can even do a release with a partial implementation. Just comment out that one line, recompile and release.

This makes the transition phase far cleaner, easier and smoother than it would have been otherwise.

I've used the phrase "march of the weenies" in RMQ-related discussions to describe a concept that may very well be technically (or ideologically) superior but is a total pain-in-the-butt to have to work with. Switching to any other audio API instead of DirectSound would have been a "march of the weenies" decision.

There is another "march of the weenies" thing coming up in DirectSound: it uses hundreths of a decibel for it's volume scale. Because this is a logarithmic scale I need to do conversion from Quake's linear scale before I can do volume setting. I'm certain that someone at Microsoft took huge pride in being so technically correct over that, without it even entering their mind for one second that it might actually be awkward to use.

Oh well, on with the march...

No comments: