Warning
This page refers to an old version of SFML. Click here to switch to the latest version.
Warning
This page refers to an old version of SFML. Click here to switch to the latest version.
Functions | |
std::vector< std::string > | getAvailableDevices () |
Get a list of the names of all available audio playback devices. | |
std::optional< std::string > | getDefaultDevice () |
Get the name of the default audio playback device. | |
bool | setDevice (const std::string &name) |
Set the audio playback device. | |
std::optional< std::string > | getDevice () |
Get the name of the current audio playback device. |
|
nodiscard |
Get a list of the names of all available audio playback devices.
This function returns a vector of strings containing the names of all available audio playback devices.
If the operating system reports multiple devices with the same name, a number will be appended to the name of all subsequent devices to distinguish them from each other. This guarantees that every entry returned by this function will represent a unique device.
For example, if the operating system reports multiple devices with the name "Sound Card", the entries returned would be:
The default device, if one is marked as such, will be placed at the beginning of the vector.
If no devices are available, this function will return an empty vector.
|
nodiscard |
Get the name of the default audio playback device.
This function returns the name of the default audio playback device. If none is available, an empty string is returned.
|
nodiscard |
Get the name of the current audio playback device.
|
nodiscard |
Set the audio playback device.
This function sets the audio playback device to the device with the given name. It can be called on the fly (i.e: while sounds are playing).
If there are sounds playing when the audio playback device is switched, the sounds will continue playing uninterrupted on the new audio playback device.
name | The name of the audio playback device |