Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Member Functions | Static Public Member Functions | List of all members
jop::Listener Class Reference

#include <Listener.hpp>

Inheritance diagram for jop::Listener:
jop::Component

Public Member Functions

 Listener (Object &object)
 Constructor. More...
 
void update (const float deltaTime) override
 Update. More...
 
ListenersetDopplerEffect (const float dop)
 Set doppler effect. More...
 
float getDopplerEffect () const
 Get doppler effect's value. More...
 
ListenersetDopplerEffectToDefault ()
 Sets doppler effect to default. More...
 
ListenersetSpeedOfSound (const float speed)
 Set speed for sound. More...
 
float getSpeedOfSound () const
 Get speed of sound. More...
 
ListeneruseDopplerEffect (const bool use)
 Calculate doppler effect for sound. More...
 
ListeneruseSpeedOfSound (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...
 
ListenersetSpeedOfSoundToDefault ()
 Sets speed of sound to default. More...
 
- Public Member Functions inherited from jop::Component
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< ObjectgetObject ()
 Get the object this component is bound to. More...
 
WeakReference< const ObjectgetObject () 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

- Protected Member Functions inherited from jop::Component
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

jop::Listener::Listener ( Object object)

Constructor.

Parameters
objectReference to the object this component will be bound to

Member Function Documentation

float jop::Listener::getDopplerEffect ( ) const

Get doppler effect's value.

Returns
Float multiplier of doppler effect
static float jop::Listener::getGlobalVolume ( )
static

Get the current value of the global volume.

Returns
The global volume
float jop::Listener::getSpeedOfSound ( ) const

Get speed of sound.

Returns
Speed as meters per second
bool jop::Listener::isDopplerEffect ( ) const

Get boolean to know if doppler effect is in use.

Returns
True if using doppler effect
bool jop::Listener::isSpeedOfSound ( ) const

Get boolean to know if speed of sound is in use.

Returns
True if using speed of sound
Listener& jop::Listener::setDopplerEffect ( const float  dop)

Set doppler effect.

Parameters
dopThe doppler value. Default is 1
Listener& jop::Listener::setDopplerEffectToDefault ( )

Sets doppler effect to default.

Returns
Reference to self
static void jop::Listener::setGlobalVolume ( const float  volume)
static

Change the global volume of all the sounds and musics.

The individual volume of all sounds will be multiplied by this value.

Parameters
volumeGlobal volume in range of 0-100.0f
See also
getGlobalVolume
Listener& jop::Listener::setSpeedOfSound ( const float  speed)

Set speed for sound.

Parameters
speedThe speed of sound. Default is 343.3
Returns
Reference to self
Listener& jop::Listener::setSpeedOfSoundToDefault ( )

Sets speed of sound to default.

Returns
Reference to self
void jop::Listener::update ( const float  deltaTime)
overridevirtual

Update.

Automatically updates position, speed and direction.

Parameters
deltaTimeThe delta time

Reimplemented from jop::Component.

Listener& jop::Listener::useDopplerEffect ( const bool  use)

Calculate doppler effect for sound.

Parameters
useTrue to use doppler effect, false to ignore
Returns
Reference to self
Listener& jop::Listener::useSpeedOfSound ( const bool  use)

Calculate doppler speed for sounds.

Parameters
useTrue to use speed, false to ignore
Returns
Reference to self

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