Songs are less flexible than samples.
More...
|
| Song (const std::string &filename) |
| Constructs a song that can be played on the provided audio system and loads the song from a file. More...
|
|
| Song (Reader reader) |
| Constructs a song of the specified type that can be played on the provided audio system and loads the song data from a stream. More...
|
|
| ~Song () |
|
void | play (bool looping=false) |
| Starts or resumes playback of the song. More...
|
|
void | pause () |
| Pauses playback of the song. More...
|
|
bool | paused () const |
| Returns true if the song is the current song, but in paused mode. More...
|
|
void | stop () |
| Stops playback of this song if it is currently played or paused. More...
|
|
bool | playing () const |
| Returns true if the song is currently playing. More...
|
|
double | volume () const |
| Returns the current volume of the song. More...
|
|
void | set_volume (double volume) |
|
|
static Song * | current_song () |
| Returns the song currently being played or paused, or 0 if no song has been played yet or the last song has finished playing. More...
|
|
static void | update () |
| Called every tick by Window to feed new audio data to OpenAL. More...
|
|
Songs are less flexible than samples.
Only one Song can be played at any given time, and there is no way to control its pan (stereo position) or speed.
Definition at line 92 of file Audio.hpp.
◆ Song() [1/2]
Gosu::Song::Song |
( |
const std::string & |
filename | ) |
|
|
explicit |
Constructs a song that can be played on the provided audio system and loads the song from a file.
The file type is determined by the filename.
◆ Song() [2/2]
Gosu::Song::Song |
( |
Reader |
reader | ) |
|
|
explicit |
Constructs a song of the specified type that can be played on the provided audio system and loads the song data from a stream.
◆ ~Song()
◆ current_song()
static Song* Gosu::Song::current_song |
( |
| ) |
|
|
static |
Returns the song currently being played or paused, or 0 if no song has been played yet or the last song has finished playing.
◆ pause()
void Gosu::Song::pause |
( |
| ) |
|
Pauses playback of the song.
It is not considered being played. current_song will stay the same.
◆ paused()
bool Gosu::Song::paused |
( |
| ) |
const |
Returns true if the song is the current song, but in paused mode.
◆ play()
void Gosu::Song::play |
( |
bool |
looping = false | ) |
|
Starts or resumes playback of the song.
This will stop all other songs and set the current song to this object.
◆ playing()
bool Gosu::Song::playing |
( |
| ) |
const |
Returns true if the song is currently playing.
◆ set_volume()
void Gosu::Song::set_volume |
( |
double |
volume | ) |
|
- Parameters
-
volume | Can be anything from 0.0 (silence) to 1.0 (full volume). |
◆ stop()
void Gosu::Song::stop |
( |
| ) |
|
Stops playback of this song if it is currently played or paused.
Afterwards, current_song will return nullptr.
◆ update()
static void Gosu::Song::update |
( |
| ) |
|
|
static |
Called every tick by Window to feed new audio data to OpenAL.
◆ volume()
double Gosu::Song::volume |
( |
| ) |
const |
Returns the current volume of the song.
The documentation for this class was generated from the following file: