类 | |
| class | Audio |
OpenAL audio module: device management, master listener state, and Source factory. Script: audio <- eve.Audio(); 更多... | |
| class | AudioCapabilities |
| Module-owned audio capability registrations and injected dependency lifetime. @ownership Audio owns this object; retained action clients share an invalidatable binding. @lifetime Destroy before Audio closes its device. Destruction revokes capabilities and releases client sources while Audio is still alive; later device-dependent client calls report NotFound. @thread Audio/main thread only. @reentrancy Destruction must not run inside an audio callback. 更多... | |
| struct | AudioZoneItem |
| One Pcg audio-zone track timing and gain profile. 更多... | |
| struct | AudioZoneOutput |
| Commands to apply to a caller-owned audio Source. 更多... | |
| class | AudioZoneProfile |
| Caller-owned Pcg audio-zone configuration and track list. 更多... | |
| struct | AudioZoneState |
| Persistent playback state owned by the caller. 更多... | |
| struct | PcmChunk |
| 解码后待排队的一帧 PCM 数据。 更多... | |
| class | PcmStream |
| Bounded, caller-fed PCM playback, independent of codecs and synthesis. @ownership Caller owns this object; submitted samples are copied synchronously. @lifetime Audio teardown closes outstanding streams before destroying OpenAL. Destruction of this object releases playback even while Audio remains alive. @thread All operations and destruction run on Audio's owning/main thread. @reentrancy Never invokes scripts or user callbacks. Not concurrently callable. Streams are transient: hot reload must close/recreate them, not serialize them. 更多... | |
| struct | PcmStreamInfo |
| Owning snapshot; frame counts include all channels as one sample frame. 更多... | |
| struct | PcmStreamState |
| class | Source |
| A playable audio source (static buffer or streaming decoder). Not thread-safe for playback control except fillPendingFromDecoder(), which is synchronized for the Audio worker thread. 更多... | |
枚举 | |
| enum class | AudioZonePhase : std::uint8_t { Active , BecomingInactive , Inactive } |
| AudioZonePhase public API. 更多... | |
| enum class | PcmStreamPhase { Idle , Playing , Paused , Starved , Draining , Finished , Closed } |
| Observable stream phase; starvation preserves the intent to play. 更多... | |
函数 | |
| Module_IMPL (Audio, new Audio()) | |
| Result< void > | configureAmbientBed (Source *source) |
| Configure a caller-owned Source as a non-spatial stereo/mono ambient bed. | |
| Result< void > | crossfadeSources (Source *from, Source *to, float toVolume, float durationSeconds, float now) |
| Cross-fade two caller-owned sources over an injected simulation interval. | |
| Result< AudioZoneOutput > | evaluateAudioZone (const AudioZoneProfile &profile, AudioZoneState &state, float now, float playerX, float playerY, float playerZ, float masterVolume, std::uint32_t seed) |
| Evaluate PcgAudioManager/PcgAudioZone for one explicit time and player observation. | |
| Result< void > | applyAudioZoneOutput (Source *source, const AudioZoneOutput &output) |
| Apply one evaluated command to the caller-selected track Source without retaining it. | |
| void | bindAudioEventSinkOwner (Audio *owner) noexcept |
| Bind the live Audio module into the platform event pump sink. @ownership Borrowed; cleared when the Audio module is destroyed. @lifetime Valid from Audio construction until Audio destruction. | |
| void | exposePcmStream (ssq::Table &table, ssq::Class &audioClass) |
| Install VM-bound adapters; borrows both handles only during registration. | |
| Result< void > | applyUnderwaterAudio (Source *submergeDown, Source *submergeUp, Source *ambience, bool playDown, bool playUp, bool loopAmbience, float volume, float fadeSeconds, float now) |
| Apply one Pcg underwater audio transition to caller-owned sources. | |
变量 | |
| constexpr int | kStreamBufferCount = 4 |
| 流式 Source 的 OpenAL 缓冲数量。 | |
| constexpr int | kStreamBufferFrames = 4096 |
| 每个流式缓冲的采样帧数。 | |
枚举类型说明
◆ AudioZonePhase
|
strong |
◆ PcmStreamPhase
|
strong |
Observable stream phase; starvation preserves the intent to play.
| 枚举值 | |
|---|---|
| Idle | |
| Playing | |
| Paused | |
| Starved | |
| Draining | |
| Finished | |
| Closed | |
在文件 PcmStream.h 第 20 行定义.
函数说明
◆ applyAudioZoneOutput()
| EVENGINE_API_BACKENDS Result< void > eve::audio::applyAudioZoneOutput | ( | Source * | source, |
| const AudioZoneOutput & | output | ||
| ) |
Apply one evaluated command to the caller-selected track Source without retaining it.
在文件 AudioZone.cpp 第 121 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, output, source , 以及 eve::Result< T >::success().
◆ applyUnderwaterAudio()
| EVENGINE_API_BACKENDS Result< void > eve::audio::applyUnderwaterAudio | ( | Source * | submergeDown, |
| Source * | submergeUp, | ||
| Source * | ambience, | ||
| bool | playDown, | ||
| bool | playUp, | ||
| bool | loopAmbience, | ||
| float | volume, | ||
| float | fadeSeconds, | ||
| float | now | ||
| ) |
Apply one Pcg underwater audio transition to caller-owned sources.
- 参数
-
submergeDown Optional one-shot source played when playDown is true. submergeUp Optional one-shot source played when playUp is true. ambience Required looping underwater ambience source. playDown Whether to play the downward transition once. playUp Whether to play the upward transition once. loopAmbience Whether ambience should be playing after this call. volume Normalized transition and ambience gain in [0,1]. fadeSeconds Ambience ramp length; 0 keeps hard cuts. Caller must advanceFade(now). now Absolute simulation time in seconds for ambience fades.
- 返回
- Success or InvalidArgument; validation completes before source mutation. @ownership Sources remain caller-owned and are never retained. @thread Audio owner thread only; callbacks are not invoked.
在文件 UnderwaterAudio.cpp 第 9 行定义.
引用了 eve::Diagnostic::error(), eve::audio::Source::fadeOutAndStop(), eve::audio::Source::fadeTo(), eve::Result< T >::failure(), eve::InvalidArgument, eve::audio::Source::isPlaying(), eve::audio::Source::play(), eve::audio::Source::setLooping(), eve::audio::Source::setVolume(), eve::audio::Source::stop(), eve::Result< T >::success() , 以及 volume.
◆ bindAudioEventSinkOwner()
|
noexcept |
Bind the live Audio module into the platform event pump sink. @ownership Borrowed; cleared when the Audio module is destroyed. @lifetime Valid from Audio construction until Audio destruction.
在文件 EventSink.cpp 第 36 行定义.
引用了 owner.
被这些函数引用 eve::audio::Audio::Audio() , 以及 eve::audio::Audio::~Audio().
◆ configureAmbientBed()
| EVENGINE_API_BACKENDS Result< void > eve::audio::configureAmbientBed | ( | Source * | source | ) |
Configure a caller-owned Source as a non-spatial stereo/mono ambient bed.
Sets spatialBlend=0 (relative, rolloff 0) and balance=0. Keeps channel layout. @ownership Source remains caller-owned and is never retained. @thread Audio owner thread only; no callbacks.
在文件 AudioAmbient.cpp 第 7 行定义.
引用了 blend, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, source , 以及 eve::Result< T >::success().
◆ crossfadeSources()
| EVENGINE_API_BACKENDS Result< void > eve::audio::crossfadeSources | ( | Source * | from, |
| Source * | to, | ||
| float | toVolume, | ||
| float | durationSeconds, | ||
| float | now | ||
| ) |
Cross-fade two caller-owned sources over an injected simulation interval.
- 参数
-
from Source that fades out and stops. to Source that starts (or continues) and fades in to toVolume. toVolume Destination user volume for to(>= 0).durationSeconds Non-negative ramp length shared by both sides. now Absolute simulation time in seconds.
- 返回
- Success after both fades are armed; callers must advanceFade(now) each frame. @ownership Sources remain caller-owned and are never retained. @cost Arms two fades and may start playback on
to; reuse sources across transitions. @thread Audio owner thread only; no callbacks.
在文件 AudioFade.cpp 第 9 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), from, eve::InvalidArgument , 以及 to.
◆ evaluateAudioZone()
| EVENGINE_API_BACKENDS Result< AudioZoneOutput > eve::audio::evaluateAudioZone | ( | const AudioZoneProfile & | profile, |
| AudioZoneState & | state, | ||
| float | now, | ||
| float | playerX, | ||
| float | playerY, | ||
| float | playerZ, | ||
| float | masterVolume, | ||
| std::uint32_t | seed | ||
| ) |
Evaluate PcgAudioManager/PcgAudioZone for one explicit time and player observation.
- 参数
-
profile Immutable zone configuration. state Caller-owned playback state, atomically updated on success. now Absolute simulation time in seconds. playerX Player world position. playerY Player world position. playerZ Player world position. masterVolume Pcg master-volume ceiling. seed Named audio-zone RNG stream seed used when a new track starts.
在文件 AudioZone.cpp 第 42 行定义.
引用了 Active, BecomingInactive, dx, dy, dz, eve::Diagnostic::error(), eve::Result< T >::failure(), Inactive, eve::InvalidArgument, out, p, px, py, pz, seed, state, eve::Result< T >::success(), unit , 以及 volume.
◆ exposePcmStream()
| void eve::audio::exposePcmStream | ( | ssq::Table & | table, |
| ssq::Class & | audioClass | ||
| ) |
Install VM-bound adapters; borrows both handles only during registration.
在文件 PcmStream.cpp 第 200 行定义.
引用了 channels, eve::audio::PcmStream::close(), cls, eve::Diagnostic::error(), eve::audio::PcmStream::finishInput(), eve::audio::PcmStream::getInfo(), info, eve::InvalidArgument, eve::script::makeOwnedSquirrelInstance(), eve::audio::PcmStream::maxBlockFrames, n, owned, eve::audio::PcmStream::pause(), eve::audio::PcmStream::play(), eve::script::projectResult(), eve::script::projectStatusResult(), rate, eve::audio::PcmStream::reset(), result, snapshot, eve::audio::PcmStream::submit(), eve::Status::success(), values , 以及 vm.
◆ Module_IMPL()
| eve::audio::Module_IMPL | ( | Audio | , |
| new | Audio() | ||
| ) |
变量说明
◆ kStreamBufferCount
|
constexpr |
◆ kStreamBufferFrames
|
constexpr |
每个流式缓冲的采样帧数。
在文件 AudioTypes.h 第 13 行定义.