|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
Multi-Source Audio Mixing and Processing System. More...
Go to the source code of this file.
Data Structures | |
| struct | compressor_t |
| Dynamic range compressor settings and state. More... | |
| struct | noise_gate_t |
| Noise gate settings and state. More... | |
| struct | highpass_filter_t |
| High-pass filter settings and state. More... | |
| struct | lowpass_filter_t |
| Low-pass filter state. More... | |
| struct | ducking_t |
| Ducking system settings and state. More... | |
| struct | mixer_t |
| Main mixer structure for multi-source audio processing. More... | |
Macros | |
Audio Mixing Configuration | |
| #define | MIXER_MAX_SOURCES 32 |
| Maximum number of simultaneous audio sources. | |
| #define | MIXER_FRAME_SIZE 256 |
| Number of samples processed per audio frame. | |
Functions | |
Mixer Lifecycle Functions | |
| mixer_t * | mixer_create (int max_sources, int sample_rate) |
| Create a new audio mixer. | |
| void | mixer_destroy (mixer_t *mixer) |
| Destroy a mixer and free all resources. | |
Source Management Functions | |
| int | mixer_add_source (mixer_t *mixer, uint32_t client_id, audio_ring_buffer_t *buffer) |
| Add an audio source to the mixer. | |
| void | mixer_remove_source (mixer_t *mixer, uint32_t client_id) |
| Remove an audio source from the mixer. | |
| void | mixer_set_source_active (mixer_t *mixer, uint32_t client_id, bool active) |
| Set whether a source is active (receiving audio) | |
Audio Processing Functions | |
| int | mixer_process (mixer_t *mixer, float *output, int num_samples) |
| Process audio from all active sources. | |
| int | mixer_process_excluding_source (mixer_t *mixer, float *output, int num_samples, uint32_t exclude_client_id) |
| Process audio from all sources except one (for per-client output) | |
Utility Functions | |
| float | db_to_linear (float db) |
| Convert decibels to linear gain. | |
| float | linear_to_db (float linear) |
| Convert linear gain to decibels. | |
| float | clamp_float (float value, float min, float max) |
| Clamp a float value to a range. | |
Compressor Functions | |
| void | compressor_init (compressor_t *comp, float sample_rate) |
| Initialize a compressor. | |
| void | compressor_set_params (compressor_t *comp, float threshold_dB, float ratio, float attack_ms, float release_ms, float makeup_dB) |
| Set compressor parameters. | |
| float | compressor_process_sample (compressor_t *comp, float sidechain) |
| Process a single sample through compressor. | |
Ducking Functions | |
| int | ducking_init (ducking_t *duck, int num_sources, float sample_rate) |
| Initialize ducking system. | |
| void | ducking_free (ducking_t *duck) |
| Free ducking system resources. | |
| void | ducking_set_params (ducking_t *duck, float threshold_dB, float leader_margin_dB, float atten_dB, float attack_ms, float release_ms) |
| Set ducking parameters. | |
| void | ducking_process_frame (ducking_t *duck, float *envelopes, float *gains, int num_sources) |
| Process a frame of audio through ducking system. | |
Noise Gate Functions | |
| void | noise_gate_init (noise_gate_t *gate, float sample_rate) |
| Initialize a noise gate. | |
| void | noise_gate_set_params (noise_gate_t *gate, float threshold, float attack_ms, float release_ms, float hysteresis) |
| Set noise gate parameters. | |
| float | noise_gate_process_sample (noise_gate_t *gate, float input, float peak_amplitude) |
| Process a single sample through noise gate. | |
| void | noise_gate_process_buffer (noise_gate_t *gate, float *buffer, int num_samples) |
| Process a buffer of samples through noise gate. | |
| bool | noise_gate_is_open (const noise_gate_t *gate) |
| Check if noise gate is currently open. | |
High-Pass Filter Functions | |
| void | highpass_filter_init (highpass_filter_t *filter, float cutoff_hz, float sample_rate) |
| Initialize a high-pass filter. | |
| void | highpass_filter_reset (highpass_filter_t *filter) |
| Reset high-pass filter state. | |
| float | highpass_filter_process_sample (highpass_filter_t *filter, float input) |
| Process a single sample through high-pass filter. | |
| void | highpass_filter_process_buffer (highpass_filter_t *filter, float *buffer, int num_samples) |
| Process a buffer of samples through high-pass filter. | |
Low-Pass Filter Functions | |
| void | lowpass_filter_init (lowpass_filter_t *filter, float cutoff_hz, float sample_rate) |
| Initialize a low-pass filter. | |
| void | lowpass_filter_reset (lowpass_filter_t *filter) |
| Reset low-pass filter state. | |
| float | lowpass_filter_process_sample (lowpass_filter_t *filter, float input) |
| Process a single sample through low-pass filter. | |
| void | lowpass_filter_process_buffer (lowpass_filter_t *filter, float *buffer, int num_samples) |
| Process a buffer of samples through low-pass filter. | |
Buffer Utility Functions | |
| float | smoothstep (float t) |
| Compute smoothstep interpolation. | |
| int16_t | float_to_int16 (float sample) |
| Convert float sample to int16 (WebRTC format) | |
| float | int16_to_float (int16_t sample) |
| Convert int16 sample to float. | |
| void | buffer_float_to_int16 (const float *src, int16_t *dst, int count) |
| Convert float buffer to int16 buffer. | |
| void | buffer_int16_to_float (const int16_t *src, float *dst, int count) |
| Convert int16 buffer to float buffer. | |
| float | buffer_peak (const float *buffer, int count) |
| Find peak absolute value in buffer. | |
| void | apply_gain_buffer (float *buffer, int count, float gain) |
| Apply gain to buffer in-place. | |
| void | fade_buffer (float *buffer, int count, float start_gain, float end_gain) |
| Apply linear fade to buffer in-place. | |
| void | fade_buffer_smooth (float *buffer, int count, bool fade_in) |
| Apply smoothstep fade to buffer in-place. | |
| void | copy_buffer_with_gain (const float *src, float *dst, int count, float gain) |
| Copy buffer with gain scaling. | |
Soft Clipping Functions | |
| float | soft_clip (float sample, float threshold, float steepness) |
| Apply soft clipping to a sample. | |
| void | soft_clip_buffer (float *buffer, int num_samples, float threshold, float steepness) |
| Apply soft clipping to a buffer. | |
Multi-Source Audio Mixing and Processing System.
Definition in file mixer.h.