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

This class allows to have a list of sound that will play sequentially or randomly with each playback. More...

#include <SoundList.h>

Inheritance diagram for SoundList:
Inheritance graph
[legend]

Public Member Functions

 SoundList (bool random=false)
 Creates a new, empty sound list.
 
 SoundList (std::vector< std::shared_ptr< ISound > > &list, bool random=false)
 Creates a new sound list and initializes it.
 
virtual std::shared_ptr< IReadercreateReader ()
 Creates a reader for playback of the sound source.
 
void addSound (std::shared_ptr< ISound > sound)
 Adds a sound to the list.
 
void setRandomMode (bool random)
 Sets the playback mode of the sound list.
 
bool getRandomMode ()
 Returns the playback mode of the sound list.
 
int getSize ()
 Returns the amount of sounds in the list.
 
- Public Member Functions inherited from ISound
virtual ~ISound ()
 Destroys the sound.
 
virtual std::shared_ptr< IReadercreateReader ()=0
 Creates a reader for playback of the sound source.
 

Detailed Description

This class allows to have a list of sound that will play sequentially or randomly with each playback.

Constructor & Destructor Documentation

◆ SoundList() [1/2]

SoundList::SoundList ( bool  random = false)

Creates a new, empty sound list.

Sounds must be added to the list using the addSound() method.

Parameters
randomFalse if the sounds int he list must be played sequentially. True if random.

◆ SoundList() [2/2]

SoundList::SoundList ( std::vector< std::shared_ptr< ISound > > &  list,
bool  random = false 
)

Creates a new sound list and initializes it.

Parameters
listA vector with sounds to initialize the list.
randomFalse if the sounds int he list must be played sequentially. True if random.

Member Function Documentation

◆ addSound()

void SoundList::addSound ( std::shared_ptr< ISound sound)

Adds a sound to the list.

The added sounds can be played sequentially or randomly dependig on the m_random flag

Parameters
soundA shared_ptr to the sound.

◆ createReader()

virtual std::shared_ptr< IReader > SoundList::createReader ( )
virtual

Creates a reader for playback of the sound source.

Returns
A pointer to an IReader object or nullptr if there has been an error.
Exceptions
ExceptionAn exception may be thrown if there has been a more unexpected error during reader creation.

Implements ISound.

◆ getRandomMode()

bool SoundList::getRandomMode ( )

Returns the playback mode of the sound list.

The two posible modes are random and sequential.

Returns
True if the random mode is activated, false otherwise.

◆ getSize()

int SoundList::getSize ( )

Returns the amount of sounds in the list.

Returns
The amount of sounds in the list.

◆ setRandomMode()

void SoundList::setRandomMode ( bool  random)

Sets the playback mode of the sound list.

There are two posible modes, random and sequential.

Parameters
randomTrue to activate the random mode, false to activate sequential mode.

The documentation for this class was generated from the following file: