#include <IMusic.hpp>
|
| virtual | ~IMusic ()=default |
| |
| virtual bool | isReady () const =0 |
| |
| virtual void | play ()=0 |
| | Starts playback.
|
| |
| virtual void | pause ()=0 |
| | Suspends playback without touching the position.
|
| |
| virtual void | stop ()=0 |
| | Stops playback AND rewinds to zero.
|
| |
| virtual void | update ()=0 |
| | Must be called every frame.
|
| |
| virtual void | setVolume (float volume)=0 |
| | set the volume of the music
|
| |
| virtual float | getVolume () const =0 |
| | get the volume of the music
|
| |
| virtual void | setLoop (bool loop)=0 |
| | set the music to loop or not
|
| |
| virtual bool | getLoop () const =0 |
| | get if the music is looping or not
|
| |
| virtual void | setTime (float position)=0 |
| | Set the time of the music in seconds.
|
| |
| virtual float | getTime () const =0 |
| | Get the current time of the music in seconds.
|
| |
| virtual float | getLength () const =0 |
| | Get the Length of the music.
|
| |
| virtual void | setPosition (Vector3f position)=0 |
| | set the 3D position of the music, 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 usable music, unlike a fake 3D model with nothing to render.
|
| |
| virtual Vector3f | getPosition () const =0 |
| | get the 3D position of the music
|
| |
| virtual void | setVelocity (Vector3f velocity)=0 |
| | set the velocity of the music, used by backends that apply a doppler effect
|
| |
| virtual Vector3f | getVelocity () const =0 |
| | get the velocity of the music
|
| |
◆ ~IMusic()
| virtual audio::IMusic::~IMusic |
( |
| ) |
|
|
virtualdefault |
◆ getLength()
| virtual float audio::IMusic::getLength |
( |
| ) |
const |
|
pure virtual |
Get the Length of the music.
- Returns
- float
◆ getLoop()
| virtual bool audio::IMusic::getLoop |
( |
| ) |
const |
|
pure virtual |
get if the music is looping or not
- Returns
- true
-
false
◆ getPosition()
| virtual Vector3f audio::IMusic::getPosition |
( |
| ) |
const |
|
pure virtual |
get the 3D position of the music
- Returns
- Vector3f
◆ getTime()
| virtual float audio::IMusic::getTime |
( |
| ) |
const |
|
pure virtual |
Get the current time of the music in seconds.
- Returns
- float
◆ getVelocity()
| virtual Vector3f audio::IMusic::getVelocity |
( |
| ) |
const |
|
pure virtual |
get the velocity of the music
- Returns
- Vector3f
◆ getVolume()
| virtual float audio::IMusic::getVolume |
( |
| ) |
const |
|
pure virtual |
get the volume of the music
- Returns
- float
◆ isReady()
| virtual bool audio::IMusic::isReady |
( |
| ) |
const |
|
pure virtual |
◆ pause()
| virtual void audio::IMusic::pause |
( |
| ) |
|
|
pure virtual |
Suspends playback without touching the position.
Does nothing if the stream is not playing. Idempotent.
◆ play()
| virtual void audio::IMusic::play |
( |
| ) |
|
|
pure virtual |
Starts playback.
Three states, and every action does ONLY what it says :
stopped --play()--> playing --pause()--> paused
paused --play()--> playing (resumes where it was)
stopped --play()--> playing (from zero)
play() on a stream that is already playing DOES NOTHING. It does not restart from the beginning : without that rule, a play() called every frame stutters on one vendor and plays normally on the other. To restart, call stop() then play(), or setTime(0) - explicitly.
◆ setLoop()
| virtual void audio::IMusic::setLoop |
( |
bool |
loop | ) |
|
|
pure virtual |
set the music to loop or not
- Parameters
-
◆ setPosition()
| virtual void audio::IMusic::setPosition |
( |
Vector3f |
position | ) |
|
|
pure virtual |
set the 3D position of the music, 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 usable music, unlike a fake 3D model with nothing to render.
- Parameters
-
◆ setTime()
| virtual void audio::IMusic::setTime |
( |
float |
position | ) |
|
|
pure virtual |
Set the time of the music in seconds.
The position is CLAMPED to [0, getLength()] : asking past the end stops at the end, a negative value rewinds to zero. Without that rule each vendor improvises - raylib wrapped around (115s on a 109s track gave 6s) where sfml fell to 0.
- Parameters
-
◆ setVelocity()
| virtual void audio::IMusic::setVelocity |
( |
Vector3f |
velocity | ) |
|
|
pure virtual |
set the velocity of the music, used by backends that apply a doppler effect
- Parameters
-
◆ setVolume()
| virtual void audio::IMusic::setVolume |
( |
float |
volume | ) |
|
|
pure virtual |
set the volume of the music
- Parameters
-
◆ stop()
| virtual void audio::IMusic::stop |
( |
| ) |
|
|
pure virtual |
Stops playback AND rewinds to zero.
Does nothing if the stream is already stopped. Idempotent.
◆ update()
| virtual void audio::IMusic::update |
( |
| ) |
|
|
pure virtual |
Must be called every frame.
On a backend that refills its buffer in a thread this is a no-op - the call stays mandatory and always valid, otherwise game code would have to know which vendor is behind it.
This is also where a non-looping stream that reaches its end moves itself into the state of a stop().
The documentation for this class was generated from the following file: