Previous Topic Index Next Topic
[API function]

FSOUND_3D_Listener_SetAttributes

This updates the position, velocity and orientation of a 3d sound listener.

void F_API FSOUND_3D_Listener_SetAttributes(
float *pos,
float *vel,
float fx,
float fy,
float fz,
float tx,
float ty,
float tz
);

Parameters

pos Pointer to a position vector (xyz float triplet), of the listener in world space,
measured in distance units.
This can be NULL to ignore it.
vel Pointer to a velocity vector (xyz float triplet), of the listener measured in
distance units PER SECOND.
This can be NULL to ignore it.
fx x component of a FORWARD unit length orientation vector
fy y component of a FORWARD unit length orientation vector
fz z component of a FORWARD unit length orientation vector
tx x component of a TOP or upwards facing unit length orientation vector
ty y component of a TOP or upwards facing unit length orientation vector
tz z component of a TOP or upwards facing unit length orientation vector

Return Value

On success, TRUE is returned.
On failure, FALSE is returned.

Remarks

FSOUND treats +X as right, +Y as up, and +Z as forwards. (left handed)
To map to your own coordinate system, flip and exchange these values. For example if you wanted to use
right handed coordinates, you would negate the Z value of your own direction vector.
Orientation vectors are expected to be of UNIT length. This means the magnitude of the vector
should be 1.0f.
---------
A 'distance unit' is specified by FSOUND_3D_Listener_SetDistanceFactor. By default this is
set to meters which is a distance scale of 1.0. See FSOUND_3D_Listener_SetDistanceFactor
for more on this.
---------
Please remember to use units PER SECOND, NOT PER FRAME as this is a common mistake.
Do not just use (pos - lastpos) from the last frame's data for velocity, as this is not
correct. You need to time compensate it so it is given in units per SECOND.
You could alter your pos - lastpos calculation to something like this ..
vel = (pos-lastpos) / (time taken since last frame in seconds).. ie at 60fps the formula
would look like this vel = (pos-lastpos) / 0.0166667.

See Also

FSOUND_3D_GetAttributes , FSOUND_3D_Listener_SetDistanceFactor , FSOUND_3D_Listener_SetDopplerFactor , FSOUND_3D_Listener_SetRolloffFactor , FSOUND_3D_SetAttributes , FSOUND_3D_Update

This document copyright ©Firelight Multimedia, 1999-2001. All rights reserved.
Generated Thu Sep 13 00:18:08 2001 by SourceDoc v0.10, the automated source code documenter.