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 | 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. | |
Static Public Member Functions | |
static SoundSourceComponent * | refFactory (Entity *parent) |
Will be used to instanciate objects of this class. |
Definition at line 26 of file SoundSourceComponent.h.
SoundSourceComponent::SoundSourceComponent | ( | Entity * | parent | ) |
Constructor.
parent | The parent entity to which the component should be added. |
Definition at line 23 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 235 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 68 of file SoundSourceComponent.cpp.
f32 SoundSourceComponent::getOffset | ( | ) | const |
Gets the current playing position of the sound.
Definition at line 266 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 62 of file SoundSourceComponent.cpp.
f32 SoundSourceComponent::getVolume | ( | ) | const |
bool SoundSourceComponent::loadMusic | ( | const std::string & | fileName | ) |
Loads the sound data as a music (streaming) object.
fileName | Filename of the music object to load. |
Definition at line 74 of file SoundSourceComponent.cpp.
bool SoundSourceComponent::loadSoundBuffer | ( | const std::string & | bufferName | ) |
Loads the sound data from a sound buffer.
bufferName | Name of the buffer to load. |
Definition at line 110 of file SoundSourceComponent.cpp.
void SoundSourceComponent::onPause | ( | void * | p | ) |
Pauses the component if the parent is paused.
Definition at line 370 of file SoundSourceComponent.cpp.
void SoundSourceComponent::onPositionChange | ( | void * | p | ) |
Updates the position of the component after its parent has been updated.
Definition at line 358 of file SoundSourceComponent.cpp.
void SoundSourceComponent::onUnPause | ( | void * | p | ) |
Unpauses the component if the parent is unpaused.
Definition at line 377 of file SoundSourceComponent.cpp.
void SoundSourceComponent::pause | ( | ) |
void SoundSourceComponent::play | ( | ) |
SoundSourceComponent * SoundSourceComponent::refFactory | ( | Entity * | parent | ) | [static] |
Will be used to instanciate objects of this class.
Reimplemented from EntityComponent.
Definition at line 56 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.
attenuation | New attenuation factor. |
Definition at line 288 of file SoundSourceComponent.cpp.
void SoundSourceComponent::setLoop | ( | bool | value | ) |
Sets the sound loop state.
value | If true, the sound loops. Else the sound doesn't loop. |
Definition at line 300 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.
Definition at line 313 of file SoundSourceComponent.cpp.
void SoundSourceComponent::setOffset | ( | f32 | offset | ) |
Sets the current playing position of the sound.
Definition at line 326 of file SoundSourceComponent.cpp.
void SoundSourceComponent::setPitch | ( | f32 | pitch | ) |
void SoundSourceComponent::setVolume | ( | f32 | volume | ) |
void SoundSourceComponent::stop | ( | ) |
void SoundSourceComponent::unloadData | ( | ) |