RTS API Documentation
1.10.11
|
#include <switch.h>
#include <switch_resample.h>
#include <switch_private.h>
#include <speex/speex_resampler.h>
Go to the source code of this file.
Data Structures | |
struct | switch_agc_s |
Macros | |
#define | NORMFACT (float)0x8000 |
#define | MAXSAMPLE (float)0x7FFF |
#define | MAXSAMPLEC (char)0x7F |
#define | QUALITY 0 |
#define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
#define | MAX(a, b) ((a) > (b) ? (a) : (b)) |
#define | resample_buffer(a, b, c) a > b ? ((a / 1000) / 2) * c : ((b / 1000) / 2) * c |
Functions | |
switch_status_t | switch_resample_perform_create (switch_audio_resampler_t **new_resampler, uint32_t from_rate, uint32_t to_rate, uint32_t to_size, int quality, uint32_t channels, const char *file, const char *func, int line) |
Prepare a new resampler handle. More... | |
uint32_t | switch_resample_process (switch_audio_resampler_t *resampler, int16_t *src, uint32_t srclen) |
Resample one float buffer into another using specifications of a given handle. More... | |
void | switch_resample_destroy (switch_audio_resampler_t **resampler) |
Destroy an existing resampler handle. More... | |
switch_size_t | switch_float_to_short (float *f, short *s, switch_size_t len) |
Convert an array of floats to an array of shorts. More... | |
int | switch_char_to_float (char *c, float *f, int len) |
Convert an array of chars to an array of floats. More... | |
int | switch_float_to_char (float *f, char *c, int len) |
Convert an array of floats to an array of chars. More... | |
int | switch_short_to_float (short *s, float *f, int len) |
Convert an array of shorts to an array of floats. More... | |
void | switch_swap_linear (int16_t *buf, int len) |
Perform a byteswap on a buffer of 16 bit samples. More... | |
void | switch_generate_sln_silence (int16_t *data, uint32_t samples, uint32_t channels, uint32_t divisor) |
Generate static noise. More... | |
uint32_t | switch_merge_sln (int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples, int channels) |
uint32_t | switch_unmerge_sln (int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples, int channels) |
void | switch_mux_channels (int16_t *data, switch_size_t samples, uint32_t orig_channels, uint32_t channels) |
void | switch_change_sln_volume_granular (int16_t *data, uint32_t samples, int32_t vol) |
Change the volume of a signed linear audio frame with more granularity. More... | |
void | switch_change_sln_volume (int16_t *data, uint32_t samples, int32_t vol) |
Change the volume of a signed linear audio frame. More... | |
void | switch_agc_set (switch_agc_t *agc, uint32_t energy_avg, uint32_t low_energy_point, uint32_t margin, uint32_t change_factor, uint32_t period_len) |
switch_status_t | switch_agc_create (switch_agc_t **agcP, uint32_t energy_avg, uint32_t low_energy_point, uint32_t margin, uint32_t change_factor, uint32_t period_len) |
void | switch_agc_destroy (switch_agc_t **agcP) |
void | switch_agc_set_energy_avg (switch_agc_t *agc, uint32_t energy_avg) |
void | switch_agc_set_energy_low (switch_agc_t *agc, uint32_t low_energy_point) |
void | switch_agc_set_token (switch_agc_t *agc, const char *token) |
switch_status_t | switch_agc_feed (switch_agc_t *agc, int16_t *data, uint32_t samples, uint32_t channels) |
Definition at line 50 of file switch_resample.c.
#define MAXSAMPLE (float)0x7FFF |
Definition at line 41 of file switch_resample.c.
Referenced by switch_char_to_float(), and switch_float_to_short().
#define MAXSAMPLEC (char)0x7F |
Definition at line 42 of file switch_resample.c.
Definition at line 46 of file switch_resample.c.
#define NORMFACT (float)0x8000 |
Definition at line 40 of file switch_resample.c.
Referenced by switch_char_to_float(), switch_float_to_char(), switch_float_to_short(), and switch_short_to_float().
#define QUALITY 0 |
Definition at line 43 of file switch_resample.c.
Definition at line 53 of file switch_resample.c.
switch_status_t switch_agc_create | ( | switch_agc_t ** | agcP, |
uint32_t | energy_avg, | ||
uint32_t | low_energy_point, | ||
uint32_t | margin, | ||
uint32_t | change_factor, | ||
uint32_t | period_len | ||
) |
Definition at line 470 of file switch_resample.c.
References switch_agc_s::pool, switch_agc_set(), switch_agc_set_token(), switch_assert, switch_core_alloc, switch_core_new_memory_pool, switch_snprintf(), and SWITCH_STATUS_SUCCESS.
void switch_agc_destroy | ( | switch_agc_t ** | agcP | ) |
Definition at line 495 of file switch_resample.c.
References switch_agc_s::pool, switch_assert, and switch_core_destroy_memory_pool.
switch_status_t switch_agc_feed | ( | switch_agc_t * | agc, |
int16_t * | data, | ||
uint32_t | samples, | ||
uint32_t | channels | ||
) |
Definition at line 529 of file switch_resample.c.
References switch_agc_s::change_factor, switch_agc_s::energy_avg, switch_agc_s::low_energy_point, switch_agc_s::margin, switch_agc_s::period_len, switch_agc_s::score, switch_agc_s::score_avg, switch_agc_s::score_count, switch_agc_s::score_over, switch_agc_s::score_sum, switch_agc_s::score_under, switch_change_sln_volume_granular(), SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, switch_log_printf(), switch_normalize_volume_granular, SWITCH_STATUS_SUCCESS, switch_agc_s::token, and switch_agc_s::vol.
void switch_agc_set | ( | switch_agc_t * | agc, |
uint32_t | energy_avg, | ||
uint32_t | low_energy_point, | ||
uint32_t | margin, | ||
uint32_t | change_factor, | ||
uint32_t | period_len | ||
) |
Definition at line 453 of file switch_resample.c.
References switch_agc_s::change_factor, switch_agc_s::energy_avg, switch_agc_s::low_energy_point, switch_agc_s::margin, switch_agc_s::period_len, switch_agc_s::score, switch_agc_s::score_avg, switch_agc_s::score_count, switch_agc_s::score_over, switch_agc_s::score_sum, and switch_agc_s::score_under.
Referenced by switch_agc_create().
void switch_agc_set_energy_avg | ( | switch_agc_t * | agc, |
uint32_t | energy_avg | ||
) |
Definition at line 510 of file switch_resample.c.
References switch_agc_s::energy_avg, and switch_assert.
void switch_agc_set_energy_low | ( | switch_agc_t * | agc, |
uint32_t | low_energy_point | ||
) |
Definition at line 517 of file switch_resample.c.
References switch_agc_s::low_energy_point, and switch_assert.
void switch_agc_set_token | ( | switch_agc_t * | agc, |
const char * | token | ||
) |
Definition at line 524 of file switch_resample.c.
References switch_agc_s::pool, switch_core_strdup, and switch_agc_s::token.
Referenced by switch_agc_create().
uint32_t switch_merge_sln | ( | int16_t * | data, |
uint32_t | samples, | ||
int16_t * | other_data, | ||
uint32_t | other_samples, | ||
int | channels | ||
) |
Definition at line 231 of file switch_resample.c.
References switch_normalize_to_16bit.
Referenced by eavesdrop_callback().
void switch_mux_channels | ( | int16_t * | data, |
switch_size_t | samples, | ||
uint32_t | orig_channels, | ||
uint32_t | channels | ||
) |
Definition at line 274 of file switch_resample.c.
References switch_assert, switch_normalize_to_16bit, and switch_zmalloc.
Referenced by switch_core_file_read(), switch_core_file_write(), switch_core_session_read_frame(), switch_core_session_write_frame(), switch_core_speech_read_tts(), switch_ivr_eavesdrop_session(), and teletone_handler().
uint32_t switch_unmerge_sln | ( | int16_t * | data, |
uint32_t | samples, | ||
int16_t * | other_data, | ||
uint32_t | other_samples, | ||
int | channels | ||
) |
Definition at line 254 of file switch_resample.c.
Referenced by switch_core_session_read_frame().