46 bool isPlaying()
const;
49 void setVolume(
float v);
51 float getVolume()
const;
53 void setPitch(
float p);
55 float getPitch()
const;
57 void setLooping(
bool l);
59 bool isLooping()
const;
62 bool seek(
double seconds);
66 double getDuration()
const;
69 void setPosition(
float x,
float y,
float z);
71 void setVelocity(
float x,
float y,
float z);
73 void setDirection(
float x,
float y,
float z);
77 [[nodiscard]]
bool isRelative() const noexcept {
return relative_; }
79 void setAttenuationDistances(
float ref,
float max);
87 [[nodiscard]]
Result<void> fadeTo(
float targetVolume,
float durationSeconds,
float now);
93 [[nodiscard]]
Result<void> fadeOutAndStop(
float durationSeconds,
float now);
105 [[nodiscard]]
bool isFading() const noexcept {
return fading_; }
122 [[nodiscard]]
float getBalance() const noexcept {
return balance_; }
125 [[nodiscard]]
Result<void> setRolloffFactor(
float factor);
130 [[nodiscard]]
int getChannelCount()
const;
142 void fillPendingFromDecoder();
147 void applyGainPitch();
149 void applyBalanceToAl();
150 ALenum alFormat()
const;
151 void ensureStaticBuffer();
152 int decoderSampleRateOr(
int fallback)
const;
153 float currentAudibleVolume() const noexcept;
154 [[nodiscard]]
Result<
void> beginFade(
float targetVolume,
float durationSeconds,
float now,
bool stopWhenSilent);
157 sound::SoundData* staticData =
nullptr;
158 sound::Decoder* decoder =
nullptr;
159 bool ownsDecoder = false;
160 bool streaming = false;
164 ALuint streamBuffers[kStreamBufferCount]{};
165 int streamBufferCount = 0;
168 float audibleVolume_ = 1.f;
170 bool looping =
false;
171 bool relative_ =
false;
172 float spatialBlend_ = 1.f;
173 float balance_ = 0.f;
174 float rolloffFactor_ = 1.f;
175 float positionX_ = 0.f;
176 float positionY_ = 0.f;
177 float positionZ_ = 0.f;
178 bool balanceUsesStereoAngles_ =
false;
179 bool balanceUsesMonoPosition_ =
false;
181 bool fading_ =
false;
182 bool stopWhenSilent_ =
false;
183 float fadeWeight_ = 1.f;
184 float fadeFrom_ = 1.f;
185 float fadeToVolume_ = 1.f;
186 float fadeStart_ = 0.f;
187 float fadeEnd_ = 0.f;
192 mutable std::mutex decoderMutex;
194 std::mutex pendingMutex;
196 std::atomic<bool> playing{
false};
197 std::atomic<bool> wantsData{
false};
std::vector< QuestEvent > pending
#define EVENGINE_API_BACKENDS
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
OpenAL audio module: device management, master listener state, and Source factory....
A playable audio source (static buffer or streaming decoder). Not thread-safe for playback control ex...
float getSpatialBlend() const noexcept
Returns the spatial blend in [0,1].
bool isFading() const noexcept
True while a fade envelope is active.
bool isStreaming() const
True when streaming.
float getBalance() const noexcept
Returns the balance in [-1,1].
bool isRelative() const noexcept
True when the source is head-relative.
float getFadeWeight() const noexcept
Fade progress in [0,1]; 1 when idle.
float getRolloffFactor() const noexcept
Returns the rolloff factor.
Streaming audio decoder (medialoader-backed). Native builds own encoded bytes and decode incrementall...
Raw PCM audio buffer with format metadata (samples/rate/bit depth/channels).
Build metadata (engine git commit, build time, third-party version).