Get current volume of XAudio2

New releases and general discussions.

Post » Tue Sep 08, 2009 12:43 am

I was messing around with XAudio2 and the 360 controller, trying to scale the controller's rumble to the volume of a positioned sound, when I realised there's no way to get the current volume of a channel with the XAudio2 object. I guess there's only limited uses for it, but it would be useful if you could test the current volume of a sound. That way, you could change the visuals on-screen according to your proximity to a sound, might be a cool effect for 'atmosphere' games. I was just going for 'the closer you are to an explosion, the more rumbling the controller does.'

- Tom
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Tue Sep 08, 2009 8:22 am

If that's all you want to do, why not just come up with your own rumbling-factor based on distance(player.x, player.y, source.x, source.y)? While there should be a get channel volume expression, surely you don't want the inverse-square relationship of sound for controller rumbling? :P
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,498

Post » Tue Sep 08, 2009 3:11 pm

Yeah, I've done the rumbly thing myself now, using that method, and it works nicely. It was just that comparing it to the volume was the first thing that came to mind, which brought to my attention the lack of a 'get volume' expression. Granted, it's pretty redundant in the example I gave, but it'd still be a nice feature, and I'm sure someone could find a use for it.
B
2
S
1
G
5
Posts: 50
Reputation: 1,500


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests