Skip to content

Engine → Audio

clip.h

Clips. A pcm_buffer is immutable once built and shared between the clip asset and every voice playing it through std::shared_ptr, so a voice keeps playing the old samples after a hot reload swaps the clip. audio_clip is the payload of the conjure.audio.clip asset type declared at the end of this header.

Structs

File Description
audio_clip The conjure.audio.clip payload: info plus one of two shared buffers (PCM samples, or the original encoded file for STREAMED storage).
clip_info What is known about a clip without touching its samples.

Classes

File Description
pcm_buffer Interleaved f32 frames. Immutable after construction; shared by the clip and its voices.

Constants

Name Type Value Description
CLIP_ASSET_TYPE_NAME inline constexpr std::string_view "conjure.audio.clip" Registered name of the clip asset type.

Macros

CONJURE_DECLARE_ASSET_TYPE

CONJURE_DECLARE_ASSET_TYPE(conjure::audio::audio_clip, "conjure.audio.clip")

Functions

Public

make_fallback_clip

[[nodiscard]] CONJURE_API audio_clip make_fallback_clip();

The silent fallback clip: 0.1 s of mono 48 kHz zeros.

make_pcm_clip

[[nodiscard]] CONJURE_API audio_clip make_pcm_clip(
    std::shared_ptr<const pcm_buffer> pcm,
    clip_encoding encoding = clip_encoding::WAV);

Builds a clip around a PCM buffer, filling info from the buffer (encoding WAV, storage PCM).