1 #ifndef DONUT_AUDIO_SOUND_STAGE_HPP
2 #define DONUT_AUDIO_SOUND_STAGE_HPP
430 struct EngineDeleter {
431 void operator()(
void* handle)
const noexcept;
Persistent system for playing sound in a simulated 3D arena to the default audio device.
Definition: SoundStage.hpp:56
void scheduleSoundStop(SoundInstanceId id, Time< float > timePointInSound)
Schedule for a specific sound instance to stop playing and remove itself when the playback reaches a ...
void setSoundVolume(SoundInstanceId id, float volume)
Set the volume of a specific sound instance.
bool isSoundStopped(SoundInstanceId id) const noexcept
Check if a specific sound instance has finished playing.
void fadeSoundVolume(SoundInstanceId id, float targetVolume, float fadeDuration)
Fade the volume of a specific sound instance towards a target volume over a given duration.
SoundInstanceId createPausedSoundInBackground(const Sound &sound, float volume=-1.0f)
Create a new sound instance without any panning, but don't start playing it yet.
void pauseSound(SoundInstanceId id)
Pause a specific sound instance.
void fadeVolume(float targetVolume, float fadeDuration)
Fade the global master volume of the sound stage towards a target volume over a given duration.
void scheduleSoundPause(SoundInstanceId id, Time< float > timePointInSound)
Schedule for a specific sound instance to pause itself when the playback reaches a specific time poin...
void update(Time< float > deltaTime, const Listener &listener)
Update the 3D parameters of the sound stage and advance the current time.
void setSoundPosition(SoundInstanceId id, vec3 newPosition)
Set the current 3D position of a specific sound instance.
void resumeSound(SoundInstanceId id)
Unpause and resume a specific sound instance.
void fadeSoundPlaybackSpeed(SoundInstanceId id, float targetPlaybackSpeed, float fadeDuration)
Fade the relative playback speed of a specific sound instance towards a target relative playback spee...
SoundInstanceId playSoundInBackground(const Sound &sound, float volume=-1.0f)
Create a new sound instance without any panning and start playing it.
unsigned SoundInstanceId
Opaque handle to a specific instance of a sound in the sound stage.
Definition: SoundStage.hpp:61
bool isSoundPaused(SoundInstanceId id) const noexcept
Check if a specific sound instance is currently paused.
void setSpeedOfSound(float speedOfSound)
Set the speed of sound in the sound stage.
void setSoundVelocity(SoundInstanceId id, vec3 newVelocity)
Set the current 3D velocity of a specific sound instance.
void stopSound(SoundInstanceId id)
Stop a specific sound instance and remove it.
SoundInstanceId playSound(const Sound &sound, float volume=-1.0f, vec3 position={0.0f, 0.0f, 0.0f}, vec3 velocity={0.0f, 0.0f, 0.0f})
Create a new 3D sound instance and start playing it.
void seekToSoundTime(SoundInstanceId id, Time< float > timePointInSound)
Set the current playback time point for a specific sound instance.
void setSoundPositionAndVelocity(SoundInstanceId id, vec3 newPosition, vec3 newVelocity)
Set both the 3D position and 3D velocity of a specific sound instance at the same time.
void setVolume(float volume)
Set the global master volume of the sound stage.
void setSoundPlaybackSpeed(SoundInstanceId id, float playbackSpeed)
Set the relative playback speed of a specific sound instance.
SoundStage(const SoundStageOptions &options={})
Construct a sound stage.
void setMaxSimultaneousSounds(unsigned maxSimultaneousSounds)
Set the maximum total number of sound instances that can play simultaneously.
Container for a particular sound wave that can be played in a SoundStage.
Definition: Sound.hpp:208
Current state of the sound listener, i.e.
Definition: Listener.hpp:15
Configuration options for a SoundStage.
Definition: SoundStage.hpp:16
float volume
Global master volume.
Definition: SoundStage.hpp:24
float speedOfSound
The speed of sound in the sound stage.
Definition: SoundStage.hpp:36
unsigned maxSimultaneousSounds
The maximum total number of sound instances that can play simultaneously.
Definition: SoundStage.hpp:43