sfMusic Class Reference

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

#include <Music.hpp>

Inheritance diagram for sfMusic:

sfSoundStream sfThread sfSound List of all members.

Public Member Functions

 sfMusic (std::size_t BufferSize=44100)
 Construct the music with a buffer size.
 ~sfMusic ()
 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 music 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 stream sample rate.
Status GetStatus () const
 Get the status of the stream (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

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

Definition at line 45 of file Music.hpp.


Constructor & Destructor Documentation

sfMusic::sfMusic ( 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 38 of file Music.cpp.

sfMusic::~sfMusic (  ) 

Destructor.

Definition at line 51 of file Music.cpp.


Member Function Documentation

bool sfMusic::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 60 of file Music.cpp.

void sfMusic::SetLoop ( bool  Loop  ) 

Set the music loop state.

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

Reimplemented from sfSound.

Definition at line 92 of file Music.cpp.

bool sfMusic::GetLoop (  )  const

Tell whether or not the music is looping.

Returns:
True if the music is looping, false otherwise

Reimplemented from sfSound.

Definition at line 101 of file Music.cpp.

float sfMusic::GetDuration (  )  const

Get the music duration.

Returns:
Music duration, in seconds

Definition at line 157 of file Music.cpp.

void sfSoundStream::Play (  )  [inherited]

Start playing the audio stream.

Reimplemented from sfSound.

Definition at line 82 of file SoundStream.cpp.

void sfSoundStream::Stop (  )  [inherited]

Stop playing the audio stream.

Reimplemented from sfSound.

Definition at line 111 of file SoundStream.cpp.

unsigned int sfSoundStream::GetChannelsCount (  )  const [inherited]

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

..)

Returns:
Number of channels

Definition at line 122 of file SoundStream.cpp.

unsigned int sfSoundStream::GetSampleRate (  )  const [inherited]

Get the stream sample rate.

Returns:
Stream frequency (number of samples per second)

Definition at line 131 of file SoundStream.cpp.

sfSound::Status sfSoundStream::GetStatus (  )  const [inherited]

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

Returns:
Current status of the sound

Reimplemented from sfSound.

Definition at line 140 of file SoundStream.cpp.

void sfSoundStream::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 61 of file SoundStream.cpp.


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