sf::Music Class Reference

Music defines a big sound played using streaming, so usually what we call a music :). More...

#include <Music.hpp>

Inheritance diagram for sf::Music:

sf::SoundStream sf::Thread sf::Sound List of all members.

Public Member Functions

 Music (std::size_t BufferSize=44100)
 Construct the music with a buffer size.
 ~Music ()
 Destructor.
bool Open (const std::string &Filename)
 Open a music file (doesn't play it -- call Play() for that).
void SetLoop (bool Loop)
 Set the music loop state.
bool GetLoop () const
 Tell whether or not the music is looping.
float GetDuration () const
 Get the sound duration.
void Play ()
 Start playing the audio stream.
void Stop ()
 Stop playing the audio stream.
unsigned int GetChannelsCount () const
 Return the number of channels (1 = mono, 2 = stereo, .
unsigned int GetSampleRate () const
 Get the sound frequency (sample rate).
Status GetStatus () const
 Get the status of the sound (stopped, paused, playing).

Protected Member Functions

void Initialize (unsigned int ChannelsCount, unsigned int SampleRate)
 Set the audio stream parameters, you must call it before Play().

Detailed Description

Music defines a big sound played using streaming, so usually what we call a music :).

Definition at line 47 of file Music.hpp.


Constructor & Destructor Documentation

sf::Music::Music ( std::size_t  BufferSize = 44100  ) 

Construct the music with a buffer size.

Parameters:
BufferSize : Size of the internal buffer, expressed in number of samples (ie. size taken by the music in memory) (44100 by default)

Definition at line 40 of file Music.cpp.

sf::Music::~Music (  ) 

Destructor.

Definition at line 53 of file Music.cpp.


Member Function Documentation

bool sf::Music::Open ( const std::string &  Filename  ) 

Open a music file (doesn't play it -- call Play() for that).

Parameters:
Filename : Path of the music file to open
Returns:
True if loading has been successful

Definition at line 62 of file Music.cpp.

void sf::Music::SetLoop ( bool  Loop  ) 

Set the music loop state.

Parameters:
Loop : True to play in loop, false to play once

Reimplemented from sf::Sound.

Definition at line 94 of file Music.cpp.

bool sf::Music::GetLoop (  )  const

Tell whether or not the music is looping.

Returns:
True if the music is looping, false otherwise

Reimplemented from sf::Sound.

Definition at line 103 of file Music.cpp.

float sf::Music::GetDuration (  )  const

Get the sound duration.

Returns:
Music duration, in seconds

Definition at line 159 of file Music.cpp.

void sf::SoundStream::Play (  )  [inherited]

Start playing the audio stream.

Reimplemented from sf::Sound.

Definition at line 84 of file SoundStream.cpp.

void sf::SoundStream::Stop (  )  [inherited]

Stop playing the audio stream.

Reimplemented from sf::Sound.

Definition at line 113 of file SoundStream.cpp.

unsigned int sf::SoundStream::GetChannelsCount (  )  const [inherited]

Return the number of channels (1 = mono, 2 = stereo, .

..)

Returns:
Number of channels

Definition at line 124 of file SoundStream.cpp.

unsigned int sf::SoundStream::GetSampleRate (  )  const [inherited]

Get the sound frequency (sample rate).

Returns:
Stream frequency (number of samples per second)

Definition at line 133 of file SoundStream.cpp.

Sound::Status sf::SoundStream::GetStatus (  )  const [inherited]

Get the status of the sound (stopped, paused, playing).

Returns:
Current status of the sound

Reimplemented from sf::Sound.

Definition at line 142 of file SoundStream.cpp.

void sf::SoundStream::Initialize ( unsigned int  ChannelsCount,
unsigned int  SampleRate 
) [protected, inherited]

Set the audio stream parameters, you must call it before Play().

Parameters:
ChannelsCount : Number of channels
SampleRate : Sample rate

Definition at line 63 of file SoundStream.cpp.


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