![]() |
1.11 |
Notification Sound Effect. More...
#include <sound_effect.h>
Classes | |
class | SoundDevice |
The SoundDevice object is used to describe an ALSA PCM device. More... | |
Public Member Functions | |
SoundEffect () noexcept | |
SoundEffect default constructor. | |
SoundEffect (const SoundEffect &)=delete | |
SoundEffect (const std::string &uri, const SoundDevice &sound_device={}) | |
SoundEffect constructor. | |
~SoundEffect () noexcept | |
EGT_NODISCARD const SoundDevice & | device () const |
Return the sound device used. | |
bool | device (const SoundDevice &sound_device) noexcept |
Set the sound device to use. | |
std::string | media () const |
Return the uri of the sound file. | |
bool | media (const std::string &uri) noexcept |
Set the uri of the sound file. | |
SoundEffect & | operator= (const SoundEffect &)=delete |
void | play () |
Start playing. | |
EGT_NODISCARD bool | repeat () const |
Get the repeat status. | |
void | repeat (bool value) |
Set the repeat status. | |
void | stop () |
Stop playing. | |
Static Public Member Functions | |
static std::vector< SoundDevice > | sound_device_list () |
Get the list of the Alsa PCM devices with their card/device indexes and names. | |
Notification Sound Effect.
The SoundEffect class is ideal for playing notification sounds, such as providing feedback when a button is clicked. This method is fast, asynchronous, and lightweight.
The stream control for Sound'effect is limited to starting and stopping, with an optional repeat feature.
|
explicit |
SoundEffect constructor.
[in] | uri | The uri of the sound file. Only file:// is accepted. |
[in] | sound_device | The sound device to use. Only the card index and device index are considered. |
|
noexcept |
SoundEffect default constructor.
Can be useful to set the uri or sound device later.
|
delete |
|
noexcept |
EGT_NODISCARD const SoundDevice & device | ( | ) | const |
Return the sound device used.
|
noexcept |
Set the sound device to use.
[in] | sound_device | The sound device to use. Only the card index and device index are considered. |
std::string media | ( | ) | const |
Return the uri of the sound file.
|
noexcept |
Set the uri of the sound file.
[in] | uri | The uri of the sound file. Only file:// is accepted. |
|
delete |
void play | ( | ) |
Start playing.
EGT_NODISCARD bool repeat | ( | ) | const |
Get the repeat status.
void repeat | ( | bool | value | ) |
Set the repeat status.
|
static |
Get the list of the Alsa PCM devices with their card/device indexes and names.
void stop | ( | ) |
Stop playing.