SoundSourceComponent Class Reference

Component wrapper of SFML's sf::Sound and sf::Music. More...

Inheritance diagram for SoundSourceComponent:

Inheritance graph
[legend]
Collaboration diagram for SoundSourceComponent:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SoundSourceComponent (Entity *parent)
 Constructor.
 ~SoundSourceComponent ()
 Deconstructor.
sf::Sound * getSound ()
 Returns a direct pointer to the sf::Sound object in this component.
sf::Music * getMusic ()
 Returns a direct pointer to the sf::Music object in this component.
bool loadMusic (const std::string &fileName)
 Loads the sound data as a music (streaming) object.
bool loadMusicFromMemory (c8 *buffer, long length)
 Loads the sound data as a music (streaming) object from memory.
bool loadSoundBuffer (const std::string &bufferName)
 Loads the sound data from a sound buffer.
void unloadData ()
 Unloads previously loaded data.
void play ()
 Plays the associated sound.
void pause ()
 Pauses the associated sound.
void stop ()
 Stops the associated sound.
f32 getAttenuation () const
 Gets the attenuation of the sound.
bool getIsPaused () const
 Returns whether the sound is paused.
bool getIsPlaying () const
 Returns whether the sound is playing.
bool getIsStopped () const
 Returns whether the sound has been stopped.
bool getLoop () const
 Gets the loop state of the sound.
f32 getMinDistance () const
 Gets the minimum distance.
f32 getOffset () const
 Gets the current playing position of the sound.
f32 getPitch () const
 Gets the pitch of the sound.
f32 getVolume () const
 Gets the volume of the sound.
void setAttenuation (f32 attenuation)
 Sets the attenuation factor. The higher the attenuation, the more the sound will be attenuated with distance from listener.
void setLoop (bool value)
 Sets the sound loop state.
void setMinDistance (f32 minDistance)
 Sets the minimum distance. Closer than this distance, the listener will hear the sound at its maximum volume.
void setOffset (f32 offset)
 Sets the current playing position of the sound.
void setPitch (f32 pitch)
 Sets the sound pitch.
void setVolume (f32 volume)
 Sets the sound volume.
void onPositionChange (void *p)
 Updates the position of the component after its parent has been updated.
void onPause (void *p)
 Pauses the component if the parent is paused.
void onUnPause (void *p)
 Unpauses the component if the parent is unpaused.
void onSound (void *p)
 Responds to changes of the sound data attached to this component.

Static Public Member Functions

static bool parseXML (IXMLReader *file, Entity *entity)
 Parses for a SoundSourceComponent.


Detailed Description

Component wrapper of SFML's sf::Sound and sf::Music.

XML:

 <SoundSourceComponent>
    <!-- Properties -->
 </SoundSourceComponent>

Definition at line 34 of file SoundSourceComponent.h.


Constructor & Destructor Documentation

SoundSourceComponent::SoundSourceComponent ( Entity parent  ) 

Constructor.

Parameters:
parent The parent entity to which the component should be added.

Definition at line 24 of file SoundSourceComponent.cpp.

SoundSourceComponent::~SoundSourceComponent (  ) 

Deconstructor.

Definition at line 38 of file SoundSourceComponent.cpp.


Member Function Documentation

f32 SoundSourceComponent::getAttenuation (  )  const

Gets the attenuation of the sound.

Definition at line 234 of file SoundSourceComponent.cpp.

bool SoundSourceComponent::getIsPaused (  )  const

Returns whether the sound is paused.

Definition at line 240 of file SoundSourceComponent.cpp.

bool SoundSourceComponent::getIsPlaying (  )  const

Returns whether the sound is playing.

Definition at line 258 of file SoundSourceComponent.cpp.

bool SoundSourceComponent::getIsStopped (  )  const

Returns whether the sound has been stopped.

Definition at line 276 of file SoundSourceComponent.cpp.

bool SoundSourceComponent::getLoop (  )  const

Gets the loop state of the sound.

Definition at line 294 of file SoundSourceComponent.cpp.

f32 SoundSourceComponent::getMinDistance (  )  const

Gets the minimum distance.

Definition at line 300 of file SoundSourceComponent.cpp.

sf::Music * SoundSourceComponent::getMusic (  ) 

Returns a direct pointer to the sf::Music object in this component.

Note:
Not available in AngelScript.

Definition at line 57 of file SoundSourceComponent.cpp.

f32 SoundSourceComponent::getOffset (  )  const

Gets the current playing position of the sound.

Note:
Only works when a sound buffer is loaded.

Definition at line 307 of file SoundSourceComponent.cpp.

