Skip to content

Engine → Audio

components.h

Component data the engine's audio_subsystem registers into the ECS. Plain reflected structs; this module never includes ecs. audio_source carries an assets::asset_ref<audio_clip> (an ASSET_REF field: the uuid serialises, the scene bind pass binds it); its field order is the C# AudioSourceData mirror and is pinned by the static assertions in components.cpp.

Structs

File Description
audio_listener The listener component. The first active one in iteration order drives audio_engine::set_listener.
audio_source The emitter component (88 bytes). Authored fields come first; the three hidden fields at the end are runtime state: playbackRequest is written by scripts and consumed by engine.audio_sync, isPlaying is written back by the engine, handle links the component to its voice and is TRANSIENT at ECS registration. Hidden fields still take part in the reflection JSON (core serialises every described field); the ECS serializer drops the whole component when it is TRANSIENT, and the engine resets these three on load.
source_handle Link between a component and its voice. Hidden from the inspector, never serialised.

Enumerations

audio_playback_request

enum class audio_playback_request : u8 {
    NONE = 0,
    PLAY,
    STOP,
    PAUSE,
    RESUME
};

Script-side playback command, consumed and reset to NONE by engine.audio_sync.

Constants

Name Type Value Description
ATTENUATION_MODEL_TYPE_NAME inline constexpr std::string_view "conjure.audio.attenuation_model"
AUDIO_LISTENER_TYPE_NAME inline constexpr std::string_view "conjure.audio.audio_listener"
AUDIO_SOURCE_TYPE_NAME inline constexpr std::string_view "conjure.audio.audio_source" Registered reflection names of the component types and enums.
PLAYBACK_REQUEST_TYPE_NAME inline constexpr std::string_view "conjure.audio.audio_playback_request"
SOURCE_HANDLE_TYPE_NAME inline constexpr std::string_view "conjure.audio.source_handle"

Macros

CONJURE_REFLECT_ENUM

CONJURE_REFLECT_ENUM(conjure::audio::attenuation_model, "conjure.audio.attenuation_model", NONE, INVERSE, LINEAR, EXPONENTIAL)

CONJURE_REFLECT_STRUCT

CONJURE_REFLECT_STRUCT(conjure::core::slot_key, "conjure.core.slot_key", CONJURE_FIELD(index), CONJURE_FIELD(generation))

Functions

Public

play_params_from

[[nodiscard]] CONJURE_API play_params play_params_from(
    const audio_source &source,
    group_id group) noexcept;

The play_params an audio_source describes: volume, pitch, loop, spatial, attenuation and distances copied from the fields (clamped by the engine at the API boundary), group as resolved by the caller (audio_engine::find_group(source.group)), retain = true because component voices are released by engine.audio_sync, pan 0 and the default priority.