audio_types.h
| File Path | engine/include/conjure/audio/audio_types.h |
| API ↗ | Playing sounds |
Formats, identifiers and constants shared by every audio header. The mixer renders interleaved f32 stereo at audio_settings::sampleRate; every other format is converted by the backend (miniaudio) or at import (decoder).
Structs
| File | Description |
|---|---|
audio_format |
Sample rate, channel count and sample format of a buffer or of the mixer output. |
Enumerations
attenuation_model
Distance attenuation curve of a spatial voice.
audio_backend_kind
Which backend audio_engine talks to. AUTO picks MINIAUDIO when it is compiled in and falls back to NULL_BACKEND when no device can be opened.
clip_encoding
Container / codec of the source file a clip was imported from.
clip_storage
How a clip keeps its samples: decoded at import (PCM) or decoded incrementally while playing from the compressed bytes kept in memory (STREAMED).
device_state
Device state published by a backend (atomic, readable from any thread).
sample_format
Sample format of pcm_buffer and of the mixer. F32 is the only one in v1.
voice_state
Lifecycle of a voice. PRIMING covers a streamed voice waiting for its first chunk and a voice waiting for a stolen mixer slot; FINISHED and STOPPED are terminal.
Constants
| Name | Type | Value | Description |
|---|---|---|---|
COMMAND_RING_CAPACITY |
inline constexpr u32 |
8192 |
|
DEFAULT_RAMP_SECONDS |
inline constexpr f32 |
0.005f |
|
DEFAULT_SPEED_OF_SOUND |
inline constexpr f32 |
343.0f |
|
EVENT_RING_CAPACITY |
inline constexpr u32 |
4096 |
|
MAX_GROUP_DEPTH |
inline constexpr u32 |
8 |
|
MAX_GROUPS |
inline constexpr u32 |
32 |
|
MAX_SAMPLE_RATE |
inline constexpr u32 |
192000 |
|
MAX_STREAMING_VOICES |
inline constexpr u32 |
32 |
|
MAX_VOICES |
inline constexpr u32 |
256 |
|
MIN_SAMPLE_RATE |
inline constexpr u32 |
8000 |
|
MIX_BLOCK_FRAMES |
inline constexpr u32 |
256 |
|
MIX_CHANNELS |
inline constexpr u32 |
2 |
|
STEAL_FADE_SECONDS |
inline constexpr f32 |
0.002f |
|
STREAM_CHUNK_FRAMES |
inline constexpr u32 |
4096 |
|
STREAM_RING_FRAMES |
inline constexpr u32 |
16384 |
Macros
CONJURE_AUDIO_ENUM_FORMATTER
Functions
Public
is_active_state
is_active_state[[nodiscard]] constexpr bool is_active_state(
voice_state state) noexcept;True for PRIMING, PLAYING and PAUSED: the states in which audio_engine::is_playing() holds.
is_terminal_state
is_terminal_state[[nodiscard]] constexpr bool is_terminal_state(
voice_state state) noexcept;True for FINISHED and STOPPED: the voice has been acknowledged as ended by the mixer.
to_string
to_string[[nodiscard]] CONJURE_API std::string_view to_string(
sample_format value) noexcept;Enumerator names ("F32", "PCM", "PLAYING", ...); "UNKNOWN" for out-of-range values.
[[nodiscard]] CONJURE_API std::string_view to_string(
clip_storage value) noexcept;[[nodiscard]] CONJURE_API std::string_view to_string(
clip_encoding value) noexcept;[[nodiscard]] CONJURE_API std::string_view to_string(
audio_backend_kind value) noexcept;[[nodiscard]] CONJURE_API std::string_view to_string(
device_state value) noexcept;[[nodiscard]] CONJURE_API std::string_view to_string(
voice_state value) noexcept;[[nodiscard]] CONJURE_API std::string_view to_string(
attenuation_model value) noexcept;