![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <SoundEffect.hpp>
Public Member Functions | |
SoundEffect (Object &object) | |
Constructor. More... | |
~SoundEffect () | |
Destructor. More... | |
void | update (const float deltaTime) override |
Update. More... | |
SoundEffect & | setBuffer (const SoundBuffer &buffer) |
Set the sound buffer. More... | |
SoundEffect & | play () |
Play sound. More... | |
SoundEffect & | playReset () |
Play sound from start. More... | |
SoundEffect & | stop () |
Stop playing sound. More... | |
SoundEffect & | pause () |
Pause sound. More... | |
SoundEffect & | setOffset (const float time) |
Set from which point the sound starts playing. More... | |
float | getOffset () const |
Returns point where sound is playing. More... | |
SoundEffect & | setLoop (const bool loop) |
Enable/disable looping. More... | |
bool | isLooping () const |
Check if this sound is looping. More... | |
![]() | |
SoundSource (Object &object, const uint32 ID) | |
Constructor. More... | |
virtual | ~SoundSource () override=0 |
Virtual destructor. More... | |
void | update (const float deltaTime) override |
Update. More... | |
SoundSource & | setVolume (const float vol) |
Set sound's volume. More... | |
float | getVolume () const |
Get the volume. More... | |
SoundSource & | setPitch (const float value) |
Set pitch. More... | |
float | getPitch () const |
Get the pitch. More... | |
SoundSource & | setSpatialization (const bool toggle) |
Toggle listener on/off. More... | |
bool | isSpatialized () const |
Returns relativity to listener. More... | |
SoundSource & | setAttenuation (const float at) |
Change sound's fade-out distance. More... | |
SoundSource & | setMinDistance (const float min) |
Change sound's distance when it is heard in max volume. More... | |
float | getAttenuation () const |
Returns attenuation value. More... | |
float | getMinDistance () const |
Returns distance of max volume. More... | |
Status | getStatus () const |
Returns status of the sound (Stopped,Paused,Playing) More... | |
SoundSource & | useDirection (const bool use) |
Use object's direction for sound. More... | |
bool | isDirection () const |
Check if sound has direction. 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... | |
Additional Inherited Members | |
![]() | |
enum | Status { Status::Stopped, Status::Paused, Status::Playing } |
![]() | |
SoundSource (const SoundSource &other, Object &newObj) | |
Copy constructor. More... | |
JOP_DISALLOW_COPY_MOVE (SoundSource) | |
![]() | |
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... | |
![]() | |
static bool | isSpeedOfSound () |
Private check is speed of sound calculated. More... | |
![]() | |
unsigned int | m_source |
Sound source. More... | |
float | m_delayCounter |
Sound's propagation delay. More... | |
bool | m_calculateDelay |
Check if delay should be calculated. More... | |
Audio component that plays sound
Definition at line 36 of file SoundEffect.hpp.
jop::SoundEffect::SoundEffect | ( | Object & | object | ) |
Constructor.
object | Reference to the object this component will be bound to |
jop::SoundEffect::~SoundEffect | ( | ) |
Destructor.
float jop::SoundEffect::getOffset | ( | ) | const |
Returns point where sound is playing.
bool jop::SoundEffect::isLooping | ( | ) | const |
Check if this sound is looping.
SoundEffect& jop::SoundEffect::pause | ( | ) |
SoundEffect& jop::SoundEffect::play | ( | ) |
Play sound.
SoundEffect& jop::SoundEffect::playReset | ( | ) |
SoundEffect& jop::SoundEffect::setBuffer | ( | const SoundBuffer & | buffer | ) |
Set the sound buffer.
buffer | Reference to the buffer |
SoundEffect& jop::SoundEffect::setLoop | ( | const bool | loop | ) |
Enable/disable looping.
If looping is enabled, the sound will loop indefinitely until stopped.
loop | True to set this sound to loop |
SoundEffect& jop::SoundEffect::setOffset | ( | const float | time | ) |
Set from which point the sound starts playing.
The value will be clamped to fit the buffer's length.
time | The time point as seconds |
SoundEffect& jop::SoundEffect::stop | ( | ) |
|
overridevirtual |
Update.
Automatically updates position.
deltaTime | The delta time |
Reimplemented from jop::Component.