Gosu::Song Class Reference

Songs are less flexible than samples in that they can only be played one at a time and without panning or speed parameters. More...

List of all members.

Public Types

enum  Type { stStream, stModule }
 There are two types of songs that can be loaded as a Song: Streamed songs (like OGG) and modules (like MOD or XM). More...

Public Member Functions

 Song (const std::wstring &filename)
 Constructs a song that can be played on the provided audio system and loads the song from a file.
 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.
 ~Song ()
void play (bool looping=false)
 Starts or resumes playback of the song.
void pause ()
 Pauses playback of the song.
bool paused () const
 Returns true if the song is the current song, but in paused mode.
void stop ()
 Stops playback of this song if it is currently played or paused.
bool playing () const
 Returns true if the song is currently playing.
double volume () const
 Returns the current volume of the song.
void changeVolume (double volume)
 Changes the volume of the song.
GOSU_DEPRECATED Song (Audio &, const std::wstring &filename)
GOSU_DEPRECATED Song (Audio &, Type type, Reader reader)

Static Public Member Functions

static SongcurrentSong ()
 Returns the song currently being played or paused, or 0 if no song has been played yet or the last song has finished playing.
static void update ()
 Called every tick by Window for management purposes.


Detailed Description

Songs are less flexible than samples in that they can only be played one at a time and without panning or speed parameters.

Definition at line 107 of file Audio.hpp.


Member Enumeration Documentation

There are two types of songs that can be loaded as a Song: Streamed songs (like OGG) and modules (like MOD or XM).

Enumerator:
stStream 
stModule 

Definition at line 157 of file Audio.hpp.


Constructor & Destructor Documentation

Gosu::Song::Song ( const std::wstring &  filename  )  [explicit]

Constructs a song that can be played on the provided audio system and loads the song from a file.

The type is determined from the filename.

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.

Gosu::Song::~Song (  ) 

GOSU_DEPRECATED Gosu::Song::Song ( Audio &  ,
const std::wstring &  filename 
)

GOSU_DEPRECATED Gosu::Song::Song ( Audio &  ,
Type  type,
Reader  reader 
)


Member Function Documentation

void Gosu::Song::changeVolume ( double  volume  ) 

Changes the volume of the song.

static Song* Gosu::Song::currentSong (  )  [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.

void Gosu::Song::pause (  ) 

Pauses playback of the song.

It is not considered being played. currentSong will stay the same.

bool Gosu::Song::paused (  )  const

Returns true if the song is the current song, but in paused mode.

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.

bool Gosu::Song::playing (  )  const

Returns true if the song is currently playing.

void Gosu::Song::stop (  ) 

Stops playback of this song if it is currently played or paused.

Afterwards, currentSong will return 0.

static void Gosu::Song::update (  )  [static]

Called every tick by Window for management purposes.

double Gosu::Song::volume (  )  const

Returns the current volume of the song.


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