I got side tracked again. I was bored play testing in silence so I have added gun shot sounds. I already had music for the menus and a click for menu choices, so I was not starting from scratch.
Basic sounds fitted in nicely. I already had enough code to display a decal when the round hits a structure. That same code path was perfect for putting in the play command for a sound and storing what sound each round made, both at the muzzle and upon impact of an object.
The problems came when making them 3D! Sounds further away need to sound quieter. There is an Apply3D method but to go with it I had to learn how to set this up in XACT. Not as difficult as I thought, but getting it right for my scale, 1 unit = 1m, took some tweeking.
The other problem I have is that for some reason the 3D sounds don't work on my main development PC but are clearly audible on the 360 and on my secondary PC. Odd but it just means I have to test more frequently on the Xbox.
The bit I don't like is that XACT still creates a tiny bit of garbage. I'd avoided the obvious areas but eventually after lots of searches on forums decided the last bit of garbage is unavoidable. Garbage is any object that uses memory on the heap and then needs disposing of during the game. It can interrupt game play. My aim is to avoid any garbage collection during a normal game. My target is 10 minutes between garbage collections.
At the moment I am well within target so I've added sound to my list of areas that create some garbage. It's a short list because the only other thing on it is particle emitters. I'm sure I'll come back to that when I decide I must reduce garbage further.
Back to animating my alien character.