TeamSpeak 3 supports 3D sound to assign each speaker a unique position in 3D space. Provided are wrapper functions to the FMOD 3D sound system to modify the 3D position, velocity and orientation of own and foreign clients.
Generally the struct TS3CLIENT_FMOD_VECTOR describes a vector in 3D space:
typedef struct { float x; /* X coordinate in 3D space. */ float y; /* Y coordinate in 3D space. */ float z; /* Z coordinate in 3D space. */ } TS3CLIENT_FMOD_VECTOR;
To set the position, velocity and orientation of the own client in 3D space, call:
unsigned int ts3client_fmod_Systemset3DListenerAttributes( | serverConnectionHandlerID, | |
position, | ||
velocity, | ||
forward, | ||
up) ; |
anyID serverConnectionHandlerID
;const TS3_FMOD_VECTOR* position
;const TS3_FMOD_VECTOR* velocity
;const TS3_FMOD_VECTOR* forward
;const TS3_FMOD_VECTOR* up
;Parameters
serverConnectionHandlerID
ID of the server connection handler on which the 3D sound listener attributes are to be set.
position
3D position of the own client.
If passing NULL, the parameter is ignored and the value not updated.
velocity
Velocity of the own client in “distance units per second”. A “distance unit” is specified by the function ts3client_fmod_Systemset3DSettings
, the default is a scale of 1.0 describing one meter.
If passing NULL, the parameter is ignored and the value not updated.
forward
Forward orientation of the listener. The vector must be of unit length and perpendicular to the up vector.
If passing NULL, the parameter is ignored and the value not updated.
up
Upward orientation of the listener. The vector must be of unit length and perpendicular to the forward vector.
If passing NULL, the parameter is ignored and the value not updated.
Returns ERROR_ok
on success, otherwise an error code as defined in public_errors.h
.
This function is a wrapper for the FMOD function System::set3DListenerAttributes
. Please see the FMOD documentation for details.
To adjust FMOD 3D sound system settings use:
unsigned int ts3client_fmod_Systemset3DSettings( | serverConnectionHandlerID, | |
dopplerScale, | ||
distanceFactor, | ||
rolloffScale) ; |
anyID serverConnectionHandlerID
;float dopplerScale
;float distanceFactor
;float rolloffScale
;Parameters
serverConnectionHandlerID
ID of the server connection handler on which the 3D sound system settings are to be adjusted.
dopplerScale
Scaling factor for doppler shift, default is 1.0
distanceFactor
Relative distance factor. Default is 1.0 = 1 meter
rolloffScale
Scaling factor for 3D sound rolloff.
Returns ERROR_ok
on success, otherwise an error code as defined in public_errors.h
.
This function is a wrapper for the FMOD function System::set3DSettings
. Please see the FMOD documentation for details.
To adjust a clients position and velocity in 3D space, call:
unsigned int ts3client_fmod_Channelset3DAttributes( | serverConnectionHandlerID, | |
clientID, | ||
position, | ||
velocity) ; |
anyID serverConnectionHandlerID
;anyID clientID
;const TS3_FMOD_VECTOR* position
;const TS3_FMOD_VECTOR* velocity
;Parameters
serverConnectionHandlerID
ID of the server connection handler on which the 3D sound channel attributes are to be adjusted.
clientID
ID of the client to adjust.
position
Vector specifying the position of the given client in 3D space.
When passing NULL, the parameter will be ignored.
velocity
Vector describing clients velocity in “distance units per second” in 3D space. A “distance unit” is specified by the function ts3client_fmod_Systemset3DSettings
, the default is a scale of 1.0 describing one meter.
When passing NULL, the parameter will be ignored.
Returns ERROR_ok
on success, otherwise an error code as defined in public_errors.h
.
This function is a wrapper to the FMOD function Channel::set3DAttributes
. See the FMOD documentation for details.