|
ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
|
🔊 Client audio management: capture thread, sample processing, and playback coordination More...
Go to the source code of this file.
Data Structures | |
| struct | audio_send_packet_t |
| Audio packet for async sending. More... | |
Macros | |
| #define | AUDIO_SEND_QUEUE_SIZE 32 |
| #define | AUDIO_VOLUME_BOOST 1.0f |
| #define | OPUS_FRAME_SAMPLES 960 |
| #define | OPUS_MAX_PACKET_SIZE 500 |
| #define | CAPTURE_READ_SIZE (OPUS_FRAME_SAMPLES * 4) |
| #define | MAX_BATCH_FRAMES 8 |
| #define | BATCH_TIMEOUT_NS (40LL * NS_PER_MS_INT) |
Functions | |
| void | audio_process_received_samples (const float *samples, int num_samples) |
| Process received audio samples from server. | |
| int | audio_client_init (void) |
| Initialize audio subsystem. | |
| int | audio_start_thread (void) |
| Start audio capture thread. | |
| void | audio_stop_thread (void) |
| Stop audio capture thread. | |
| bool | audio_thread_exited (void) |
| Check if audio capture thread has exited. | |
| void | audio_cleanup (void) |
| Cleanup audio subsystem. | |
| client_audio_pipeline_t * | audio_get_pipeline (void) |
| Get the audio pipeline (for advanced usage) | |
| int | audio_decode_opus (const uint8_t *opus_data, size_t opus_len, float *output, int max_samples) |
| Decode Opus packet using the audio pipeline. | |
| audio_context_t * | audio_get_context (void) |
| Get the global audio context for use by other subsystems. | |
🔊 Client audio management: capture thread, sample processing, and playback coordination
The audio system implements a dual-thread architecture:
Both incoming and outgoing audio undergo comprehensive processing:
Audio capture runs in a dedicated thread:
Audio samples are batched for network efficiency:
Uses PortAudio for cross-platform audio support:
Audio errors handled with graceful degradation:
Careful audio resource lifecycle:
Definition in file src/client/audio.c.
| #define AUDIO_SEND_QUEUE_SIZE 32 |
Ring buffer queue for async audio packets
Definition at line 194 of file src/client/audio.c.
| #define AUDIO_VOLUME_BOOST 1.0f |
Audio volume boost multiplier for received samples
Definition at line 379 of file src/client/audio.c.
| #define BATCH_TIMEOUT_NS (40LL * NS_PER_MS_INT) |
| #define CAPTURE_READ_SIZE (OPUS_FRAME_SAMPLES * 4) |
| #define MAX_BATCH_FRAMES 8 |
| #define OPUS_FRAME_SAMPLES 960 |
| #define OPUS_MAX_PACKET_SIZE 500 |