ge211
Music_track Class Reference

Detailed Description

A music track, which can be attached to the Mixer and played.

A music track may be empty or non-empty; only non-empty tracks can actually be played.

Note that Music_track has few public member functions. However, a music track can be passed to these Mixer member functions to play it:

Note also that the mixer can only play one music track at a time.

Definition at line 34 of file ge211_audio.h.

Public Member Functions

 Music_track (const std::string &filename, const Mixer &)
 Loads a new music track from a resource file. More...
 
 Music_track ()
 Default-constructs the empty music track.
 
bool empty () const
 Recognizes the empty music track.
 
 operator bool () const
 Recognizes a non-empty music track. More...
 

Constructor & Destructor Documentation

◆ Music_track()

Music_track ( const std::string &  filename,
const Mixer  
)

Loads a new music track from a resource file.

Supported file formats include WAV, MP3, OGG, FLAC, MID, and ABC. However, pausing and resuming does not work correctly with all audio formats.

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

Definition at line 35 of file ge211_audio.cpp.

Member Function Documentation

◆ operator bool()

operator bool ( ) const

Recognizes a non-empty music track.

Equivalent to !empty().

Definition at line 44 of file ge211_audio.cpp.


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