sfSound Class Reference

sfSound defines the properties of the sound such as position, volume, pitch, etc. More...

#include <Sound.hpp>

Inheritance diagram for sfSound:

sfSoundStream sfMusic List of all members.

Public Types

enum  Status {
  Stopped,
  Paused,
  Playing
}
 Enumeration of the sound states. More...

Public Member Functions

 sfSound (const sfSoundBuffer *Buffer=NULL, bool Loop=false, float Pitch=1.f, float Volume=100.f, float X=0.f, float Y=0.f, float Z=0.f)
 Construct the sound from its parameters.
 sfSound (const sfSound &Copy)
 Copy constructor.
 ~sfSound ()
 Destructor.
void Play ()
 Play the sound.
void Pause ()
 Pause the sound.
void Stop ()
 Stop the sound.
void SetBuffer (const sfSoundBuffer *Buffer)
 Set the source buffer.
void SetLoop (bool Loop)
 Set the sound loop state.
void SetPitch (float Pitch)
 Set the sound pitch.
void SetVolume (float Volume)
 Set the sound volume.
void SetPosition (float X, float Y, float Z)
 Set the sound position.
const sfSoundBufferGetBuffer () const
 Get the source buffer.
bool GetLoop () const
 Tell whether or not the sound is looping.
float GetPitch () const
 Get the pitch.
float GetVolume () const
 Get the volume.
void GetPosition (float &X, float &Y, float &Z) const
 Get the sound position.
Status GetStatus () const
 Get the status of the sound (stopped, paused, playing).
float GetPlayingOffset () const
 Get the current playing position of the sound.
sfSoundoperator= (const sfSound &Other)
 Assignment operator.

Friends

class sfSoundStream

Detailed Description

sfSound defines the properties of the sound such as position, volume, pitch, etc.

Definition at line 41 of file Sound.hpp.


Member Enumeration Documentation

enum sfSound::Status

Enumeration of the sound states.

Enumerator:
Stopped  Sound is not playing.
Paused  Sound is paused.
Playing  Sound is playing.

Definition at line 48 of file Sound.hpp.


Constructor & Destructor Documentation

sfSound::sfSound ( const sfSoundBuffer Buffer = NULL,
bool  Loop = false,
float  Pitch = 1.f,
float  Volume = 100.f,
float  X = 0.f,
float  Y = 0.f,
float  Z = 0.f 
)

Construct the sound from its parameters.

Parameters:
Buffer : Sound buffer to play (NULL by default)
Loop : Loop flag (false by default)
Pitch : Value of the pitch (1 by default)
Volume : Volume (100 by default)
X : X position (0 by default)
Y : Y position (0 by default)
Z : Z position (0 by default)

Definition at line 36 of file Sound.cpp.

sfSound::sfSound ( const sfSound Copy  ) 

Copy constructor.

Parameters:
Copy : Instance to copy

Definition at line 56 of file Sound.cpp.

sfSound::~sfSound (  ) 

Destructor.

Definition at line 79 of file Sound.cpp.


Member Function Documentation

void sfSound::Play (  ) 

Play the sound.

Reimplemented in sfSoundStream.

Definition at line 89 of file Sound.cpp.

void sfSound::Pause (  ) 

Pause the sound.

Definition at line 98 of file Sound.cpp.

void sfSound::Stop (  ) 

Stop the sound.

Reimplemented in sfSoundStream.

Definition at line 107 of file Sound.cpp.

void sfSound::SetBuffer ( const sfSoundBuffer Buffer  ) 

Set the source buffer.

Parameters:
Buffer : Pointer to the new sound buffer to bind to the sound

Definition at line 116 of file Sound.cpp.

void sfSound::SetLoop ( bool  Loop  ) 

Set the sound loop state.

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

Reimplemented in sfMusic.

Definition at line 126 of file Sound.cpp.

void sfSound::SetPitch ( float  Pitch  ) 

Set the sound pitch.

Parameters:
Pitch : New pitch

Definition at line 135 of file Sound.cpp.

void sfSound::SetVolume ( float  Volume  ) 

Set the sound volume.

Parameters:
Volume : Volume (in range [0, 100])

Definition at line 144 of file Sound.cpp.

void sfSound::SetPosition ( float  X,
float  Y,
float  Z 
)

Set the sound position.

Parameters:
X : X position of the sound in the world
Y : Y position of the sound in the world
Z : Z position of the sound in the world

Definition at line 153 of file Sound.cpp.

const sfSoundBuffer * sfSound::GetBuffer (  )  const

Get the source buffer.

Returns:
Sound buffer bound to the sound (can be NULL)

Definition at line 162 of file Sound.cpp.

bool sfSound::GetLoop (  )  const

Tell whether or not the sound is looping.

Returns:
True if the sound is looping, false otherwise

Reimplemented in sfMusic.

Definition at line 171 of file Sound.cpp.

float sfSound::GetPitch (  )  const

Get the pitch.

Returns:
Pitch value

Definition at line 183 of file Sound.cpp.

float sfSound::GetVolume (  )  const

Get the volume.

Returns:
Volume value (in range [1, 100])

Definition at line 195 of file Sound.cpp.

void sfSound::GetPosition ( float &  X,
float &  Y,
float &  Z 
) const

Get the sound position.

Parameters:
X : X position of the sound in the world
Y : Y position of the sound in the world
Z : Z position of the sound in the world

Definition at line 207 of file Sound.cpp.

sfSound::Status sfSound::GetStatus (  )  const

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

Returns:
Current status of the sound

Reimplemented in sfSoundStream.

Definition at line 216 of file Sound.cpp.

float sfSound::GetPlayingOffset (  )  const

Get the current playing position of the sound.

Returns:
Current playing position, expressed in seconds

Definition at line 236 of file Sound.cpp.

sfSound & sfSound::operator= ( const sfSound Other  ) 

Assignment operator.

Parameters:
Other : Instance to assign
Returns:
Reference to the sound

Definition at line 248 of file Sound.cpp.


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