载入中...
搜索中...
未找到
AudioAmbient.cpp
浏览该文件的文档.
2
3#include "audio/Source.h"
4
5namespace eve::audio {
6
8 if (!source)
10 "configureAmbientBed requires a source", "audio.ambient"));
11 auto blend = source->setSpatialBlend(0.f);
12 if (!blend.ok()) return blend;
13 auto balance = source->setBalance(0.f);
14 if (!balance.ok()) {
15 // Mono relative beds accept balance=0; stereo without angles still gets blend=0.
16 // Balance failure at 0 on unsupported formats is non-fatal for bed setup when
17 // the default OpenAL center image already applies — only fail stereo without
18 // angles if the caller later requests a non-zero pan via setBalance.
19 if (source->getChannelCount() == 2) return Result<void>::success();
20 return balance;
21 }
22 return Result<void>::success();
23}
24
25} // namespace eve::audio
float blend
std::string_view source
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
A playable audio source (static buffer or streaming decoder). Not thread-safe for playback control ex...
Definition Source.h:30
Result< void > configureAmbientBed(Source *source)
Configure a caller-owned Source as a non-spatial stereo/mono ambient bed.