iaudio 0.1.0
Contrat audio chargeable : IAudioModule
Loading...
Searching...
No Matches
audio::ISound Class Referenceabstract

#include <ISound.hpp>

Public Member Functions

virtual ~ISound ()=default
 
virtual bool isReady () const =0
 
virtual void play ()=0
 Fires the sound from the beginning.
 
virtual void pause ()=0
 Suspends the sound without touching the position.
 
virtual void stop ()=0
 Stops the sound AND rewinds to zero.
 
virtual void setVolume (float volume)=0
 set the volume of the sound
 
virtual float getVolume () const =0
 get the volume of the sound
 
virtual void setPosition (Vector3f position)=0
 set the 3D position of the sound, for backends that spatialize against a listener. A backend without real spatial audio may just store this and keep playing at full volume - a no-op here still leaves a usable sound, unlike a fake 3D model with nothing to render.
 
virtual Vector3f getPosition () const =0
 get the 3D position of the sound
 
virtual void setVelocity (Vector3f velocity)=0
 set the velocity of the sound, used by backends that apply a doppler effect
 
virtual Vector3f getVelocity () const =0
 get the velocity of the sound
 

Constructor & Destructor Documentation

◆ ~ISound()

virtual audio::ISound::~ISound ( )
virtualdefault

Member Function Documentation

◆ getPosition()

virtual Vector3f audio::ISound::getPosition ( ) const
pure virtual

get the 3D position of the sound

Returns
Vector3f

◆ getVelocity()

virtual Vector3f audio::ISound::getVelocity ( ) const
pure virtual

get the velocity of the sound

Returns
Vector3f

◆ getVolume()

virtual float audio::ISound::getVolume ( ) const
pure virtual

get the volume of the sound

Returns
float

◆ isReady()

virtual bool audio::ISound::isReady ( ) const
pure virtual

◆ pause()

virtual void audio::ISound::pause ( )
pure virtual

Suspends the sound without touching the position.

Does nothing if the sound is not playing. Idempotent.

◆ play()

virtual void audio::ISound::play ( )
pure virtual

Fires the sound from the beginning.

The ONLY deliberate divergence from IMusic::play() : an ISound is a one-shot, not a transport. play() on a sound already playing RESTARTS it from zero - that is what lets a gunshot retrigger faster than its own duration. IMusic, by contrast, ignores a play() while playing.

The difference is written here because it is intended. It cannot be guessed from the signature, and both vendors have to honour it identically.

◆ setPosition()

virtual void audio::ISound::setPosition ( Vector3f  position)
pure virtual

set the 3D position of the sound, for backends that spatialize against a listener. A backend without real spatial audio may just store this and keep playing at full volume - a no-op here still leaves a usable sound, unlike a fake 3D model with nothing to render.

Parameters
position

◆ setVelocity()

virtual void audio::ISound::setVelocity ( Vector3f  velocity)
pure virtual

set the velocity of the sound, used by backends that apply a doppler effect

Parameters
velocity

◆ setVolume()

virtual void audio::ISound::setVolume ( float  volume)
pure virtual

set the volume of the sound

Parameters
volume

◆ stop()

virtual void audio::ISound::stop ( )
pure virtual

Stops the sound AND rewinds to zero.

Does nothing if the sound is already stopped. Idempotent.


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