Documentation of SFML 1.6

Warning: this page refers to an old version of SFML. Click here to switch to the latest version.
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

Public Types

enum  Status
 Enumeration of the sound states. More...
 

Public Member Functions

 Music (std::size_t BufferSize=44100)
 Construct the music with a buffer size.
 
 ~Music ()
 Destructor.
 
bool OpenFromFile (const std::string &Filename)
 Open a music file (doesn't play it – call Play() for that)
 
bool OpenFromMemory (const char *Data, std::size_t SizeInBytes)
 Open a music file from memory (doesn't play it – call Play() for that)
 
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)
 
float GetPlayingOffset () const
 Get the current playing position of the stream.
 
void SetLoop (bool Loop)
 Set the stream loop state.
 
bool GetLoop () const
 Tell whether or not the stream is looping.
 

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.

Member Enumeration Documentation

enum sf::Sound::Status
inherited

Enumeration of the sound states.

Definition at line 52 of file Sound.hpp.

Constructor & Destructor Documentation

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

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)
sf::Music::~Music ( )

Destructor.

Member Function Documentation

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

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

Returns
Number of channels
float sf::Music::GetDuration ( ) const

Get the music duration.

Returns
Music duration, in seconds
bool sf::SoundStream::GetLoop ( ) const
inherited

Tell whether or not the stream is looping.

Returns
True if the music is looping, false otherwise
float sf::SoundStream::GetPlayingOffset ( ) const
inherited

Get the current playing position of the stream.

Returns
Current playing position, expressed in seconds
unsigned int sf::SoundStream::GetSampleRate ( ) const
inherited

Get the stream sample rate.

Returns
Stream frequency (number of samples per second)
Status sf::SoundStream::GetStatus ( ) const
inherited

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

Returns
Current status of the sound
void sf::SoundStream::Initialize ( unsigned int  ChannelsCount,
unsigned int  SampleRate 
)
protectedinherited

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

Parameters
ChannelsCount: Number of channels
SampleRate: Sample rate
bool sf::Music::OpenFromFile ( 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
bool sf::Music::OpenFromMemory ( const char *  Data,
std::size_t  SizeInBytes 
)

Open a music file from memory (doesn't play it – call Play() for that)

Parameters
Data: Pointer to the file data in memory
SizeInBytes: Size of the data to load, in bytes
Returns
True if loading has been successful
void sf::SoundStream::Play ( )
inherited

Start playing the audio stream.

void sf::SoundStream::SetLoop ( bool  Loop)
inherited

Set the stream loop state.

This parameter is disabled by default

Parameters
Loop: True to play in loop, false to play once
void sf::SoundStream::Stop ( )
inherited

Stop playing the audio stream.


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