|
ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
|
🔊 Audio capture, playback, and sample processing More...
Files | |
| file | audio.c |
| 🔊 Client audio management: capture thread, sample processing, and playback coordination | |
| file | audio.h |
| ascii-chat Client Audio Processing Management Interface | |
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. | |
🔊 Audio capture, playback, and sample processing
The client audio subsystem manages PortAudio initialization, audio capture from microphone, transmission to server, and playback of received audio samples with jitter buffering.
Implementation: src/client/audio.c, src/client/audio.h
Audio Parameters:
| void audio_cleanup | ( | ) |
#include <audio.c>
Cleanup audio subsystem.
Cleanup audio subsystem
Stops audio threads and cleans up PortAudio resources. Called during client shutdown.
Definition at line 1115 of file src/client/audio.c.
References audio_destroy(), audio_set_pipeline(), audio_stop_duplex(), audio_stop_thread(), audio_terminate_portaudio_final(), client_audio_pipeline_destroy(), platform_sleep_us(), and wav_writer_close().
| int audio_client_init | ( | ) |
#include <audio.c>
Initialize audio subsystem.
Initialize audio subsystem
Sets up PortAudio context, creates the audio pipeline, and starts audio playback/capture if audio is enabled.
Definition at line 904 of file src/client/audio.c.
References audio_destroy(), audio_init(), audio_set_pipeline(), audio_start_duplex(), client_audio_pipeline_create(), client_audio_pipeline_default_config(), client_audio_pipeline_destroy(), wav_dump_enabled(), wav_writer_close(), and wav_writer_open().
| int audio_decode_opus | ( | const uint8_t * | opus_data, |
| size_t | opus_len, | ||
| float * | output, | ||
| int | max_samples | ||
| ) |
#include <audio.c>
Decode Opus packet using the audio pipeline.
| opus_data | Opus packet data |
| opus_len | Opus packet length |
| output | Output buffer for decoded samples |
| max_samples | Maximum samples output buffer can hold |
Definition at line 1199 of file src/client/audio.c.
References client_audio_pipeline_playback().
| audio_context_t * audio_get_context | ( | void | ) |
#include <audio.c>
Get the global audio context for use by other subsystems.
Used by capture subsystem to enable microphone fallback when file has no audio.
Definition at line 1213 of file src/client/audio.c.
Referenced by capture_init().
| client_audio_pipeline_t * audio_get_pipeline | ( | void | ) |
#include <audio.c>
Get the audio pipeline (for advanced usage)
Definition at line 1185 of file src/client/audio.c.
| void audio_process_received_samples | ( | const float * | samples, |
| int | num_samples | ||
| ) |
#include <audio.c>
Process received audio samples from server.
Process received audio samples from server
Uses the audio pipeline for processing:
| samples | Raw audio sample data from server |
| num_samples | Number of samples in the buffer |
| samples | Audio sample data from server |
| num_samples | Number of samples in buffer |
Definition at line 399 of file src/client/audio.c.
References audio_analysis_track_received_sample(), audio_ring_buffer_available_read(), audio_write_samples(), and wav_writer_write().
| int audio_start_thread | ( | ) |
#include <audio.c>
Start audio capture thread.
Start audio capture thread
Creates and starts the audio capture thread. Also sends stream start notification to server.
Definition at line 1003 of file src/client/audio.c.
References g_client_worker_pool, thread_pool_spawn(), and threaded_send_stream_start_packet().
Referenced by protocol_start_connection().
| void audio_stop_thread | ( | ) |
#include <audio.c>
Stop audio capture thread.
Stop audio capture thread
Gracefully stops the audio capture thread and cleans up resources. Safe to call multiple times.
Definition at line 1059 of file src/client/audio.c.
References platform_sleep_us().
Referenced by audio_cleanup(), and protocol_stop_connection().
| bool audio_thread_exited | ( | ) |
#include <audio.c>
Check if audio capture thread has exited.
Check if audio capture thread has exited
Definition at line 1103 of file src/client/audio.c.