|
libivon 0.1.0
Voice-over-IP library
|
Consumer-facing C++ wrapper around the libivon audio C ABI. More...
#include <ivon_audio_wrapper.hpp>
Classes | |
| struct | Config |
| Configuration for creating an audio processor. More... | |
| struct | NonOwning |
| Tag type for constructing a non-owning wrapper around an existing handle. More... | |
Public Types | |
| using | OutputFrame = AudioOutputFrame |
| Structured output frame info returned by try_read_output(). | |
| using | PcmSourceCallback = ::ivon::PcmSourceCallback |
| Set the PCM source callback. | |
| using | PreDspCallback = IAudio::PreDspCallback |
| using | PostSpatialCallback = IAudio::PostSpatialCallback |
| using | PostMixCallback = IAudio::PostMixCallback |
Public Types inherited from ivon::IAudio | |
| using | SpeakingEventCallback = std::function< void(const ivon_speaking_event_t &event)> |
| using | PreDspCallback = std::function< ivon_dsp_action_t(ivon_pre_dsp_context_t &ctx)> |
| using | PostSpatialCallback = std::function< ivon_dsp_action_t(ivon_post_spatial_context_t &ctx)> |
| using | PostMixCallback = std::function< ivon_dsp_action_t(ivon_post_mix_context_t &ctx)> |
Public Member Functions | |
| AudioWrapper (const Config &cfg) | |
| Construct a wrapper and create the underlying audio processor. | |
| AudioWrapper (ivon_audio_t handle, NonOwning) noexcept | |
| Construct a non-owning wrapper around an existing handle. | |
| ~AudioWrapper () | |
| AudioWrapper (const AudioWrapper &)=delete | |
| AudioWrapper & | operator= (const AudioWrapper &)=delete |
| AudioWrapper (AudioWrapper &&)=delete | |
| AudioWrapper & | operator= (AudioWrapper &&)=delete |
| void | start () override |
| Start the audio processor (tick coordinator + worker threads). | |
| void | stop () override |
| Stop the audio processor and all worker threads. | |
| bool | is_running () const noexcept override |
| Check if the audio processor is running. | |
| int | pcm_frame_size () const noexcept override |
| Get the PCM frame size in samples per channel. | |
| int | output_channels () const noexcept override |
| Get the number of output channels (e.g. 1 = mono, 2 = stereo). | |
| bool | submit_packet (uint64_t sender_id, const unsigned char *data, size_t len) override |
| Submit a received audio packet for decoding. | |
| bool | submit_packet (uint64_t sender_id, uint64_t group_id, const unsigned char *data, size_t len) override |
| Submit a received audio packet with a group tag. | |
| OutputFrame | try_read_output (float *pcm_out, size_t max_samples) override |
| Try to read a mixed output frame. | |
| void | set_pcm_source (PcmSourceCallback cb) override |
| Set the PCM source callback for local audio capture. | |
| void | start_speaking (ivon_speaking_mode_t mode=IVON_SPEAKING_MODE_PTT) override |
| Start speaking. The PCM source callback will begin firing. | |
| void | stop_speaking () override |
| Stop speaking. The PCM source callback will stop firing. | |
| bool | is_speaking () const noexcept override |
| Check if currently speaking. | |
| size_t | try_read_packet (unsigned char *data_out, size_t max_len) override |
| Try to read an encoded packet for transmission. | |
| void | on_speaking_event (SpeakingEventCallback cb) override |
| Set callback for remote speaking state changes (start/stop). | |
| void | on_pre_dsp (PreDspCallback cb) override |
| Set pre-DSP callback invoked per sender before spatial processing. | |
| void | on_post_spatial (PostSpatialCallback cb) override |
| Set post-spatial callback invoked per sender after spatial processing. | |
| void | on_post_mix (PostMixCallback cb) override |
| Set post-mix callback invoked on the final mixed output frame. | |
| void | set_sender_gain (uint64_t sender_id, float gain) override |
| Set per-sender gain. 1.0 = unity, 0.0 = silence. | |
| void | set_sender_muted (uint64_t sender_id, bool muted) override |
| Mute or unmute a sender. Muted senders are excluded from the mix. | |
| uint64_t | current_tick () const noexcept override |
| Get the current tick counter (incremented once per audio frame). | |
| int64_t | max_drift_us () const noexcept override |
| Get the maximum clock drift in microseconds since the last reset. | |
| uint64_t | dropped_ticks () const noexcept override |
| Get the total number of dropped (late) ticks. | |
| ivon_audio_stats_t | get_stats () const noexcept override |
| Get aggregate statistics snapshot. | |
| ivon_audio_t | handle () const noexcept |
Public Member Functions inherited from ivon::IAudio | |
| virtual | ~IAudio ()=default |
Consumer-facing C++ wrapper around the libivon audio C ABI.
RAII handle: the constructor creates the processor, the destructor destroys it. Non-copyable, non-moveable; use std::unique_ptr for deferred initialization or ownership transfer.
All methods delegate to the corresponding ivon_audio_* C function.
Structured output frame info returned by try_read_output().
Set the PCM source callback.
| cb | Called once per audio frame while speaking. Receives a span of float to fill with mono PCM. Return true if audio was provided, false for silence. |
|
inlineexplicit |
Construct a wrapper and create the underlying audio processor.
| std::runtime_error | if creation fails. |
|
inlineexplicitnoexcept |
Construct a non-owning wrapper around an existing handle.
|
inline |
|
delete |
|
delete |
|
inlineoverridevirtualnoexcept |
Get the current tick counter (incremented once per audio frame).
Implements ivon::IAudio.
|
inlineoverridevirtualnoexcept |
Get the total number of dropped (late) ticks.
Implements ivon::IAudio.
|
inlineoverridevirtualnoexcept |
Get aggregate statistics snapshot.
Returns decoder, encoder, and pipeline counters. Values are approximate while the processor is running.
Implements ivon::IAudio.
|
inlinenoexcept |
|
inlineoverridevirtualnoexcept |
Check if the audio processor is running.
Implements ivon::IAudio.
|
inlineoverridevirtualnoexcept |
Check if currently speaking.
Implements ivon::IAudio.
|
inlineoverridevirtualnoexcept |
Get the maximum clock drift in microseconds since the last reset.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Set post-mix callback invoked on the final mixed output frame.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Set post-spatial callback invoked per sender after spatial processing.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Set pre-DSP callback invoked per sender before spatial processing.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Set callback for remote speaking state changes (start/stop).
Implements ivon::IAudio.
|
delete |
|
delete |
|
inlineoverridevirtualnoexcept |
Get the number of output channels (e.g. 1 = mono, 2 = stereo).
Implements ivon::IAudio.
|
inlineoverridevirtualnoexcept |
Get the PCM frame size in samples per channel.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Set the PCM source callback for local audio capture.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Set per-sender gain. 1.0 = unity, 0.0 = silence.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Mute or unmute a sender. Muted senders are excluded from the mix.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Start the audio processor (tick coordinator + worker threads).
Implements ivon::IAudio.
|
inlineoverridevirtual |
Start speaking. The PCM source callback will begin firing.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Stop the audio processor and all worker threads.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Stop speaking. The PCM source callback will stop firing.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Submit a received audio packet for decoding.
Implements ivon::IAudio.
|
inlineoverridevirtual |
Submit a received audio packet with a group tag.
| sender_id | Unique identifier for the sender. |
| group_id | Group the packet belongs to (0 = untagged). |
| data | Audio payload bytes. |
| len | Length of the payload in bytes. |
Implements ivon::IAudio.
|
inlineoverridevirtual |
Try to read a mixed output frame.
| pcm_out | Buffer for interleaved float PCM. |
| max_samples | Maximum float samples the buffer can hold. |
Implements ivon::IAudio.
|
inlineoverridevirtual |
Try to read an encoded packet for transmission.
| data_out | Buffer for encoded bytes. |
| max_len | Maximum bytes the buffer can hold. |
Implements ivon::IAudio.