|
ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
|
🎚️ Real-time audio mixer with ducking, gain control, and multi-stream blending More...
Go to the source code of this file.
Macros | |
| #define | M_PI 3.14159265358979323846 |
Functions | |
| float | db_to_linear (float db) |
| float | linear_to_db (float linear) |
| float | clamp_float (float value, float min, float max) |
| void | compressor_init (compressor_t *comp, float sample_rate) |
| void | compressor_set_params (compressor_t *comp, float threshold_dB, float ratio, uint64_t attack_ns, uint64_t release_ns, float makeup_dB) |
| float | compressor_process_sample (compressor_t *comp, float sidechain) |
| int | ducking_init (ducking_t *duck, int num_sources, float sample_rate) |
| void | ducking_destroy (ducking_t *duck) |
| void | ducking_set_params (ducking_t *duck, float threshold_dB, float leader_margin_dB, float atten_dB, uint64_t attack_ns, uint64_t release_ns) |
| void | ducking_process_frame (ducking_t *duck, float *envelopes, float *gains, int num_sources) |
| mixer_t * | mixer_create (int max_sources, int sample_rate) |
| void | mixer_destroy (mixer_t *mixer) |
| int | mixer_add_source (mixer_t *mixer, uint32_t client_id, audio_ring_buffer_t *buffer) |
| void | mixer_remove_source (mixer_t *mixer, uint32_t client_id) |
| void | mixer_set_source_active (mixer_t *mixer, uint32_t client_id, bool active) |
| int | mixer_process (mixer_t *mixer, float *output, int num_samples) |
| int | mixer_process_excluding_source (mixer_t *mixer, float *output, int num_samples, uint32_t exclude_client_id) |
| void | noise_gate_init (noise_gate_t *gate, float sample_rate) |
| void | noise_gate_set_params (noise_gate_t *gate, float threshold, uint64_t attack_ns, uint64_t release_ns, float hysteresis) |
| float | noise_gate_process_sample (noise_gate_t *gate, float input, float peak_amplitude) |
| void | noise_gate_process_buffer (noise_gate_t *gate, float *buffer, int num_samples) |
| bool | noise_gate_is_open (const noise_gate_t *gate) |
| void | highpass_filter_init (highpass_filter_t *filter, float cutoff_hz, float sample_rate) |
| void | highpass_filter_reset (highpass_filter_t *filter) |
| float | highpass_filter_process_sample (highpass_filter_t *filter, float input) |
| void | highpass_filter_process_buffer (highpass_filter_t *filter, float *buffer, int num_samples) |
| void | lowpass_filter_init (lowpass_filter_t *filter, float cutoff_hz, float sample_rate) |
| void | lowpass_filter_reset (lowpass_filter_t *filter) |
| float | lowpass_filter_process_sample (lowpass_filter_t *filter, float input) |
| void | lowpass_filter_process_buffer (lowpass_filter_t *filter, float *buffer, int num_samples) |
| float | soft_clip (float sample, float threshold, float steepness) |
| void | soft_clip_buffer (float *buffer, int num_samples, float threshold, float steepness) |
| float | smoothstep (float t) |
| int16_t | float_to_int16 (float sample) |
| float | int16_to_float (int16_t sample) |
| void | buffer_float_to_int16 (const float *src, int16_t *dst, int count) |
| void | buffer_int16_to_float (const int16_t *src, float *dst, int count) |
| float | buffer_peak (const float *buffer, int count) |
| void | apply_gain_buffer (float *buffer, int count, float gain) |
| void | fade_buffer (float *buffer, int count, float start_gain, float end_gain) |
| void | fade_buffer_smooth (float *buffer, int count, bool fade_in) |
| void | copy_buffer_with_gain (const float *src, float *dst, int count, float gain) |
🎚️ Real-time audio mixer with ducking, gain control, and multi-stream blending
Definition in file mixer.c.
| void apply_gain_buffer | ( | float * | buffer, |
| int | count, | ||
| float | gain | ||
| ) |
| void buffer_float_to_int16 | ( | const float * | src, |
| int16_t * | dst, | ||
| int | count | ||
| ) |
Definition at line 1048 of file mixer.c.
References float_to_int16().
| void buffer_int16_to_float | ( | const int16_t * | src, |
| float * | dst, | ||
| int | count | ||
| ) |
Definition at line 1056 of file mixer.c.
References int16_to_float().
| float buffer_peak | ( | const float * | buffer, |
| int | count | ||
| ) |
| float clamp_float | ( | float | value, |
| float | min, | ||
| float | max | ||
| ) |
| void compressor_init | ( | compressor_t * | comp, |
| float | sample_rate | ||
| ) |
Definition at line 42 of file mixer.c.
References compressor_set_params().
Referenced by client_audio_pipeline_create(), and mixer_create().
| float compressor_process_sample | ( | compressor_t * | comp, |
| float | sidechain | ||
| ) |
Definition at line 87 of file mixer.c.
References db_to_linear(), and linear_to_db().
Referenced by client_audio_pipeline_process_duplex(), mixer_process(), and mixer_process_excluding_source().
| void compressor_set_params | ( | compressor_t * | comp, |
| float | threshold_dB, | ||
| float | ratio, | ||
| uint64_t | attack_ns, | ||
| uint64_t | release_ns, | ||
| float | makeup_dB | ||
| ) |
Definition at line 53 of file mixer.c.
Referenced by client_audio_pipeline_create(), and compressor_init().
| void copy_buffer_with_gain | ( | const float * | src, |
| float * | dst, | ||
| int | count, | ||
| float | gain | ||
| ) |
Definition at line 1109 of file mixer.c.
Referenced by client_audio_pipeline_process_duplex().
| float db_to_linear | ( | float | db | ) |
Definition at line 23 of file mixer.c.
Referenced by compressor_process_sample(), ducking_process_frame(), mixer_process(), and mixer_process_excluding_source().
| void ducking_destroy | ( | ducking_t * | duck | ) |
Definition at line 166 of file mixer.c.
Referenced by mixer_destroy().
| int ducking_init | ( | ducking_t * | duck, |
| int | num_sources, | ||
| float | sample_rate | ||
| ) |
Definition at line 111 of file mixer.c.
Referenced by mixer_create().
| void ducking_process_frame | ( | ducking_t * | duck, |
| float * | envelopes, | ||
| float * | gains, | ||
| int | num_sources | ||
| ) |
Definition at line 184 of file mixer.c.
References db_to_linear(), and linear_to_db().
Referenced by mixer_process(), and mixer_process_excluding_source().
| void ducking_set_params | ( | ducking_t * | duck, |
| float | threshold_dB, | ||
| float | leader_margin_dB, | ||
| float | atten_dB, | ||
| uint64_t | attack_ns, | ||
| uint64_t | release_ns | ||
| ) |
| void fade_buffer | ( | float * | buffer, |
| int | count, | ||
| float | start_gain, | ||
| float | end_gain | ||
| ) |
| void fade_buffer_smooth | ( | float * | buffer, |
| int | count, | ||
| bool | fade_in | ||
| ) |
Definition at line 1098 of file mixer.c.
References smoothstep().
| int16_t float_to_int16 | ( | float | sample | ) |
Definition at line 1035 of file mixer.c.
Referenced by buffer_float_to_int16().
| void highpass_filter_init | ( | highpass_filter_t * | filter, |
| float | cutoff_hz, | ||
| float | sample_rate | ||
| ) |
Definition at line 901 of file mixer.c.
References highpass_filter_reset(), and M_PI.
Referenced by client_audio_pipeline_create().
| void highpass_filter_process_buffer | ( | highpass_filter_t * | filter, |
| float * | buffer, | ||
| int | num_samples | ||
| ) |
Definition at line 937 of file mixer.c.
References highpass_filter_process_sample().
Referenced by client_audio_pipeline_process_duplex().
| float highpass_filter_process_sample | ( | highpass_filter_t * | filter, |
| float | input | ||
| ) |
Definition at line 923 of file mixer.c.
Referenced by highpass_filter_process_buffer().
| void highpass_filter_reset | ( | highpass_filter_t * | filter | ) |
Definition at line 915 of file mixer.c.
Referenced by highpass_filter_init().
| float int16_to_float | ( | int16_t | sample | ) |
Definition at line 1044 of file mixer.c.
Referenced by buffer_int16_to_float().
| float linear_to_db | ( | float | linear | ) |
Definition at line 27 of file mixer.c.
Referenced by compressor_process_sample(), and ducking_process_frame().
| void lowpass_filter_init | ( | lowpass_filter_t * | filter, |
| float | cutoff_hz, | ||
| float | sample_rate | ||
| ) |
Definition at line 951 of file mixer.c.
References lowpass_filter_reset(), and M_PI.
Referenced by client_audio_pipeline_create().
| void lowpass_filter_process_buffer | ( | lowpass_filter_t * | filter, |
| float * | buffer, | ||
| int | num_samples | ||
| ) |
Definition at line 986 of file mixer.c.
References lowpass_filter_process_sample().
Referenced by client_audio_pipeline_process_duplex().
| float lowpass_filter_process_sample | ( | lowpass_filter_t * | filter, |
| float | input | ||
| ) |
Definition at line 974 of file mixer.c.
Referenced by lowpass_filter_process_buffer().
| void lowpass_filter_reset | ( | lowpass_filter_t * | filter | ) |
Definition at line 967 of file mixer.c.
Referenced by lowpass_filter_init().
| int mixer_add_source | ( | mixer_t * | mixer, |
| uint32_t | client_id, | ||
| audio_ring_buffer_t * | buffer | ||
| ) |
Definition at line 364 of file mixer.c.
Referenced by add_client(), and add_webrtc_client().
| mixer_t * mixer_create | ( | int | max_sources, |
| int | sample_rate | ||
| ) |
Definition at line 218 of file mixer.c.
References compressor_init(), ducking_init(), and rwlock_init().
Referenced by server_main().
| void mixer_destroy | ( | mixer_t * | mixer | ) |
Definition at line 347 of file mixer.c.
References ducking_destroy().
Referenced by server_main().
| int mixer_process | ( | mixer_t * | mixer, |
| float * | output, | ||
| int | num_samples | ||
| ) |
Definition at line 460 of file mixer.c.
References audio_ring_buffer_read(), compressor_process_sample(), db_to_linear(), ducking_process_frame(), and soft_clip().
| int mixer_process_excluding_source | ( | mixer_t * | mixer, |
| float * | output, | ||
| int | num_samples, | ||
| uint32_t | exclude_client_id | ||
| ) |
Definition at line 605 of file mixer.c.
References audio_ring_buffer_read(), compressor_process_sample(), db_to_linear(), ducking_process_frame(), soft_clip(), time_elapsed_ns(), and time_get_ns().
Referenced by client_audio_render_thread().
| void mixer_remove_source | ( | mixer_t * | mixer, |
| uint32_t | client_id | ||
| ) |
Definition at line 401 of file mixer.c.
Referenced by remove_client().
| void mixer_set_source_active | ( | mixer_t * | mixer, |
| uint32_t | client_id, | ||
| bool | active | ||
| ) |
Definition at line 433 of file mixer.c.
| void noise_gate_init | ( | noise_gate_t * | gate, |
| float | sample_rate | ||
| ) |
Definition at line 816 of file mixer.c.
References noise_gate_set_params().
Referenced by client_audio_pipeline_create().
| bool noise_gate_is_open | ( | const noise_gate_t * | gate | ) |
| void noise_gate_process_buffer | ( | noise_gate_t * | gate, |
| float * | buffer, | ||
| int | num_samples | ||
| ) |
Definition at line 873 of file mixer.c.
References noise_gate_process_sample().
Referenced by client_audio_pipeline_playback(), and client_audio_pipeline_process_duplex().
| float noise_gate_process_sample | ( | noise_gate_t * | gate, |
| float | input, | ||
| float | peak_amplitude | ||
| ) |
Definition at line 848 of file mixer.c.
Referenced by noise_gate_process_buffer().
| void noise_gate_set_params | ( | noise_gate_t * | gate, |
| float | threshold, | ||
| uint64_t | attack_ns, | ||
| uint64_t | release_ns, | ||
| float | hysteresis | ||
| ) |
Definition at line 830 of file mixer.c.
Referenced by client_audio_pipeline_create(), and noise_gate_init().
| float smoothstep | ( | float | t | ) |
Definition at line 1027 of file mixer.c.
Referenced by client_audio_pipeline_process_duplex(), and fade_buffer_smooth().
| float soft_clip | ( | float | sample, |
| float | threshold, | ||
| float | steepness | ||
| ) |
Definition at line 1000 of file mixer.c.
Referenced by client_audio_pipeline_process_duplex(), mixer_process(), mixer_process_excluding_source(), and soft_clip_buffer().
| void soft_clip_buffer | ( | float * | buffer, |
| int | num_samples, | ||
| float | threshold, | ||
| float | steepness | ||
| ) |
Definition at line 1013 of file mixer.c.
References soft_clip().
Referenced by client_audio_pipeline_process_duplex().