Sending a sound

Although you could use sendBin to play a sound on the robot, a specific and efficient method has been written for this purpose: sendSound.

client->sendSound("speaker", sound, "endsound");

The first parameter is the sound device to which we send the sound, the second parameter is an liburbi.main.USound class describing the sound to send. The third is an optionnal tag that will be used by the server to issue a "stop" system message when the sound has finished playing. The function convert (in liburbi.liburbi class) can be used to convert between various sound formats.

There is no limit to the size of the sound buffer, since it will be automatically cut into small chunks by the library. The data is copied by the library: the USound parameter and its associated data can be safely freed as soon as the function returns.