This class allows to control groups of playing sounds easily.
More...
#include <PlaybackManager.h>
|
| PlaybackManager (std::shared_ptr< IDevice > device) |
| Creates a new PlaybackManager.
|
|
unsigned int | addCategory (std::shared_ptr< PlaybackCategory > category) |
| Adds an existent category to the manager and returns a key to access it.
|
|
unsigned int | addCategory (float volume) |
| Adds an existent category to the manager and returns a key to access it.
|
|
std::shared_ptr< IHandle > | play (std::shared_ptr< ISound > sound, unsigned int catKey) |
| Plays a sound and adds it to a new or existent category.
|
|
bool | resume (unsigned int catKey) |
| Resumes all the paused sounds of a category.
|
|
bool | pause (unsigned int catKey) |
| Pauses all current playing sounds of a category.
|
|
float | getVolume (unsigned int catKey) |
| Retrieves the volume of a category.
|
|
bool | setVolume (float volume, unsigned int catKey) |
| Sets the volume for a category.
|
|
bool | stop (unsigned int catKey) |
| Stops and erases a category of sounds.
|
|
void | clean () |
| Removes all the invalid handles of all the categories.
|
|
bool | clean (unsigned int catKey) |
| Removes all the invalid handles of a category.
|
|
std::shared_ptr< IDevice > | getDevice () |
| Retrieves the device of the PlaybackManager.
|
|
This class allows to control groups of playing sounds easily.
The sounds are part of categories.
◆ PlaybackManager()
PlaybackManager::PlaybackManager |
( |
std::shared_ptr< IDevice > | device | ) |
|
Creates a new PlaybackManager.
- Parameters
-
device | A shared pointer to the device which will be used for playback. |
◆ addCategory() [1/2]
unsigned int PlaybackManager::addCategory |
( |
float | volume | ) |
|
Adds an existent category to the manager and returns a key to access it.
- Parameters
-
volume | The volume of the new category. |
- Returns
- The category key.
◆ addCategory() [2/2]
unsigned int PlaybackManager::addCategory |
( |
std::shared_ptr< PlaybackCategory > | category | ) |
|
Adds an existent category to the manager and returns a key to access it.
- Parameters
-
category | The category to be added. |
- Returns
- The category key.
◆ clean() [1/2]
void PlaybackManager::clean |
( |
| ) |
|
Removes all the invalid handles of all the categories.
Only needed if individual sounds are stopped with their handles.
◆ clean() [2/2]
bool PlaybackManager::clean |
( |
unsigned int | catKey | ) |
|
Removes all the invalid handles of a category.
Only needed if individual sounds are stopped with their handles.
- Parameters
-
catKey | Key of the category. |
- Returns
- true if succesful.
- false if the category doesn't exist.
◆ getDevice()
std::shared_ptr< IDevice > PlaybackManager::getDevice |
( |
| ) |
|
Retrieves the device of the PlaybackManager.
- Returns
- A shared pointer to the device used by the playback manager.
◆ getVolume()
float PlaybackManager::getVolume |
( |
unsigned int | catKey | ) |
|
Retrieves the volume of a category.
- Parameters
-
catKey | Key of the category. |
- Returns
- The volume value of the category. If the category doesn't exist it returns a negative number.
◆ pause()
bool PlaybackManager::pause |
( |
unsigned int | catKey | ) |
|
Pauses all current playing sounds of a category.
- Parameters
-
catKey | Key of the category. |
- Returns
- true if succesful.
- false if the category doesn't exist.
◆ play()
std::shared_ptr< IHandle > PlaybackManager::play |
( |
std::shared_ptr< ISound > | sound, |
|
|
unsigned int | catKey ) |
Plays a sound and adds it to a new or existent category.
- Parameters
-
sound | The sound to be played and added to a category. |
catKey | Key of the category. |
- Returns
- The handle of the playback; nullptr if the sound couldn't be played.
◆ resume()
bool PlaybackManager::resume |
( |
unsigned int | catKey | ) |
|
Resumes all the paused sounds of a category.
- Parameters
-
catKey | Key of the category. |
- Returns
- true if succesful.
- false if the category doesn't exist.
◆ setVolume()
bool PlaybackManager::setVolume |
( |
float | volume, |
|
|
unsigned int | catKey ) |
Sets the volume for a category.
- Parameters
-
volume | The volume. |
catKey | Key of the category. |
- Returns
- true if succesful.
- false if the category doesn't exist.
◆ stop()
bool PlaybackManager::stop |
( |
unsigned int | catKey | ) |
|
Stops and erases a category of sounds.
- Parameters
-
catKey | Key of the category. |
- Returns
- true if succesful.
- false if the category doesn't exist.
The documentation for this class was generated from the following file: