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

#include <SoundStream.hpp>

Inheritance diagram for jop::SoundStream:
jop::SoundSource jop::Component

Public Member Functions

 SoundStream (Object &object)
 Constructor. More...
 
 ~SoundStream ()
 destructor More...
 
void update (const float deltaTime) override
 Update. More...
 
bool setPath (const std::string &path)
 Stream audio from file. More...
 
SoundStreamplay ()
 
SoundStreamplayReset ()
 Play sound. More...
 
SoundStreamstop ()
 Stop playing sound. More...
 
SoundStreampause ()
 Pause sound. More...
 
SoundStreamsetOffset (const float time)
 Set from which point the sound starts playing. More...
 
float getOffset ()
 Returns point where sound is playing. More...
 
SoundStreamsetLoop (const bool loop)
 Enable/disable looping. More...
 
bool isLooping () const
 Check if this sound is looping. More...
 
- Public Member Functions inherited from jop::SoundSource
 SoundSource (Object &object, const uint32 ID)
 Constructor. More...
 
virtual ~SoundSource () override=0
 Virtual destructor. More...
 
SoundSourcesetVolume (const float vol)
 Set sound's volume. More...
 
float getVolume () const
 Get the volume. More...
 
SoundSourcesetPitch (const float value)
 Set pitch. More...
 
float getPitch () const
 Get the pitch. More...
 
SoundSourcesetSpatialization (const bool toggle)
 Toggle listener on/off. More...
 
bool isSpatialized () const
 Returns relativity to listener. More...
 
SoundSourcesetAttenuation (const float at)
 Change sound's fade-out distance. More...
 
SoundSourcesetMinDistance (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...
 
SoundSourceuseDirection (const bool use)
 Use object's direction for sound. More...
 
bool isDirection () const
 Check if sound has direction. 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...
 

Additional Inherited Members

- Public Types inherited from jop::SoundSource
enum  Status { Status::Stopped, Status::Paused, Status::Playing }
 
- Protected Member Functions inherited from jop::SoundSource
 SoundSource (const SoundSource &other, Object &newObj)
 Copy constructor. More...
 
 JOP_DISALLOW_COPY_MOVE (SoundSource)
 
- 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...
 
- Static Protected Member Functions inherited from jop::SoundSource
static bool isSpeedOfSound ()
 Private check is speed of sound calculated. More...
 
- Protected Attributes inherited from jop::SoundSource
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...
 

Detailed Description

Definition at line 41 of file SoundStream.hpp.

Constructor & Destructor Documentation

jop::SoundStream::SoundStream ( Object object)

Constructor.

Parameters
objectReference to the object this component will be bound to
jop::SoundStream::~SoundStream ( )

destructor

Member Function Documentation

float jop::SoundStream::getOffset ( )

Returns point where sound is playing.

Returns
The playing offset in seconds
bool jop::SoundStream::isLooping ( ) const

Check if this sound is looping.

Returns
True if looping
SoundStream& jop::SoundStream::pause ( )

Pause sound.

The playing offset will be left at the current position.

Returns
Reference to self
See also
play()
stop()
This method is exposed as command named pauseEffect
SoundStream& jop::SoundStream::play ( )

SoundStream& jop::SoundStream::playReset ( )

Play sound.

Returns
Reference to self
This method is exposed as command named playEffect
SoundStream& jop::SoundStream::setLoop ( const bool  loop)

Enable/disable looping.

If looping is enabled, the sound will loop indefinitely until stopped.

Parameters
loopTrue to set this sound to loop
Returns
Reference to self
This method is exposed as command named setEffectLoop

If sound is small enough for one buffer, loop might be ignored due to buffer queue ending before loop check.

SoundStream& jop::SoundStream::setOffset ( const float  time)

Set from which point the sound starts playing.

The value will be clamped to fit the buffer's length.

Parameters
timeThe time point as seconds
Returns
Reference to self
This method is exposed as command named setEffectOffset
bool jop::SoundStream::setPath ( const std::string &  path)

Stream audio from file.

This will not start playing the stream. You must call play() in addition.

Parameters
pathPath to audio file
Returns
True if loaded successfully
SoundStream& jop::SoundStream::stop ( )

Stop playing sound.

After this call, the playing offset will be at the beginning.

Returns
Reference to self
See also
play()
pause()
This method is exposed as command named stopEffect
void jop::SoundStream::update ( const float  deltaTime)
overridevirtual

Update.

Updates offset

Parameters
deltaTimeThe delta time

Reimplemented from jop::SoundSource.


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