f32 SoundSourceComponent::getPitch (  )  const

Gets the pitch of the sound.

Definition at line 316 of file SoundSourceComponent.cpp.

sf::Sound * SoundSourceComponent::getSound (  ) 

Returns a direct pointer to the sf::Sound object in this component.

Note:
Not available in AngelScript.

Definition at line 51 of file SoundSourceComponent.cpp.

f32 SoundSourceComponent::getVolume (  )  const

Gets the volume of the sound.

Definition at line 322 of file SoundSourceComponent.cpp.

bool SoundSourceComponent::loadMusic ( const std::string &  fileName  ) 

Loads the sound data as a music (streaming) object.

XML:

     <music fileName="" />

Parameters:
fileName Filename of the music object to load.

Definition at line 63 of file SoundSourceComponent.cpp.

bool SoundSourceComponent::loadMusicFromMemory ( c8 *  buffer,
long  length 
)

Loads the sound data as a music (streaming) object from memory.

Parameters:
buffer Pointer to the start of the buffer.
length Length of the buffer.

Definition at line 122 of file SoundSourceComponent.cpp.

bool SoundSourceComponent::loadSoundBuffer ( const std::string &  bufferName  ) 

Loads the sound data from a sound buffer.

XML:

     <soundBuffer bufferName="" />

Parameters:
bufferName Name of the buffer to load.
See also:
SoundManager

Definition at line 143 of file SoundSourceComponent.cpp.

void SoundSourceComponent::onPause ( void *  p  ) 

Pauses the component if the parent is paused.

Note:
For internal use only!

Definition at line 411 of file SoundSourceComponent.cpp.

void SoundSourceComponent::onPositionChange ( void *  p  ) 

Updates the position of the component after its parent has been updated.

Note:
For internal use only!

Definition at line 399 of file SoundSourceComponent.cpp.

void SoundSourceComponent::onSound ( void *  p  ) 

Responds to changes of the sound data attached to this component.

Note:
For internal use only!

Definition at line 425 of file SoundSourceComponent.cpp.

void SoundSourceComponent::onUnPause ( void *  p  ) 

Unpauses the component if the parent is unpaused.

Note:
For internal use only!

Definition at line 418 of file SoundSourceComponent.cpp.

bool SoundSourceComponent::parseXML ( IXMLReader *  file,
Entity entity 
) [static]

Parses for a SoundSourceComponent.

Note:
For internal use only!

Definition at line 455 of file SoundSourceComponent.cpp.

void SoundSourceComponent::pause (  ) 

Pauses the associated sound.

Definition at line 214 of file SoundSourceComponent.cpp.

void SoundSourceComponent::play (  ) 

Plays the associated sound.

Definition at line 204 of file SoundSourceComponent.cpp.

void SoundSourceComponent::setAttenuation ( f32  attenuation  ) 

Sets the attenuation factor. The higher the attenuation, the more the sound will be attenuated with distance from listener.

XML:

     <attenuation value="" />

Parameters:
attenuation New attenuation factor.

Definition at line 329 of file SoundSourceComponent.cpp.

void SoundSourceComponent::setLoop ( bool  value  ) 

Sets the sound loop state.

XML:

     <loop value="" />

Parameters:
value If true, the sound loops. Else the sound doesn't loop.

Definition at line 341 of file SoundSourceComponent.cpp.

void SoundSourceComponent::setMinDistance ( f32  minDistance  ) 

Sets the minimum distance. Closer than this distance, the listener will hear the sound at its maximum volume.

XML:

     <minDistance value="" />

Definition at line 354 of file SoundSourceComponent.cpp.

void SoundSourceComponent::setOffset ( f32  offset  ) 

Sets the current playing position of the sound.

Note:
Only works when a sound buffer is loaded.

Definition at line 367 of file SoundSourceComponent.cpp.

void SoundSourceComponent::setPitch ( f32  pitch  ) 

Sets the sound pitch.

XML:

     <pitch value="" />

Definition at line 374 of file SoundSourceComponent.cpp.

void SoundSourceComponent::setVolume ( f32  volume  ) 

Sets the sound volume.

XML:

     <volume value="" />

Definition at line 386 of file SoundSourceComponent.cpp.

void SoundSourceComponent::stop (  ) 

Stops the associated sound.

Definition at line 224 of file SoundSourceComponent.cpp.

void SoundSourceComponent::unloadData (  ) 

Unloads previously loaded data.

Definition at line 173 of file SoundSourceComponent.cpp.


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

Generated on Fri Aug 21 23:55:18 2009 for Sirrf - Simple Irrlicht Framework by  doxygen 1.5.8