Hi all --
In response to issue 3
http://code.google.com/p/osgaudio/issues/detail?id=3
...there has been a change to how an application should create and init the
SoundRoot node. This affects the Listener position.
SoundRoot now uses an update callback to do the tasks formerly done in cull,
such as process queued sound events and update the Listener position.
Previously, SoundRoot obtained the Camera view matrix from the CullVisitor, and
used it to update the Listener position. This behavior was ill-defined in the
case of multiple views.
Current svn head (as of r42) requires an application to specify a Camera to the
SoundRoot using the setCamera() method. Typically, an app will do this
immediately after creating the SoundRoot, or as soon as the Camera is available
(such as after viewer.realize()), and usually before the first frame. SoundRoot
will then use this Camera's view matrix to determine and update the Listener
position during the update traversal.
If your app has a single view, you would typically specify that view's Camera.
If your app has multiple views, you will need to decide which view you'd like to
use for the Listener position, and specify that view's Camera.
If you don't specify a Camera, SoundRoot will specify the Listener's position as
Vec3( 0, 0, 0 ).
This new paradigm allows the application to specify the Listener position
explicitly. To do this, don't bother setting a Camera in the SoundRoot. Go ahead
and leave this NULL, and the Listener position will be set to the default 0,0,0
during update. Then, after the update traversal, and before cull/draw,
explicitly set the Listener position as follows:
osgAudio::SoundManager::instance()->setListenerMatrix( m );
The osg::Matrix 'm' is a view matrix representing the Listener's position and
orientation.
Possible modification: Not sure about this, but perhaps it's wrong for the
SoundRoot to set the Listener position to 0,0,0 every frame (when the Camera is
NULL). After all, this prevents an application from setting the Listener
position just once and leaving it there. So, we might want to consider changing
SoundRoot to not modify the Listener position at all if the Camera is NULL.
What do you think? Feedback appreciated.
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
--
You received this message because you are subscribed to the Google Groups "osgAudio-users" group.
To post to this group, send email to
osgaudi...@googlegroups.com.
To unsubscribe from this group, send email to
osgaudio-user...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/osgaudio-users?hl=en.