FNA-XNA / FAudio

FAudio - Accuracy-focused XAudio reimplementation for open platforms
https://fna-xna.github.io/
Other
550 stars 75 forks source link

A Listener vector of 0,0,0 causes assert. #176

Closed alesliehughes closed 3 years ago

alesliehughes commented 4 years ago

When F3DAudioCheckCalculateParams is called with a Listener vector of 0,0,0 it's causing an assertion. Is the assert wrong in this case?

016d:trace:xaudio2:X3DAudioCalculate l OrientFront 0.000000, 0.000000, 0.000000 016d:trace:xaudio2:X3DAudioCalculate l OrientTop 0.000000, 0.000000, 0.000000 016d:trace:xaudio2:X3DAudioCalculate l Position 0.000000, 0.000000, 0.000000 016d:trace:xaudio2:X3DAudioCalculate l Velocity 0.000000, 0.000000, 0.000000

016d:trace:xaudio2:X3DAudioCalculate e OrientFront 1.000000, 0.000000, 0.000000 016d:trace:xaudio2:X3DAudioCalculate e OrientTop 0.000000, 1.000000, 0.000000 016d:trace:xaudio2:X3DAudioCalculate e Position 0.000000, 0.000000, 0.000000 016d:trace:xaudio2:X3DAudioCalculate e Velocity 0.000000, 0.000000, 0.000000 WARN:

Assertion failure at F3DAudioCheckCalculateParams (/home/alesliehughes/source/FAudio/src/F3DAudio.c:365), triggered 1 time: 'SDL_fabsf(SDL_sqrtf((pListener->OrientFront.x pListener->OrientFront.x) + (pListener->OrientFront.y pListener->OrientFront.y) + (pListener->OrientFront.z * pListener->OrientFront.z)) - 1.0f) <= 1e-5f && "Vector " "pListener->OrientFront" " isn't normal"'

flibitijibibo commented 4 years ago

I believe all the assertions came from testing inputs against X3DAudio1_7D.dll, which will assert on error. Some games like Skyrim are known to send bogus data so this may be accurate!

flibitijibibo commented 3 years ago

Finally sat down and checked this out - the debug binary does indeed assert:

X3DAUDIO ERROR: Magnitude(pOrientFront)-1.0f failed bounds validation against [-ORTHONORMAL_EPSILON,ORTHONORMAL_EPSILON], {TraceBool, Line 59}
X3DAUDIO ERROR: &pEmitter->OrientFront is not orthonormal with &pEmitter->OrientTop, {TraceBool, Line 59}

While not exactly the same message, it does confirm: Failure to make OrientFront/Top normal is an error, so naturally Skyrim has to do it at least once as part of its proud tradition of engine stability.