-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
X3DAUDIO_CALCULATE_ZEROCENTER should be set for proper volume levels returned by X3DAudioCalculate #521
Comments
Note that DirectSound also has this "bug", but in DirectSound there's no way to set a "Zero Center" flag to fix it. |
Interesting. Thanks for the feedback. Looking at the source to XAudio3DCalculate, they clearly have validation that enforces the flag as documented: if (u32Flags & X3DAUDIO_CALCULATE_ZEROCENTER) {
if (!(u32Flags & X3DAUDIO_CALCULATE_MATRIX) || !(pHandle->u32SpeakerChannelMask & SPEAKER_FRONT_CENTER)) {
X3DDEBUG_MESSAGE(X3DDEBUG_ERROR, "X3DAUDIO_CALCULATE_ZEROCENTER valid only for matrix calculations with final mix formats that have a front center channel");
fValid = FALSE;
}
} So if there is no FRONT_CENTER in the provided channel mask or you don't have the flag to calculate a matrix set, the debugging logic would say it's not valid. Furthermore, the actual implementation for
The other logic for that flag only applies if there are more than 2 speaker channels (since the first two are always left/right and the third is the center). In other words, I don't see where in the code that flag would impact a 2 channel speaker configuration. |
Note that with that said, perhaps I should offer a way to set that flag through DirectX Tool Kit for Audio for scenarios where it is desirable. |
If you have any project that you can test it with please do, it for sure matters.
Without ZEROCENTER the matrix contains: 0.5 0.5 XAudio 2.9 Redist on Windows 10. |
It seems that even when there's no Front Center speaker according to the Mastering Voice Channel Mask (SPEAKER_FRONT_CENTER), X3DAudioCalculate will still calculate the matrix volume levels as if there is.
This causes the volume of the sound to play at a lower volume.
For example if you have a 2 channel output (headset), meaning Channel Mask is SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT. It is still needed to set X3DAUDIO_CALCULATE_ZEROCENTER even though the comment of X3DAUDIO_CALCULATE_ZEROCENTER says "valid only for matrix calculations with final mix formats that have a front center channel".
I could be wrong in understanding 3D audio, but if I'm not setting this ZEROCENTER flag what happens is that even a 3D sound playing at a distance of 0 away from the listener, makes the sound play at a lower volume than the actual sound file, which seems like a wrong thing to me?
The text was updated successfully, but these errors were encountered: