oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::audio::Graph Class Reference

C++ wrapper around ove_audio_graph. More...

#include <audio.hpp>

Public Member Functions

Result< void > init (unsigned int frames_per_period) noexcept
 Initialise the audio graph with the given period size.
 
template<unsigned Nodes, unsigned Frames, unsigned Channels = 1, unsigned SampleBytes = 2>
Result< void > create () noexcept
 
Result< int > add_node (const struct ove_audio_node_ops *ops, void *ctx, const char *name, enum ove_audio_node_type type) noexcept
 
Result< void > connect (unsigned int from, unsigned int to) noexcept
 Connect two nodes (output of from to input of to).
 
Result< void > build () noexcept
 Finalize the graph topology.
 
Result< void > start () noexcept
 Start audio processing.
 
Result< void > stop () noexcept
 Stop audio processing.
 
Result< void > process () noexcept
 Run one processing period through the graph.
 
Result< struct ove_audio_graph_stats > get_stats () const noexcept
 
Result< int > device_source (const struct ove_audio_device_cfg *cfg, const char *name) noexcept
 
Result< int > device_sink (const struct ove_audio_device_cfg *cfg, const char *name) noexcept
 
struct ove_audio_graph * raw ()
 Access the underlying C graph struct.
 
template<typename T >
Result< int > add_processor (T &node, const char *name)
 

Detailed Description

C++ wrapper around ove_audio_graph.

Provides RAII-style init/deinit and forwarding to the C graph API.

Member Function Documentation

◆ create()

template<unsigned Nodes, unsigned Frames, unsigned Channels = 1, unsigned SampleBytes = 2>
Result< void > ove::audio::Graph::create ( )
inlinenoexcept

Initialise the graph in a way that works for both heap and zero-heap builds. In zero-heap mode, emits a per-call-site static backing array sized by OVE_AUDIO_GRAPH_STORAGE_BYTES(Nodes, Frames, Channels, SampleBytes) and attaches it via set_buf_storage(). Mirrors the C ove_audio_graph_create macro — callers can use .init() + manual set_buf_storage() for dynamic sizing, or this helper for the common statically-known case.

All template arguments must be compile-time constants.

◆ add_node()

Result< int > ove::audio::Graph::add_node ( const struct ove_audio_node_ops *  ops,
void *  ctx,
const char *  name,
enum ove_audio_node_type  type 
)
inlinenoexcept

Add a processing node to the graph.

Returns
On success, the assigned node index. On failure, an unexpected Error.

◆ get_stats()

Result< struct ove_audio_graph_stats > ove::audio::Graph::get_stats ( ) const
inlinenoexcept

Query runtime statistics.

Returns
On success, the populated ove_audio_graph_stats.

◆ device_source()

Result< int > ove::audio::Graph::device_source ( const struct ove_audio_device_cfg *  cfg,
const char *  name 
)
inlinenoexcept

Add an audio input device as a source node.

Returns
On success, the assigned node index.

◆ device_sink()

Result< int > ove::audio::Graph::device_sink ( const struct ove_audio_device_cfg *  cfg,
const char *  name 
)
inlinenoexcept

Add an audio output device as a sink node.

Returns
On success, the assigned node index.

◆ add_processor()

template<typename T >
Result< int > ove::audio::Graph::add_processor ( T &  node,
const char *  name 
)
inline

Register a custom processor node using a typed C++ object.

T must have: int process(const ove_audio_buf *in, ove_audio_buf *out) The binding layer generates trampolines — no raw function pointers needed.

Returns
On success, the assigned node index.

The documentation for this class was generated from the following file: