Playing wave files

## Playing wave files

The TeamSpeak Client Lib offers support to play wave files from the local harddisk.

To play a local wave file, call

`unsigned int ts3client_playWaveFile(` | serverConnectionHandlerID, |
| path`)`; |

`anyID serverConnectionHandlerID`;
`const char* path`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler defining which playback device is to be used to play the sound file.

- `path`

  Local filepath of the sound file in WAV format to be played, encoded in UTF-8.

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

This is the simple version of playing a sound file. It's a fire-and-forget mechanism, this function will not block.

The more complex version is to play an optionally looping sound and obtain a handle, which can be used to pause, unpause and stop the loop.

`unsigned int ts3client_playWaveFileHandle(` | serverConnectionHandlerID, |
| path, |
| loop, |
| waveHandle`)`; |

`anyID serverConnectionHandlerID`;
`const char* path`;
`int loop`;
`uint64* waveHandle`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler defining which playback device is to be used to play the sound file.

- `path`

  Local filepath of the sound file in WAV format to be played, encoded in UTF-8.

- `loop`

  If set to 1, the sound will be looping until the handle is paused or closed.

- `waveHandle`

  Memory address of a variable in which the handle is written. Use this handle to call `ts3client_pauseWaveFileHandle` and `ts3client_closeWaveFileHandle`.

Returns `ERROR_ok` on success, otherwise an error code as defined in `public_errors.h`. If an error occured, `waveHandle` is uninitialized and must not be used.

Using the handle obtained by `ts3client_playWaveFileHandle`, sounds can be paused and unpaused with

`unsigned int ts3client_pauseWaveFileHandle(` | serverConnectionHandlerID, |
| waveHandle, |
| pause`)`; |

`anyID serverConnectionHandlerID`;
`uint64 waveHandle`;
`int pause`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler defining which playback device is to be used to play the sound file.

- `waveHandle`

  Wave handle obtained by `ts3client_playWaveFileHandle`.

- `pause`

  If set to 1, the sound will be paused. Set to 0 to unpause.

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

Using the handle obtained by `ts3client_playWaveFileHandle`, sounds can be closed with

`unsigned int ts3client_closeWaveFileHandle(` | serverConnectionHandlerID, |
| waveHandle`)`; |

`anyID serverConnectionHandlerID`;
`uint64 waveHandle`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler defining which playback device is to be used to play the sound file.

- `waveHandle`

  Wave handle obtained by `ts3client_playWaveFileHandle`.

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

Accessing the voice buffer |  | 3D Sound