FreeSWITCH API Documentation
1.7.0
|
Data Structures | |
struct | switch_audio_resampler_t |
An audio resampling handle. More... | |
Macros | |
#define | switch_resample_create(_n, _fr, _tr, _ts, _q, _c) switch_resample_perform_create(_n, _fr, _tr, _ts, _q, _c, __FILE__, __SWITCH_FUNC__, __LINE__) |
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... | |
void | switch_resample_destroy (switch_audio_resampler_t **resampler) |
Destroy an existing 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... | |
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... | |
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_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... | |
#define switch_resample_create | ( | _n, | |
_fr, | |||
_tr, | |||
_ts, | |||
_q, | |||
_c | |||
) | switch_resample_perform_create(_n, _fr, _tr, _ts, _q, _c, __FILE__, __SWITCH_FUNC__, __LINE__) |
Definition at line 88 of file switch_resample.h.
Referenced by switch_core_asr_feed(), switch_core_file_read(), switch_core_file_write(), switch_core_session_read_frame(), switch_core_session_write_frame(), and switch_core_speech_read_tts().
void switch_change_sln_volume | ( | int16_t * | data, |
uint32_t | samples, | ||
int32_t | vol | ||
) |
Change the volume of a signed linear audio frame.
data | the audio data |
samples | the number of 2 byte samples |
vol | the volume factor -4 -> 4 |
Definition at line 365 of file switch_resample.c.
References switch_assert, switch_normalize_to_16bit, and switch_normalize_volume.
Referenced by session_audio_callback(), and switch_ivr_play_file().
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.
data | the audio data |
samples | the number of 2 byte samples |
vol | the volume factor -12 -> 12 |
Definition at line 326 of file switch_resample.c.
References memset(), switch_assert, switch_normalize_to_16bit, and switch_normalize_volume_granular.
int switch_char_to_float | ( | char * | c, |
float * | f, | ||
int | len | ||
) |
Convert an array of chars to an array of floats.
c | the char buffer |
f | the float buffer |
len | the length of the buffers |
Definition at line 140 of file switch_resample.c.
References MAXSAMPLE, and NORMFACT.
int switch_float_to_char | ( | float * | f, |
char * | c, | ||
int | len | ||
) |
Convert an array of floats to an array of chars.
f | an array of floats |
c | an array of chars |
len | the length of the buffers |
Definition at line 159 of file switch_resample.c.
References NORMFACT.
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.
f | the float buffer |
s | the short buffer |
len | the length of the buffers |
Definition at line 121 of file switch_resample.c.
References MAXSAMPLE, and NORMFACT.
void switch_generate_sln_silence | ( | int16_t * | data, |
uint32_t | samples, | ||
uint32_t | channels, | ||
uint32_t | divisor | ||
) |
Generate static noise.
data | the audio data buffer |
samples | the number of 2 byte samples |
divisor | the volume factor |
Definition at line 198 of file switch_resample.c.
References memset(), and switch_micro_time_now().
Referenced by audio_bridge_thread(), session_audio_callback(), switch_ivr_collect_digits_count(), switch_ivr_originate(), switch_ivr_park(), switch_ivr_record_file(), switch_ivr_sleep(), and switch_ivr_wait_for_answer().
void switch_resample_destroy | ( | switch_audio_resampler_t ** | resampler | ) |
Destroy an existing resampler handle.
resampler | the resampler handle to destroy |
Definition at line 108 of file switch_resample.c.
Referenced by switch_core_asr_close(), switch_core_file_close(), switch_core_media_set_codec(), switch_core_session_read_frame(), switch_core_session_reset(), switch_core_session_write_frame(), and switch_core_speech_close().
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.
new_resampler | NULL pointer to aim at the new handle |
from_rate | the rate to transfer from in hz |
to_rate | the rate to transfer to in hz |
quality | the quality desired |
Definition at line 55 of file switch_resample.c.
References switch_audio_resampler_t::channels, switch_audio_resampler_t::factor, switch_audio_resampler_t::from_rate, switch_audio_resampler_t::resampler, switch_audio_resampler_t::rfactor, switch_assert, switch_resample_calc_buffer_size, SWITCH_STATUS_GENERR, SWITCH_STATUS_SUCCESS, switch_zmalloc, switch_audio_resampler_t::to, switch_audio_resampler_t::to_rate, and switch_audio_resampler_t::to_size.
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.
resampler | the resample handle |
src | the source data |
srclen | the length of the source data |
Definition at line 93 of file switch_resample.c.
References switch_assert, and switch_resample_calc_buffer_size.
Referenced by switch_core_asr_feed(), switch_core_file_read(), switch_core_file_write(), switch_core_session_read_frame(), switch_core_session_write_frame(), and switch_core_speech_read_tts().
int switch_short_to_float | ( | short * | s, |
float * | f, | ||
int | len | ||
) |
Convert an array of shorts to an array of floats.
s | an array of shorts |
f | an array of floats |
len | the size of the buffers |
Definition at line 177 of file switch_resample.c.
References NORMFACT.
void switch_swap_linear | ( | int16_t * | buf, |
int | len | ||
) |
Perform a byteswap on a buffer of 16 bit samples.
buf | an array of samples |
len | the size of the array |
Definition at line 189 of file switch_resample.c.
Referenced by read_rtp_packet(), rtp_common_write(), and switch_ivr_play_file().