oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
audio.h
1/* SPDX-License-Identifier: GPL-3.0-or-later */
2
26#ifndef OVE_AUDIO_H
27#define OVE_AUDIO_H
28
29#include "ove/audio_node.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35#ifdef CONFIG_OVE_AUDIO
36
37/* ── Graph limits ───────────────────────────────────────────────── */
38
40#define OVE_AUDIO_GRAPH_MAX_NODES 16
42#define OVE_AUDIO_GRAPH_MAX_EDGES 16
43
44/* ── Edge ───────────────────────────────────────────────────────── */
45
52 unsigned int from;
53 unsigned int to;
54};
55
56/* ── Diagnostics ────────────────────────────────────────────────── */
57
65 unsigned int cycles;
66 unsigned int underruns;
67 unsigned int overruns;
68 unsigned int node_errors;
69 unsigned int max_process_us;
70 unsigned int avg_process_us;
71};
72
73/* ── Graph ──────────────────────────────────────────────────────── */
74
85
111
112/* ── Graph API ──────────────────────────────────────────────────── */
113
128 unsigned int frames_per_period);
129
142
160 const struct ove_audio_node_ops *ops,
161 void *ctx, const char *name,
162 enum ove_audio_node_type type);
163
180 unsigned int from, unsigned int to);
181
198
213
227
242
258 struct ove_audio_graph_stats *stats);
259
260#else /* !CONFIG_OVE_AUDIO */
261
262struct ove_audio_graph { int _unused; };
263
264static inline int ove_audio_graph_init(struct ove_audio_graph *g,
265 unsigned int f)
266{ (void)g; (void)f; return -5; /* OVE_ERR_NOT_SUPPORTED */ }
267static inline void ove_audio_graph_deinit(struct ove_audio_graph *g)
268{ (void)g; }
269
270#endif /* CONFIG_OVE_AUDIO */
271
272#ifdef __cplusplus
273}
274#endif
275
/* end of ove_audio group */
277
278#endif /* OVE_AUDIO_H */
ove_audio_node_type
Role of a node within the audio graph.
Definition audio_node.h:178
int ove_audio_graph_add_node(struct ove_audio_graph *g, const struct ove_audio_node_ops *ops, void *ctx, const char *name, enum ove_audio_node_type type)
Register a new node in the graph.
int ove_audio_graph_process(struct ove_audio_graph *g)
Execute one processing cycle (app-driven mode).
int ove_audio_graph_start(struct ove_audio_graph *g)
Start the audio graph.
int ove_audio_graph_init(struct ove_audio_graph *g, unsigned int frames_per_period)
Initialise an audio graph.
int ove_audio_graph_get_stats(const struct ove_audio_graph *g, struct ove_audio_graph_stats *stats)
Retrieve a snapshot of graph runtime statistics.
ove_audio_graph_state
Lifecycle state of an audio graph.
Definition audio.h:80
int ove_audio_graph_stop(struct ove_audio_graph *g)
Stop the audio graph.
#define OVE_AUDIO_GRAPH_MAX_EDGES
Maximum number of edges in a single audio graph.
Definition audio.h:42
int ove_audio_graph_connect(struct ove_audio_graph *g, unsigned int from, unsigned int to)
Connect two nodes with a directed edge.
void ove_audio_graph_deinit(struct ove_audio_graph *g)
Release all resources held by an audio graph.
#define OVE_AUDIO_GRAPH_MAX_NODES
Maximum number of nodes in a single audio graph.
Definition audio.h:40
int ove_audio_graph_build(struct ove_audio_graph *g)
Validate and compile the graph.
@ OVE_AUDIO_GRAPH_RUNNING
Graph is actively processing audio.
Definition audio.h:83
@ OVE_AUDIO_GRAPH_IDLE
Initial state; nodes may be added and connected.
Definition audio.h:81
@ OVE_AUDIO_GRAPH_READY
Build succeeded; graph may be started.
Definition audio.h:82
Audio buffer passed between nodes during graph processing.
Definition audio_node.h:97
Directed connection between two nodes in the audio graph.
Definition audio.h:51
unsigned int from
Index of the upstream (producer) node.
Definition audio.h:52
unsigned int to
Index of the downstream (consumer) node.
Definition audio.h:53
Runtime diagnostic counters for an audio graph.
Definition audio.h:64
unsigned int max_process_us
Worst-case cycle wall-clock time in microseconds.
Definition audio.h:69
unsigned int node_errors
Cumulative node process() failures.
Definition audio.h:68
unsigned int cycles
Number of completed processing cycles.
Definition audio.h:65
unsigned int avg_process_us
Rolling average cycle wall-clock time in microseconds.
Definition audio.h:70
unsigned int overruns
Source overflow events (source dropped frames).
Definition audio.h:67
unsigned int underruns
Sink starvation events (sink received no data).
Definition audio.h:66
Audio processing graph instance.
Definition audio.h:93
struct ove_audio_graph_stats stats
Accumulated runtime diagnostics.
Definition audio.h:109
struct ove_audio_edge edges[OVE_AUDIO_GRAPH_MAX_EDGES]
Registered directed edges.
Definition audio.h:97
unsigned int frames_per_period
Frame count processed per graph cycle.
Definition audio.h:106
struct ove_audio_buf buffers[OVE_AUDIO_GRAPH_MAX_NODES]
Per-node intermediate audio buffers.
Definition audio.h:103
void * buf_storage
Heap block backing all buffer data arrays.
Definition audio.h:104
unsigned int node_count
Number of valid entries in nodes[].
Definition audio.h:95
unsigned int exec_count
Number of valid entries in exec_order[].
Definition audio.h:101
struct ove_audio_node nodes[OVE_AUDIO_GRAPH_MAX_NODES]
Registered node descriptors.
Definition audio.h:94
unsigned int exec_order[OVE_AUDIO_GRAPH_MAX_NODES]
Node indices in topological execution order.
Definition audio.h:100
enum ove_audio_graph_state state
Current lifecycle state.
Definition audio.h:107
unsigned int edge_count
Number of valid entries in edges[].
Definition audio.h:98
Virtual function table (vtable) for an audio processing node.
Definition audio_node.h:112
Descriptor for a single node in the audio graph.
Definition audio_node.h:190