49 if (frame ==
nullptr) {
52 if (frame->
data ==
nullptr) {
56 if (container_bytes == 0U) {
71 if (frame->
valid_bits > (container_bytes * 8U)) {
74 const uint64_t required =
76 if (required > (uint64_t)UINT32_MAX) {
79 if (frame->
bytes != (uint32_t)required) {
87 if (source ==
nullptr) {
90 if (out_info ==
nullptr) {
94 if (source->
iface ==
nullptr) {
165 if (source ==
nullptr) {
168 if (buffer ==
nullptr) {
171 if (out_frame ==
nullptr) {
175 if (source->
iface ==
nullptr) {
181 if (buffer->
data ==
nullptr) {
211 if (out_frame->
data != buffer->
data) {
233 if (source ==
nullptr) {
236 if (buffer ==
nullptr) {
239 if (callback ==
nullptr) {
242 if (buffer->
data ==
nullptr) {
245 if (source->
iface ==
nullptr) {
267 if (source ==
nullptr) {
270 if (source->
iface ==
nullptr) {
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_err_t ra8_audio_source_get_info(ra8_audio_source_t *source, ra8_audio_source_info_t *out_info)
Query a bound source's fixed output contract.
ra8_err_t ra8_audio_source_stop(ra8_audio_source_t *source)
Stop and release a bound source backend.
ra8_err_t ra8_audio_frame_validate(const ra8_audio_frame_t *frame)
Validate one PCM frame view.
static ra8_err_t internal_audio_frame_matches_info(const ra8_audio_frame_t *frame, const ra8_audio_source_info_t *info)
Verify a captured frame matches its source metadata.
static ra8_err_t internal_audio_capture_args_valid(const ra8_audio_source_t *source, const ra8_audio_buffer_t *buffer, ra8_audio_frame_t *out_frame)
Validate capture arguments before touching source geometry.
static uint32_t internal_audio_container_bytes(ra8_audio_format_t format)
Return the PCM container width in bytes.
ra8_err_t ra8_audio_source_capture(ra8_audio_source_t *source, const ra8_audio_buffer_t *buffer, ra8_audio_frame_t *out_frame)
Capture one fixed-size PCM frame into caller-owned storage.
ra8_err_t ra8_audio_source_stream_start(ra8_audio_source_t *source, const ra8_audio_buffer_t *buffer, ra8_audio_frame_callback_t callback, void *ctx)
Start asynchronous fixed-frame delivery into caller-owned scratch.
Transport-neutral, caller-owned audio capture facade.
void(* ra8_audio_frame_callback_t)(void *ctx, const ra8_audio_frame_t *frame)
Complete-frame callback for asynchronous audio sources.
ra8_audio_format_t
PCM container layouts supported by the facade.
@ k_ra8_audio_format_pcm_s32le
Signed 32-bit little-endian PCM.
@ k_ra8_audio_format_pcm_s16le
Signed 16-bit little-endian PCM.
Private audio-source vtable shared by concrete backends.
@ k_ra8_err_not_supported
Requested feature not compiled in, not wired, or not supported by this MCU variant.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_err_not_initialized
Module not initialized – _init() not yet called successfully.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
@ k_ra8_err_invalid_size
Invalid size parameter (too large, too small, or misaligned).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Caller-owned writable byte buffer.
uint32_t capacity
Writable capacity in bytes.
void * data
First writable byte.
Immutable view of one interleaved PCM frame.
uint32_t bytes
Valid byte count.
ra8_audio_format_t format
PCM container layout.
uint32_t sample_count
Sample frames per channel.
uint8_t channels
Interleaved channel count.
uint32_t sample_rate_hz
Sample frames per second.
const void * data
Borrowed interleaved PCM bytes.
uint8_t valid_bits
Significant bits per sample.
ra8_err_t(* get_info)(void *ctx, ra8_audio_source_info_t *out_info)
Query output.
ra8_err_t(* capture)(void *ctx, const ra8_audio_buffer_t *buffer, ra8_audio_frame_t *out_frame)
Capture PCM.
ra8_err_t(* stream_start)(void *ctx, const ra8_audio_buffer_t *buffer, ra8_audio_frame_callback_t callback, void *callback_ctx)
Start streaming.
ra8_err_t(* stop)(void *ctx)
Stop backend.
Fixed output contract and storage requirement for one source.
uint8_t valid_bits
Significant bits per sample.
uint32_t samples_per_frame
Sample frames returned per call.
ra8_audio_format_t format
PCM container layout.
uint32_t frame_bytes
Required capture-buffer capacity.
uint32_t sample_rate_hz
Sample frames per second.
uint8_t channels
Interleaved channel count.
Caller-owned handle binding an audio source backend and its state.
const ra8_audio_source_iface_t * iface
Bound source vtable (private).
void * ctx
Caller-owned backend state.