![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <Listener.hpp>
Public Member Functions | |
Listener (Object &object) | |
Constructor. More... | |
void | update (const float deltaTime) override |
Update. More... | |
Listener & | setDopplerEffect (const float dop) |
Set doppler effect. More... | |
float | getDopplerEffect () const |
Get doppler effect's value. More... | |
Listener & | setDopplerEffectToDefault () |
Sets doppler effect to default. More... | |
Listener & | setSpeedOfSound (const float speed) |
Set speed for sound. More... | |
float | getSpeedOfSound () const |
Get speed of sound. More... | |
Listener & | useDopplerEffect (const bool use) |
Calculate doppler effect for sound. More... | |
Listener & | useSpeedOfSound (const bool use) |
Calculate doppler speed for sounds. More... | |
bool | isSpeedOfSound () const |
Get boolean to know if speed of sound is in use. More... | |
bool | isDopplerEffect () const |
Get boolean to know if doppler effect is in use. More... | |
Listener & | setSpeedOfSoundToDefault () |
Sets speed of sound to default. More... | |
![]() | |
virtual | ~Component ()=0 |
Virtual destructor. More... | |
Message::Result | sendMessage (const Message &message) |
Send a message to this component. More... | |
uint32 | getID () const |
Get the identifier. More... | |
void | setID (const uint32 ID) |
Set the identifier. More... | |
WeakReference< Object > | getObject () |
Get the object this component is bound to. More... | |
WeakReference< const Object > | getObject () const |
Get the object this component is bound to. More... | |
bool | isActive () const |
Check if this component is active. More... | |
void | removeSelf () |
Remove this component from its object. More... | |
Static Public Member Functions | |
static void | setGlobalVolume (const float volume) |
Change the global volume of all the sounds and musics. More... | |
static float | getGlobalVolume () |
Get the current value of the global volume. More... | |
Additional Inherited Members | |
![]() | |
Component (Object &object, const uint32 ID) | |
Constructor. More... | |
Component (const Component &other, Object &newObj) | |
Copy constructor. More... | |
virtual Message::Result | receiveMessage (const Message &message) |
Receive a message. More... | |
Handles audio's position distance and volume retrieving according to source/retriever aspect Only one instance of this class can be created at time. SFML listener can't handle multiple retrievers.
Definition at line 35 of file Listener.hpp.
jop::Listener::Listener | ( | Object & | object | ) |
Constructor.
object | Reference to the object this component will be bound to |
float jop::Listener::getDopplerEffect | ( | ) | const |
Get doppler effect's value.
|
static |
Get the current value of the global volume.
float jop::Listener::getSpeedOfSound | ( | ) | const |
Get speed of sound.
bool jop::Listener::isDopplerEffect | ( | ) | const |
Get boolean to know if doppler effect is in use.
bool jop::Listener::isSpeedOfSound | ( | ) | const |
Get boolean to know if speed of sound is in use.
Listener& jop::Listener::setDopplerEffect | ( | const float | dop | ) |
Set doppler effect.
dop | The doppler value. Default is 1 |
Listener& jop::Listener::setDopplerEffectToDefault | ( | ) |
Sets doppler effect to default.
|
static |
Change the global volume of all the sounds and musics.
The individual volume of all sounds will be multiplied by this value.
volume | Global volume in range of 0-100.0f |
Listener& jop::Listener::setSpeedOfSound | ( | const float | speed | ) |
Set speed for sound.
speed | The speed of sound. Default is 343.3 |
Listener& jop::Listener::setSpeedOfSoundToDefault | ( | ) |
Sets speed of sound to default.
|
overridevirtual |
Update.
Automatically updates position, speed and direction.
deltaTime | The delta time |
Reimplemented from jop::Component.
Listener& jop::Listener::useDopplerEffect | ( | const bool | use | ) |
Calculate doppler effect for sound.
use | True to use doppler effect, false to ignore |
Listener& jop::Listener::useSpeedOfSound | ( | const bool | use | ) |
Calculate doppler speed for sounds.
use | True to use speed, false to ignore |