RhythmGame 1.4.3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sounds::Sound Class Referenceabstract

A sound that can be played. More...

#include <Sound.h>

Inheritance diagram for sounds::Sound:
Inheritance graph
[legend]

Public Member Functions

virtual ~Sound ()=default
 
virtual void play ()=0
 Plays the sound.
 
virtual void stop ()=0
 Stops the sound.
 
virtual void setVolume (float volume)=0
 Sets the volume of the sound.
 
virtual auto isPlaying () const -> bool=0
 Is the sound playing right now?
 
virtual auto getVolume () const -> float=0
 Gets the volume of the sound.
 

Detailed Description

A sound that can be played.

The underlying data buffer can be shared between multiple sounds. This means that you can have multiple instances of the same sound playing at the same time, while only loading the file once.

Constructor & Destructor Documentation

◆ ~Sound()

virtual sounds::Sound::~Sound ( )
virtualdefault

Member Function Documentation

◆ getVolume()

virtual auto sounds::Sound::getVolume ( ) const -> float
pure virtual

Gets the volume of the sound.

Returns
The volume. 1 is normal, 0 is silent, 2 is twice as loud.

Implemented in sounds::MultiSound, and sounds::NormalSound.

◆ isPlaying()

virtual auto sounds::Sound::isPlaying ( ) const -> bool
pure virtual

Is the sound playing right now?

Implemented in sounds::MultiSound, and sounds::NormalSound.

◆ play()

virtual void sounds::Sound::play ( )
pure virtual

Plays the sound.

This does not block, obviously. Make sure the sound object stays alive.

Implemented in sounds::MultiSound, and sounds::NormalSound.

◆ setVolume()

virtual void sounds::Sound::setVolume ( float  volume)
pure virtual

Sets the volume of the sound.

Parameters
volumeThe volume. 1 is normal, 0 is silent, 2 is twice as loud.

Implemented in sounds::MultiSound, and sounds::NormalSound.

◆ stop()

virtual void sounds::Sound::stop ( )
pure virtual

Stops the sound.

Does not block. The sound can be played again.

Implemented in sounds::MultiSound, and sounds::NormalSound.


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