Engine → Audio → null_backend.h
null_backend
| Type | Class |
| Namespace | conjure::audio |
| Include File Path | engine/include/conjure/audio/null_backend.h |
| Source File Path | engine/src/audio/null_backend.cpp |
| API ↗ | Clips and decoding |
Syntax
Inheritance Hierarchy
audio_backend → null_backend
Constructors
| Access | Signature | Description |
|---|---|---|
| public | null_backend(); |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~null_backend() override; |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mCaptured | std::vector<f32> | {} | |
| private | m | u32 | 0 | |
| private | mDesc | backend_desc | {} | |
| private | m | u32 | 0 | |
| private | m | f64 | 0.0 | |
| private | m | std::vector<f32> | {} | |
| private | mState | std:: | device_ | |
| private | mStats | null_backend_stats | {} |
Functions
Public
captured
captured[[nodiscard]] std::span<const f32> captured() const noexcept;The captured frames, oldest first, interleaved stereo.
enumerate_devices
enumerate_devices[[nodiscard]] core::result<std::vector<audio_device_info>> enumerate_devices() const override;One device, "Null Output", 48000 Hz stereo, default.
fail_next_starts
fail_next_startsvoid fail_next_starts(
u32 count) noexcept;Tests: the next count start() calls fail with DEVICE_START_FAILED and leave the backend STOPPED, like a device that cannot be reopened after a loss.
kind
kind[[nodiscard]] audio_backend_kind kind() const noexcept override;output_format
output_format[[nodiscard]] audio_format output_format() const noexcept override;render_frames
render_framesvoid render_frames(
u32 frameCount);Renders exactly frameCount frames, ignoring the clock. Tests use it to step by block.
set_capture_frames
set_capture_framesvoid set_capture_frames(
u32 frames);Tests: keep the last frames rendered stereo f32 frames for inspection (0 disables).
simulate_device_loss
simulate_device_lossvoid simulate_device_loss() noexcept;Tests: publishes device_state::LOST, as the miniaudio notification callback does when the OS stops a device. Nothing renders until the next successful start(), which is how the engine's recovery path is exercised headlessly.
start
start[[nodiscard]] core::result<void> start(
const backend_desc &desc) override;Resets the virtual clock. Fails with INVALID_SETTINGS only when desc.callback is null or desc.format.sampleRate is outside [MIN_SAMPLE_RATE, MAX_SAMPLE_RATE], and with DEVICE_START_FAILED while a fail_next_starts() budget remains.
state
state[[nodiscard]] device_state state() const noexcept override;stats
stats[[nodiscard]] const null_backend_stats &stats() const noexcept;The snapshot written by the last update().
stop
stopvoid stop() noexcept override;update
updatevoid update(
f32 deltaSeconds) override;Renders round(deltaSeconds * sampleRate) frames (fraction carried to the next call) through the callback in MIX_BLOCK_FRAMES blocks. Nothing happens while stopped or for a non-positive delta.
virtual_time
virtual_time[[nodiscard]] f64 virtual_time() const noexcept;Seconds of audio rendered since start().
Private
mutable_stats
mutable_stats[[nodiscard]] null_backend_stats &mutable_stats() noexcept;