Hi Tim and John, First, thanks for looking at this, it has really given me headaches.
Tim Moore wrote: > Assuming you want the orientation and position of the listener, and the > positions of the sources, to match those in the visual world, you > should just use the absolute position and orientation in the corresponding > FGViewer object i.e., what you get from FGViewer::getViewPosition() and > FGViewer::getViewOrientation(). You don't need to worry about the local > reference frame, view position and orientation offsets, or the rotation > between OpenGL and aerospace coordinates; that is all included in those > position and orientation values. Then the vectors you need for the OpenAL > orientation are: > > SGVec3d lookAt = viewOrientation.back_transform(-SGVec3d::ec3); > SGVec3d lookUp = viewOrientation.back_transform(SGVec3d::ec2); Ok, I'll test this right away. > Now, there's a problem with using Cartesian coordinates directly: a > single precision float doesn't have enough precision to represent positions > near the earth's surface to better than a few meters. This is likely > to be an issue for sound sources near the listener, like cockpit sounds and > engine noises. So, the simplest coordinate system to use has its origin at > the listener's position, but is oriented with the global Cartesian system. > The position you set in OpenAL for the sound sources would just be the > relative > position of the source with respect to the listener i.e., sourcePos - > listenerPos. That's one thing that has concerned me also and I have made preparations to make this easy. > While setting the listener position and orientation and source positions is > simple, > you will need to transform the velocities of the listener and sources from > the local > earth frame to the global Cartesian frame. Looking at src/Model/acmodel.cxx, > you > have a velocity in the local frame as (speed_north, speed_east, speed_down) > in feet per second. > To transform that to the global frame: > SGQuatd hlOr = SGQuatd::fromLonLat(_position); > SGVec3d globalVelocity = hlOr.back_transform(localVelocity*SG_FEET_TO_METER); > > If you can point me to the code where you calculate the positions of local > sources from > the model, I'll take a look at that too. The local source positions are set in simgear/sound/xmlsound.xml but they are just offsets to the model in a normal situation and don't change during the simulation(yet). Erik ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Flightgear-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/flightgear-devel

