Firelight Technologies FMOD Studio API
This updates the position, velocity and orientation of the specified 3D sound listener.
FMOD_RESULT System::set3DListenerAttributes(
int listener,
const FMOD_VECTOR *pos,
const FMOD_VECTOR *vel,
const FMOD_VECTOR *forward,
const FMOD_VECTOR *up
);
FMOD_RESULT FMOD_System_Set3DListenerAttributes(
FMOD_SYSTEM *system,
int listener,
const FMOD_VECTOR *pos,
const FMOD_VECTOR *vel,
const FMOD_VECTOR *forward,
const FMOD_VECTOR *up
);
If the function succeeds then the return value is FMOD_OK.
If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.
By default, FMOD uses a left-handed co-ordinate system. This means +X is right, +Y is up, and +Z is forwards.
To change this to a right-handed coordinate system, use FMOD_INIT_3D_RIGHTHANDED. This means +X is right, +Y is up,
and +Z is backwards or towards you.
To map to another coordinate system, flip/negate and exchange these values.
Orientation vectors are expected to be of UNIT length. This means the magnitude of the vector should be 1.0.
A 'distance unit' is specified by System::set3DSettings. By default this is set to meters which is a distance scale of 1.0.
Always remember to use units per second, not units per frame as this is a common mistake and will make the doppler effect sound wrong.
For example, 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.
I.e. at 60fps the formula would look like this vel = (pos-lastpos) / 0.0166667.
Version 1.03.06 Built on Apr 17, 2014