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. |
XML:
<SoundSourceComponent> <!-- Properties --> </SoundSourceComponent>
Definition at line 34 of file SoundSourceComponent.h.
SoundSourceComponent::SoundSourceComponent | ( | Entity * | parent | ) |
Constructor.
parent | The parent entity to which the component should be added. |
Definition at line 24 of file SoundSourceComponent.cpp.
SoundSourceComponent::~SoundSourceComponent | ( | ) |
f32 SoundSourceComponent::getAttenuation | ( | ) | const |
bool SoundSourceComponent::getIsPaused | ( | ) | const |
bool SoundSourceComponent::getIsPlaying | ( | ) | const |
bool SoundSourceComponent::getIsStopped | ( | ) | const |
Returns whether the sound has been stopped.
Definition at line 276 of file SoundSourceComponent.cpp.
bool SoundSourceComponent::getLoop | ( | ) | const |
f32 SoundSourceComponent::getMinDistance | ( | ) | const |
sf::Music * SoundSourceComponent::getMusic | ( | ) |
Returns a direct pointer to the sf::Music object in this component.
Definition at line 57 of file SoundSourceComponent.cpp.
f32 SoundSourceComponent::getOffset | ( | ) | const |
Gets the current playing position of the sound.
Definition at line 307 of file SoundSourceComponent.cpp.
f32 SoundSourceComponent::getPitch | ( | ) | const |
sf::Sound * SoundSourceComponent::getSound | ( | ) |
Returns a direct pointer to the sf::Sound object in this component.
Definition at line 51 of file SoundSourceComponent.cpp.
f32 SoundSourceComponent::getVolume | ( | ) | const |
bool SoundSourceComponent::loadMusic | ( | const std::string & | fileName | ) |
Loads the sound data as a music (streaming) object.
XML:
<music fileName="" />
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.
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="" />
bufferName | Name of the buffer to load. |
Definition at line 143 of file SoundSourceComponent.cpp.
void SoundSourceComponent::onPause | ( | void * | p | ) |
Pauses the component if the parent is paused.
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.
Definition at line 399 of file SoundSourceComponent.cpp.
void SoundSourceComponent::onSound | ( | void * | p | ) |
Responds to changes of the sound data attached to this component.
Definition at line 425 of file SoundSourceComponent.cpp.
void SoundSourceComponent::onUnPause | ( | void * | p | ) |
Unpauses the component if the parent is unpaused.
Definition at line 418 of file SoundSourceComponent.cpp.
bool SoundSourceComponent::parseXML | ( | IXMLReader * | file, | |
Entity * | entity | |||
) | [static] |
Parses for a SoundSourceComponent.
Definition at line 455 of file SoundSourceComponent.cpp.
void SoundSourceComponent::pause | ( | ) |
void SoundSourceComponent::play | ( | ) |
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="" />
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="" />
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.
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 | ( | ) |
void SoundSourceComponent::unloadData | ( | ) |