XAudio2, XAPOFX Effects and VolumeCurves

Started by
2 comments, last by Iveco 14 years, 7 months ago
Hello, I am using XAudio2 and have two questions about the built-in effects. 1) XAudio2 built-in effect: "Volume Meter". For what reason can this be useful or needed (in a game)? This can just display volume levels? 2) In XAPO, there is a XAPOFX class having a few more effects. I do understand these except one: "FXMasteringLimiter" -> A volume limiter. For what reason should I use a volume limiter, if I can control the volumes manually on each SourceVoice? What kind of reason should I have to put this on a MasteringVoice? What kind of goal can I reach with this? Last but not least: Does someone have experiences with volumecurves in XAudio2 (especially X3DAudio) to control the volume rolloffs per distances? How do I set the maximum volume distance per each emitter, does every emitter need to have it's own volumecurve then? The CurveDistanceScaler factor shouldn't be changed, when it's correctly setup? Thanks for any help. Regards, Iveco
Advertisement
I need a small help with volume curves & distances.

It works fine I can hear a difference in the loudness when I am near or far from the object, but the problem is the volume never goes really down to zero even if DSPSettings.pMatrixCoefficients[0] and DSPSettings.pMatrixCoefficients[1] are both 0.0 (correct with the right CurveDistanceScaleFactor) (I am using the default linear curve) - so that I can still hear the object in thousands of meters away. It works fine in the 3DExample, but I followed it explicitly and when I have 0.0 & 0.0 pMatrixCoefficients I still hear the sound. What can be the reason for this? My Curve is: 0.0, 1.0, 1.0, 0.0 and the matrixcoef's are correctly to 0.0 at my wished distance but I can still hear a sound.

Edit:
The problem has been solved. I noticed that a change via SourceVoice->SetChannelVolumes() (with the values from pMatrixCoefficients) worked fine. After further investigation, I found out that the problem was the SourceVoice's sendlist. After using a correct sendlist I was able to use SetOutputMatrix() again.

[Edited by - Iveco on September 15, 2009 6:30:30 AM]
For 2)

Consider how digital audio works: a wave can effectively go from -1 to 1, and never go outside this range. If it does, it clamps and "squares off" the edge causing clipping, which sounds pretty terrible.

If you play two sounds at once, and they both reach peak amplitude at the same time, the sum (mixed) wave clips and goes outside the range. If your game is playing lots of sounds at the same time, this becomes more and more likely, until eventually the audio is just garbled distorted noise.

The mastering limiter applies a dynamic volume-adjusting algorithm that helps ensure that mixing lots of sounds never clips, and therefore avoids the distortion. On one project of mine, it completely cured some horrible distortion when a lot was going on.

The alternative is to turn all your sounds down, but then your game is really quiet when single sounds are playing - and you just postpone the problem - you just need more sounds playing to clip.

For more info google for limiters or compressors.
Construct (Free open-source game creator)
Thank you very much for your detailed answer!

This topic is closed to new replies.

Advertisement