22#include "utility/sound/audio_source.hpp"
23#include "utility/sound/audio_manager.hpp"
34 _manager.destroyAudioSource(_sourceID);
40 _manager.submitCommand({ AudioCommandType::Play, _sourceID });
46 _manager.submitCommand({ AudioCommandType::Pause, _sourceID });
52 _manager.submitCommand({ AudioCommandType::Stop, _sourceID });
57 _buffer = std::move(buffer);
59 AudioCommand command { AudioCommandType::SetBuffer, _sourceID, {} };
61 _manager.submitCommand(command);
67 AudioCommand command { AudioCommandType::SetLooping, _sourceID, {} };
69 _manager.submitCommand(command);
75 AudioCommand command { AudioCommandType::SetPitch, _sourceID, {} };
77 _manager.submitCommand(command);
83 AudioCommand command { AudioCommandType::SetGain, _sourceID, {} };
85 _manager.submitCommand(command);
Central manager responsible for OpenAL initialization and audio resource management.
void setPitch(float pitch)
Sets the playback pitch.
void stop()
Stops audio playback.
void setGain(float gain)
Sets the playback gain.
void setBuffer(std::shared_ptr< AudioBuffer > buffer)
Assigns an audio buffer to this source.
void play()
Starts or resumes audio playback.
void pause()
Pauses audio playback.
uint32_t sourceID() const
Returns the unique identifier of this audio source.
~AudioSource()
Destroys the audio source.
AudioSource(uint32_t sourceID, AudioManager &manager)
Creates a new audio source.
void setLooping(bool loop)
Enables or disables looping playback.
Represents a command submitted to the audio thread.
CommandData data
Command-specific payload.
float gain
Gain multiplier applied to the source.
float pitch
Playback pitch multiplier.
ALuint bufferID
OpenAL buffer identifier.
bool looping
Indicates whether playback should loop.