3D Sound

TeamSpeak 3 supports 3D sound to assign each speaker a unique position in 3D space. Provided are functions to modify the 3D position, velocity and orientation of own and foreign clients.

Generally the struct TS3_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. */
} TS3_VECTOR;

To set the position, velocity and orientation of the own client in 3D space, call:

unsigned int ts3client_systemset3DListenerAttributes(serverConnectionHandlerID,  
 position,  
 forward,  
 up); 
uint64 serverConnectionHandlerID;
const TS3_VECTOR* position;
const TS3_VECTOR* forward;
const TS3_VECTOR* up;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


To adjust 3D sound system settings use:

unsigned int ts3client_systemset3DSettings(serverConnectionHandlerID,  
 distanceFactor,  
 rolloffScale); 
uint64 serverConnectionHandlerID;
float distanceFactor;
float rolloffScale;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


To adjust a clients position and velocity in 3D space, call:

unsigned int ts3client_channelset3DAttributes(serverConnectionHandlerID,  
 clientID,  
 position); 
uint64 serverConnectionHandlerID;
anyID clientID;
const TS3_VECTOR* position;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


The following event is called to calculate volume attenuation for distance in 3D positioning of clients.

void onCustom3dRolloffCalculationClientEvent(serverConnectionHandlerID,  
 clientID,  
 distance,  
 volume); 
uint64 serverConnectionHandlerID;
anyID clientID;
float distance;
float* volume;
 


The following event is called to calculate volume attenuation for distance in 3D positioning of a wave file that was opened previously with ts3client_playWaveFileHandle.

void onCustom3dRolloffCalculationWaveEvent(serverConnectionHandlerID,  
 waveHandle,  
 distance,  
 volume); 
uint64 serverConnectionHandlerID;
uint64 waveHandle;
float distance;
float* volume;
 


This method is used to 3D position a wave file that was opened previously with ts3client_playWaveFileHandle.

unsigned int ts3client_set3DWaveAttributes(serverConnectionHandlerID,  
 waveHandle,  
 position); 
uint64 serverConnectionHandlerID;
uint64 waveHandle;
const TS3_VECTOR* position;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.