[Orxonox-commit 1551] r6269 - code/branches/presentation2/src/orxonox/sound
rgrieder at orxonox.net
rgrieder at orxonox.net
Tue Dec 8 10:07:05 CET 2009
Author: rgrieder
Date: 2009-12-08 10:07:04 +0100 (Tue, 08 Dec 2009)
New Revision: 6269
Modified:
code/branches/presentation2/src/orxonox/sound/SoundManager.cc
code/branches/presentation2/src/orxonox/sound/WorldSound.cc
Log:
At last, found the sound bug: A long time ago somebody wrote AL_POSITION instead of AL_ORIENTATION and the orientation of the listener was updated AFTER the position.
Also fixed a problem with the wrong quaternion axis for the listener orientation.
Modified: code/branches/presentation2/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/SoundManager.cc 2009-12-07 21:06:30 UTC (rev 6268)
+++ code/branches/presentation2/src/orxonox/sound/SoundManager.cc 2009-12-08 09:07:04 UTC (rev 6269)
@@ -250,13 +250,12 @@
void SoundManager::setListenerOrientation(const Quaternion& orientation)
{
// update listener orientation
- Vector3 up = orientation.xAxis(); // just a wild guess
- Vector3 at = orientation.zAxis();
+ const Vector3& direction = -orientation.zAxis();
+ const Vector3& up = orientation.yAxis();
- ALfloat orient[6] = { at.x, at.y, at.z,
- up.x, up.y, up.z };
+ ALfloat orient[6] = { direction.x, direction.y, direction.z, up.x, up.y, up.z };
- alListenerfv(AL_POSITION, orient);
+ alListenerfv(AL_ORIENTATION, orient);
ALenum error = alGetError();
if (error == AL_INVALID_VALUE)
COUT(2) << "Sound: OpenAL: Invalid listener orientation" << std::endl;
Modified: code/branches/presentation2/src/orxonox/sound/WorldSound.cc
===================================================================
--- code/branches/presentation2/src/orxonox/sound/WorldSound.cc 2009-12-07 21:06:30 UTC (rev 6268)
+++ code/branches/presentation2/src/orxonox/sound/WorldSound.cc 2009-12-08 09:07:04 UTC (rev 6269)
@@ -80,9 +80,8 @@
if (error == AL_INVALID_VALUE)
COUT(2) << "Sound: OpenAL: Invalid sound velocity" << std::endl;
- const Quaternion& orient = this->getWorldOrientation();
- Vector3 at = orient.zAxis();
- alSource3f(this->audioSource_, AL_DIRECTION, at.x, at.y, at.z);
+ const Vector3& direction = -this->getWorldOrientation().zAxis();
+ alSource3f(this->audioSource_, AL_DIRECTION, direction.x, direction.y, direction.z);
error = alGetError();
if (error == AL_INVALID_VALUE)
COUT(2) << "Sound: OpenAL: Invalid sound direction" << std::endl;
More information about the Orxonox-commit
mailing list