Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
PlaybackManager Class Reference

This class allows to control groups of playing sounds easily. More...

#include <PlaybackManager.h>

Public Member Functions

 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< IHandleplay (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< IDevicegetDevice ()
 Retrieves the device of the PlaybackManager.
 

Detailed Description

This class allows to control groups of playing sounds easily.

The sounds are part of categories.

Constructor & Destructor Documentation

◆ PlaybackManager()

PlaybackManager::PlaybackManager ( std::shared_ptr< IDevice > device)

Creates a new PlaybackManager.

Parameters
deviceA shared pointer to the device which will be used for playback.

Member Function Documentation

◆ addCategory() [1/2]

unsigned int PlaybackManager::addCategory ( float volume)

Adds an existent category to the manager and returns a key to access it.

Parameters
volumeThe 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
categoryThe 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
catKeyKey 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
catKeyKey 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
catKeyKey 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
soundThe sound to be played and added to a category.
catKeyKey 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
catKeyKey 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
volumeThe volume.
catKeyKey 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
catKeyKey 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: