Assorted mechanics and sound patches

Apologies for the lack of focus in the patch set. Just went about fixing up some sound code issues and one thing led to the next...