41 #define switch_normalize_volume(x) if (x > 4) x = 4; if (x < -4) x = -4; 42 #define SWITCH_GRANULAR_VOLUME_MAX 50 43 #define switch_normalize_volume_granular(x) if (x > SWITCH_GRANULAR_VOLUME_MAX) x = SWITCH_GRANULAR_VOLUME_MAX; if (x < -SWITCH_GRANULAR_VOLUME_MAX) x = -SWITCH_GRANULAR_VOLUME_MAX; 45 #ifndef SWITCH_RESAMPLE_H 46 #define SWITCH_RESAMPLE_H 47 #define SWITCH_RESAMPLE_QUALITY 2 85 uint32_t from_rate, uint32_t to_rate, uint32_t to_size,
86 int quality, uint32_t channels,
const char *file,
const char *func,
int line);
89 #define switch_resample_create(_n, _fr, _tr, _ts, _q, _c) switch_resample_perform_create(_n, _fr, _tr, _ts, _q, _c, __FILE__, __SWITCH_FUNC__, __LINE__) 179 #define switch_resample_calc_buffer_size(_to, _from, _srclen) ((uint32_t)(((float)_to / (float)_from) * (float)_srclen) * 2) 182 uint32_t low_energy_point, uint32_t margin, uint32_t change_factor, uint32_t period_len);
184 uint32_t low_energy_point, uint32_t margin, uint32_t change_factor, uint32_t period_len);
int switch_char_to_float(char *c, float *f, int len)
Convert an array of chars to an array of floats.
#define SWITCH_END_EXTERN_C
void switch_agc_destroy(switch_agc_t **agcP)
void switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t channels, uint32_t divisor)
Generate static noise.
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_resample_destroy(switch_audio_resampler_t **resampler)
Destroy an existing resampler handle.
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)
uint32_t switch_unmerge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples, int channels)
void switch_change_sln_volume(int16_t *data, uint32_t samples, int32_t vol)
Change the volume of a signed linear audio frame.
switch_status_t switch_agc_feed(switch_agc_t *agc, int16_t *data, uint32_t samples, uint32_t channels)
switch_byte_t switch_byte_t * buf
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.
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.
int switch_short_to_float(short *s, float *f, int len)
Convert an array of shorts to an array of floats.
void switch_swap_linear(int16_t *buf, int len)
Perform a byteswap on a buffer of 16 bit samples.
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)
int switch_float_to_char(float *f, char *c, int len)
Convert an array of floats to an array of chars.
void switch_agc_set_token(switch_agc_t *agc, const char *token)
void switch_mux_channels(int16_t *data, switch_size_t samples, uint32_t orig_channels, uint32_t channels)
An audio resampling handle.
switch_status_t
Common return values.
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.
uint32_t switch_merge_sln(int16_t *data, uint32_t samples, int16_t *other_data, uint32_t other_samples, int channels)
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.
#define SWITCH_BEGIN_EXTERN_C