A sound effect track, which can be attached to a Mixer channel and played.
A sound effect track may be empty or non-empty; only non-empty sound effects can actually be played.
Note that Sound_effect has few public member functions. However, an effect track can be passed to the Mixer member function Mixer::play_effect to play it.
Definition at line 124 of file ge211_audio.hxx.
Public Member Functions | |
Sound_effect (const std::string &filename, const Mixer &) | |
Loads a new sound effect track from a resource file. More... | |
Sound_effect () | |
Default-constructs the empty sound effect track. | |
Public Member Functions inherited from Audio_clip | |
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. | |
Sound_effect | ( | const std::string & | filename, |
const Mixer & | mixer | ||
) |
Loads a new sound effect track from a resource file.
Supported file formats may include WAV, MP3, OGG, FLAC, MID, and ABC. Which you actually get depends on which options were enabled when your copy of the SDL2_mixer library that ge211 links against was compiled.
Throws exceptions::File_error if the file cannot be opened, and exceptions::Mixer_error if the file format cannot be understood.
Definition at line 74 of file ge211_audio.cxx.