|
libivon 0.1.0
Voice-over-IP library
|
Pure virtual interface for the libivon audio processor. More...
#include <ivon_audio_interface.hpp>
Public Types | |
| 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 | |
| virtual | ~IAudio ()=default |
| virtual void | start ()=0 |
| Start the audio processor (tick coordinator + worker threads). | |
| virtual void | stop ()=0 |
| Stop the audio processor and all worker threads. | |
| virtual bool | is_running () const noexcept=0 |
| Check if the audio processor is currently running. | |
| virtual bool | submit_packet (uint64_t sender_id, const unsigned char *data, size_t len)=0 |
| Submit a received audio packet for decoding. | |
| virtual bool | submit_packet (uint64_t sender_id, uint64_t group_id, const unsigned char *data, size_t len)=0 |
| Submit a received audio packet with a group tag. | |
| virtual AudioOutputFrame | try_read_output (float *pcm_out, size_t max_samples)=0 |
| Try to read a mixed output frame (non-blocking, zero-copy path). | |
| virtual void | set_pcm_source (PcmSourceCallback cb)=0 |
| Set the PCM source callback for local audio capture. | |
| virtual void | start_speaking (ivon_speaking_mode_t mode=IVON_SPEAKING_MODE_PTT)=0 |
| Start speaking (PTT activated). The PCM source callback will begin firing. | |
| virtual void | stop_speaking ()=0 |
| Stop speaking. The PCM source callback will stop firing. | |
| virtual bool | is_speaking () const noexcept=0 |
| Check if currently speaking (transmitting audio). | |
| virtual size_t | try_read_packet (unsigned char *data_out, size_t max_len)=0 |
| Try to read an encoded packet for transmission (non-blocking). | |
| virtual void | on_speaking_event (SpeakingEventCallback cb)=0 |
| Set callback for remote speaking state changes (start/stop). | |
| virtual void | on_pre_dsp (PreDspCallback cb)=0 |
| Set pre-DSP callback invoked per sender before spatial processing. | |
| virtual void | on_post_spatial (PostSpatialCallback cb)=0 |
| Set post-spatial callback invoked per sender after spatial processing. | |
| virtual void | on_post_mix (PostMixCallback cb)=0 |
| Set post-mix callback invoked on the final mixed output frame. | |
| virtual void | set_sender_gain (uint64_t sender_id, float gain)=0 |
| Set per-sender gain (1.0 = unity, 0.0 = silence). | |
| virtual void | set_sender_muted (uint64_t sender_id, bool muted)=0 |
| Mute or unmute a sender. Muted senders are excluded from the mix. | |
| virtual int | pcm_frame_size () const noexcept=0 |
| Get the PCM frame size in samples per channel. | |
| virtual int | output_channels () const noexcept=0 |
| Get the number of output channels (e.g. 1 = mono, 2 = stereo). | |
| virtual uint64_t | current_tick () const noexcept=0 |
| Get the current tick counter (incremented once per audio frame). | |
| virtual int64_t | max_drift_us () const noexcept=0 |
| Get the maximum clock drift in microseconds since the last reset. | |
| virtual uint64_t | dropped_ticks () const noexcept=0 |
| Get the total number of dropped (late) ticks. | |
| virtual ivon_audio_stats_t | get_stats () const noexcept=0 |
| Get an aggregate statistics snapshot (decoder, encoder, pipeline counters). | |
Pure virtual interface for the libivon audio processor.
Every method here must have a corresponding C ABI function in ivon_audio.h and a wrapper in ivon_audio_wrapper.hpp. Adding a new pure virtual here will cause a compile error in any class that inherits IAudio but hasn't implemented the new method, ensuring the C ABI stays synchronized with the C++ API.
| using ivon::IAudio::PostMixCallback = std::function<ivon_dsp_action_t(ivon_post_mix_context_t &ctx)> |
| using ivon::IAudio::PostSpatialCallback = std::function<ivon_dsp_action_t(ivon_post_spatial_context_t &ctx)> |
| using ivon::IAudio::PreDspCallback = std::function<ivon_dsp_action_t(ivon_pre_dsp_context_t &ctx)> |
| using ivon::IAudio::SpeakingEventCallback = std::function<void(const ivon_speaking_event_t &event)> |
|
virtualdefault |
|
pure virtualnoexcept |
Get the current tick counter (incremented once per audio frame).
Implemented in ivon::AudioWrapper.
|
pure virtualnoexcept |
Get the total number of dropped (late) ticks.
Implemented in ivon::AudioWrapper.
|
pure virtualnoexcept |
Get an aggregate statistics snapshot (decoder, encoder, pipeline counters).
Implemented in ivon::AudioWrapper.
|
pure virtualnoexcept |
Check if the audio processor is currently running.
Implemented in ivon::AudioWrapper.
|
pure virtualnoexcept |
Check if currently speaking (transmitting audio).
Implemented in ivon::AudioWrapper.
|
pure virtualnoexcept |
Get the maximum clock drift in microseconds since the last reset.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Set post-mix callback invoked on the final mixed output frame.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Set post-spatial callback invoked per sender after spatial processing.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Set pre-DSP callback invoked per sender before spatial processing.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Set callback for remote speaking state changes (start/stop).
Implemented in ivon::AudioWrapper.
|
pure virtualnoexcept |
Get the number of output channels (e.g. 1 = mono, 2 = stereo).
Implemented in ivon::AudioWrapper.
|
pure virtualnoexcept |
Get the PCM frame size in samples per channel.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Set the PCM source callback for local audio capture.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Set per-sender gain (1.0 = unity, 0.0 = silence).
Implemented in ivon::AudioWrapper.
|
pure virtual |
Mute or unmute a sender. Muted senders are excluded from the mix.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Start the audio processor (tick coordinator + worker threads).
Implemented in ivon::AudioWrapper.
|
pure virtual |
Start speaking (PTT activated). The PCM source callback will begin firing.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Stop the audio processor and all worker threads.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Stop speaking. The PCM source callback will stop firing.
Implemented in ivon::AudioWrapper.
|
pure virtual |
Submit a received audio packet for decoding.
| sender_id | Unique identifier for the remote sender. |
| data | Encoded audio payload bytes. |
| len | Length of the payload in bytes. |
Implemented in ivon::AudioWrapper.
|
pure virtual |
Submit a received audio packet with a group tag.
| sender_id | Unique identifier for the remote sender. |
| group_id | Group the packet belongs to (0 = untagged). |
| data | Encoded audio payload bytes. |
| len | Length of the payload in bytes. |
Implemented in ivon::AudioWrapper.
|
pure virtual |
Try to read a mixed output frame (non-blocking, zero-copy path).
| pcm_out | Buffer for interleaved float PCM samples. |
| max_samples | Maximum number of float samples the buffer can hold. |
Implemented in ivon::AudioWrapper.
|
pure virtual |
Try to read an encoded packet for transmission (non-blocking).
| data_out | Buffer for encoded bytes. |
| max_len | Maximum bytes the buffer can hold. |
Implemented in ivon::AudioWrapper.