PlaySoundPosEx.cog

This cog plays a sound at one of 4 locations, either a thing, surface, sector or a free vector position. But it only plays the sound when the source location is within earshot of the viewport. Note, I say viewport because this will also work if the camera view is seperate from the player.
The other features of this cog is that it pitches the sound according to the reletive moving speed between the viewport and the sound's source location, pitches the sound down to half its speed when one or the other is underwater, reduces the volume when the thing emitter isn't in view, and the ability to control this cog remotely from another cog.

When loaded into the level you'll find the following symbols you can set:

One can also control the cog remotely by using triggers and messages. You will have to be familiar with SendMessageEx() and SendTrigger().

If you notice in the SendMessageEx() the first parameter is 0. Always make this 0. Don't know why, but I've made it explicit.