oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
Audio node types and built-in factories

Core types for audio nodes, formats, buffers, and built-in processor node factories. More...

Collaboration diagram for Audio node types and built-in factories:

Data Structures

struct  ove_audio_fmt
 Complete audio stream format descriptor. More...
 
struct  ove_audio_buf
 Audio buffer passed between nodes during graph processing. More...
 
struct  ove_audio_node_ops
 Virtual function table (vtable) for an audio processing node. More...
 
struct  ove_audio_node
 Descriptor for a single node in the audio graph. More...
 
struct  ove_audio_channel_map
 Channel routing table used by ove_audio_node_channel_map(). More...
 

Macros

#define OVE_AUDIO_MAX_CHANNELS   8
 Maximum number of audio channels supported by the channel-map node.
 

Typedefs

typedef void(* ove_audio_tap_fn) (const struct ove_audio_buf *buf, void *user_data)
 Callback invoked by the tap node for every processed buffer.
 

Enumerations

enum  ove_audio_sample_fmt { OVE_AUDIO_FMT_S16 , OVE_AUDIO_FMT_S32 , OVE_AUDIO_FMT_F32 }
 PCM sample format tag. More...
 
enum  ove_audio_node_type { OVE_AUDIO_NODE_SOURCE , OVE_AUDIO_NODE_PROCESSOR , OVE_AUDIO_NODE_SINK }
 Role of a node within the audio graph. More...
 

Functions

static unsigned int ove_audio_sample_size (enum ove_audio_sample_fmt fmt)
 Return the size in bytes of one sample for a given format.
 
static int ove_audio_fmt_equal (const struct ove_audio_fmt *a, const struct ove_audio_fmt *b)
 Test two format descriptors for equality.
 
int ove_audio_node_converter (struct ove_audio_graph *g, enum ove_audio_sample_fmt target_fmt, const char *name)
 Add a sample-format converter processor node to the graph.
 
int ove_audio_node_channel_map (struct ove_audio_graph *g, const struct ove_audio_channel_map *map, const char *name)
 Add a channel-mapping processor node to the graph.
 
int ove_audio_node_gain (struct ove_audio_graph *g, float gain_db, const char *name)
 Add a gain processor node to the graph.
 
int ove_audio_node_tap (struct ove_audio_graph *g, ove_audio_tap_fn fn, void *user_data, const char *name)
 Add a tap (observer) sink node to the graph.
 

Detailed Description

Core types for audio nodes, formats, buffers, and built-in processor node factories.

Defines the fundamental data types shared by every node in the audio graph: sample format, format descriptor, audio buffer, node vtable, and node descriptor. Also provides a small set of ready-made processor node factories (format converter, channel mapper, gain, and tap observer).

Note
Requires CONFIG_OVE_AUDIO.

Typedef Documentation

◆ ove_audio_tap_fn

typedef void(* ove_audio_tap_fn) (const struct ove_audio_buf *buf, void *user_data)

Callback invoked by the tap node for every processed buffer.

Parameters
[in]bufBuffer containing the observed audio data.
[in]user_dataOpaque pointer supplied at node creation.

Enumeration Type Documentation

◆ ove_audio_sample_fmt

PCM sample format tag.

Identifies the numeric type and bit-depth of each audio sample.

Enumerator
OVE_AUDIO_FMT_S16 

Signed 16-bit integer (int16_t).

OVE_AUDIO_FMT_S32 

Signed 32-bit integer (int32_t).

OVE_AUDIO_FMT_F32 

32-bit IEEE 754 float.

◆ ove_audio_node_type

Role of a node within the audio graph.

Enumerator
OVE_AUDIO_NODE_SOURCE 

Produces audio; has no upstream connection.

OVE_AUDIO_NODE_PROCESSOR 

Transforms audio; has one upstream connection.

OVE_AUDIO_NODE_SINK 

Consumes audio; has no downstream connection.

Function Documentation

◆ ove_audio_sample_size()

static unsigned int ove_audio_sample_size ( enum ove_audio_sample_fmt  fmt)
inlinestatic

Return the size in bytes of one sample for a given format.

Parameters
[in]fmtSample format tag.
Returns
Byte size of one sample, or 0 for an unrecognised format.

◆ ove_audio_fmt_equal()

static int ove_audio_fmt_equal ( const struct ove_audio_fmt a,
const struct ove_audio_fmt b 
)
inlinestatic

Test two format descriptors for equality.

Parameters
[in]aFirst format descriptor.
[in]bSecond format descriptor.
Returns
Non-zero if all fields match, zero otherwise.

◆ ove_audio_node_converter()

int ove_audio_node_converter ( struct ove_audio_graph g,
enum ove_audio_sample_fmt  target_fmt,
const char *  name 
)

Add a sample-format converter processor node to the graph.

Inserts a processor that converts any upstream sample format to target_fmt while preserving sample rate and channel count.

Parameters
[in]gGraph to add the node to.
[in]target_fmtDesired output sample format.
[in]nameHuman-readable name for the node.
Returns
Non-negative node index on success, negative error code on failure.
Note
Requires CONFIG_OVE_AUDIO.
See also
ove_audio_graph_add_node, ove_audio_graph_connect

◆ ove_audio_node_channel_map()

int ove_audio_node_channel_map ( struct ove_audio_graph g,
const struct ove_audio_channel_map map,
const char *  name 
)

Add a channel-mapping processor node to the graph.

Inserts a processor that reorders, duplicates, or silences channels according to map. The output channel count equals map->out_channels.

Parameters
[in]gGraph to add the node to.
[in]mapChannel routing descriptor.
[in]nameHuman-readable name for the node.
Returns
Non-negative node index on success, negative error code on failure.
Note
Requires CONFIG_OVE_AUDIO.
See also
ove_audio_node_converter

◆ ove_audio_node_gain()

int ove_audio_node_gain ( struct ove_audio_graph g,
float  gain_db,
const char *  name 
)

Add a gain processor node to the graph.

Inserts a processor that applies a fixed gain of gain_db decibels to every sample. Positive values amplify; negative values attenuate. The output format is identical to the input format.

Parameters
[in]gGraph to add the node to.
[in]gain_dbGain in decibels (e.g. -6.0f for -6 dB).
[in]nameHuman-readable name for the node.
Returns
Non-negative node index on success, negative error code on failure.
Note
Requires CONFIG_OVE_AUDIO.

◆ ove_audio_node_tap()

int ove_audio_node_tap ( struct ove_audio_graph g,
ove_audio_tap_fn  fn,
void *  user_data,
const char *  name 
)

Add a tap (observer) sink node to the graph.

Inserts a sink that calls fn for every audio buffer processed. The callback receives a pointer to the upstream buffer; data must not be stored beyond the duration of the callback.

Parameters
[in]gGraph to add the node to.
[in]fnCallback invoked each processing cycle.
[in]user_dataOpaque pointer forwarded to fn.
[in]nameHuman-readable name for the node.
Returns
Non-negative node index on success, negative error code on failure.
Note
Requires CONFIG_OVE_AUDIO.
See also
ove_audio_node_gain