Encoder options

Important

The use of the Speex codec is deprecated and support for it may be removed at any time in the future.

It is highly recommended to use Opus Voice instead.

Speech quality and bandwidth usage depend on the used Speex encoder. As Speex is a lossy code, the quality value controls the balance between voice quality and network traffic. Valid quality values range from 0 to 10, default is 7. The encoding quality can be configured for each channel using the CHANNEL_CODEC_QUALITY property. The currently used channel codec, codec quality and estimated average used bitrate (without overhead) can be queried using ts3client_getEncodeConfigValue().

Note

Encoder options are tied to a capture device, so querying the values only makes sense after a device has been opened.

unsigned int ts3client_getEncodeConfigValue(uint64 serverConnectionHandlerID, const char *ident, char **result)

Retrieve voice encoder information.

Encoder options are bound to a capture device. You must open a capture device on the specified connection handler prior to calling this function. bitrate will return the estimated bitrate of audio without any overhead. name will return the used codec name. quality will return the codec quality setting, a value between 0 and 10 inclusive.

Parameters:
  • serverConnectionHandlerID – the connection handler to query the encoder information for.

  • ident – the configuration value to query. Valid values are name, quality and bitrate

  • result – address of a variable to receive an utf8 encoded c string with the value of the option queried. Memory is allocated by the client lib and must be freed by caller using ts3client_freeMemory

Returns:

An error code from the Ts3ErrorType enum indicating either success or the failure reason

Examples

To adjust the channel codec quality to a value of 5, you would call:

ts3client_setChannelVariableAsInt(scHandlerID, channelID, CHANNEL_CODEC_QUALITY, 5);

To query information about the current channel quality, do:

 1char *name, *quality, *bitrate;
 2ts3client_getEncodeConfigValue(scHandlerID, "name", &name);
 3ts3client_getEncodeConfigValue(scHandlerID, "quality", &quality);
 4ts3client_getEncodeConfigValue(scHandlerID, "bitrate", &bitrate);
 5
 6printf("Name = %s, quality = %s, bitrate = %s\n", name, quality, bitrate);
 7
 8ts3client_freeMemory(name);
 9ts3client_freeMemory(quality);
10ts3client_freeMemory(bitrate);

Note

Error checking has been left out of these examples. You should check the return value and only access the variables if the function returned ERROR_ok