MERCH!
Giant Bomb - a website about video games and the people that make them

Audio audio audio...

by shinali

Been going slow lately, but I swear I'm trying to do stuff. I've doc'd out the XGS format (most of it, anyways) and just got started on some audio programming. Since I didn't really do much audio before, I went off easy and started off with the SoundEffect classes of XNA. OpenAL seems easy enough, but doesn't really have any sort of 2D audio functionality so I can't do something like panning. I...

Been going slow lately, but I swear I'm trying to do stuff.

I've doc'd out the XGS format (most of it, anyways) and just got started on some audio programming. Since I didn't really do much audio before, I went off easy and started off with the SoundEffect classes of XNA. OpenAL seems easy enough, but doesn't really have any sort of 2D audio functionality so I can't do something like panning. I could try to do some fallback thing with SDL but at that point I would think it'd consume too much memory just to have a buffer with OpenAL and whatever construct SDL uses to store sounds in memory with... SDL. I'd be a lot happier if there were a way to use AL buffers with SDL or vice-versa but for now, I'll just keep messing with OpenAL.

One very little snag I hit was with the whole multiple listener thing for the Apply3D functions. XNA allows you to localize sound effects with multiple listeners around, but OpenAL only has one. The solution wasn't particularly difficult, I just treated it more like OpenGL. That is to say, I've calculated the relative offsets of the emitter from each listener then created as many OpenAL sources as there are XNA listeners. I've created a transformation matrix based on the listener orientation, created a position for the source based on the offset, then transformed that with the aforementioned matrix. Basically I mimicked the effect of multiple listeners through creating multiple sources with relative positioning off one listener. Again, it's not particularly difficult if you're used to thinking about graphics. I'm more concerned how it would perform under load if there are a bunch of listeners since it has to go through the whole rigmarole of matrix calculation and so forth.

Been poking at the PS3 some, as well. Dunno how much I should do concerning Mono, though. I probably should just do fancy graphics stuff.