ge211  2021.5.1
A student game engine
Audio_clip Class Referenceabstract

Detailed Description

Common interface to classes that load audio data, Music_track and Sound_effect.

Definition at line 28 of file ge211_audio.hxx.

+ Inheritance diagram for Audio_clip:

Public Member Functions

bool empty () const
 Returns true if this audio clip is empty.
 
 operator bool () const
 Recognizes a non-empty audio clip. More...
 
void load (const std::string &, const Mixer &)
 Loads audio from a resource file into this audio clip instance. More...
 
bool try_load (const std::string &, const Mixer &)
 Attempts to load audio from a resource file into this Audio_clip instance. More...
 
void clear ()
 Unloads any audio data, leaving this Audio_clip empty.
 

Member Function Documentation

◆ load()

void load ( const std::string filename,
const Mixer mixer 
)

Loads audio from a resource file into this audio clip instance.

Throws exceptions::File_error if the file cannot be opened, and exceptions::Mixer_error if the file format cannot be understood.

Definition at line 37 of file ge211_audio.cxx.

◆ operator bool()

operator bool ( ) const
inlineexplicit

Recognizes a non-empty audio clip.

Equivalent to !empty().

Definition at line 39 of file ge211_audio.hxx.

◆ try_load()

bool try_load ( const std::string filename,
const Mixer mixer 
)

Attempts to load audio from a resource file into this Audio_clip instance.

Returns true if loading succeeds, or false if the file format cannot be understood.

Throws exceptions::File_error if the file cannot be opened.

Definition at line 32 of file ge211_audio.cxx.


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