Jump to content
  • Advertisement
Sign in to follow this  
Evil Steve

XAudio2: 3D sound and X3DAudioCalculate

This topic is 2641 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I'm looking at what seems to be an issue with X3DAudioCalculate(). The documentation for X3DAUDIO_DSP_SETTINGS says that the pMatrixCoefficients array "must have at least (SrcChannelCount × DstChannelCount) elements.". However, when we specify SrcChannelCount as 1, and DstChannelCount as 2 to generate stereo output, we get 6 elements written in the pMatrixCoefficients array.
After some digging, this seems to be because we call X3DAudioInitialize with a speaker config of SPEAKER_5POINT1, and changing this to SPEAKER_STEREO makes the array overflow go away.

I've also been able to reproduce the same problem with the XAudio2Sound3D sample, if I change line 170 of audio.cpp from:
X3DAudioInitialize( details.OutputFormat.dwChannelMask, SPEEDOFSOUND, g_audioState.x3DInstance );
To:
X3DAudioInitialize( SPEAKER_5POINT1, SPEEDOFSOUND, g_audioState.x3DInstance );
Then after the X3DAudioCalculate call, the matrix coefficients array has 6 elements written to it instead of two, which seems to be contrary to what the documentation says.

So my questions are: Has anyone else seen this behaviour? Am I reading the documentation wrong? Is this a bug in the XAudio SDK (I'm assuming not, but you never know...)

Cheers,
Steve

Share this post


Link to post
Share on other sites
Advertisement
I suspect that this is a failure of documentation more than a bug in the API. If calculation of the coefficient matrix is to be correct than the algorithm likely needs more clues about the position of the character of the speakers than is provided by a simple count. The X3DAUDIO_DSP_SETTINGS docs suggest to me that some special consideration is given to low frequency channels (SPEAKER_LOW_FREQUENCY) and it does not look like there is any way to specify this other than the initialize call. When you init for 6 channels, and then call calculate with 2 output channels, what 2 of the 6 channels are used? You probably need to initialize an instance for each variation on number/position of the output channels you want to use.

Share this post


Link to post
Share on other sites
Hi,

When I set up for 5.1 sound but use a DstChannelCount of 2, it appears that 6 of the entries in the matrix coefficients array are modified; so Left, Right, Center, LFE, Rear Right and Rear Left.

I figured it was possibly something like this, but I wasn't sure if I just wasn't reading the docs properly or if I missed out some exciting function call :)

Cheers,
Steve

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!