40 const char *module_name,
41 const char *voice_name,
42 unsigned int rate,
unsigned int interval,
unsigned int channels,
49 if (!sh || !flags ||
zstr(module_name)) {
53 if (strchr(module_name,
':')) {
55 if ((param = strchr(buf,
':'))) {
102 char *param_string = NULL;
116 ltext = strdup(text);
120 while (data && *data ==
' ') {
130 param_string = data + 1;
142 if (!
zstr(param_string)) {
143 char *param[256] = { 0 };
146 for (i = 0; i < argc && param[i]; ++i) {
147 char *param_pair[2] = { 0 };
148 if (
switch_separate_string(param[i],
'=', param_pair, (
sizeof(param_pair) /
sizeof(param_pair[0]))) == 2) {
273 uint32_t rlen = *datalen / 2;
void(* speech_numeric_param_tts)(switch_speech_handle_t *sh, char *param, int val)
switch_status_t switch_core_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags)
Read rendered audio from the TTS module.
switch_status_t switch_core_speech_feed_tts(switch_speech_handle_t *sh, const char *text, switch_speech_flag_t *flags)
Feed text to the TTS module.
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
#define SWITCH_CHANNEL_LOG
switch_size_t switch_buffer_read(_In_ switch_buffer_t *buffer, _In_ void *data, _In_ switch_size_t datalen)
Read data from a switch_buffer_t up to the ammount of datalen if it is available. Remove read data fr...
char * switch_find_end_paren(const char *s, char open, char close)
switch_status_t switch_buffer_create_dynamic(_Out_ switch_buffer_t **buffer, _In_ switch_size_t blocksize, _In_ switch_size_t start_len, _In_ switch_size_t max_len)
Allocate a new dynamic switch_buffer.
uint32_t switch_speech_flag_t
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
void(* speech_float_param_tts)(switch_speech_handle_t *sh, char *param, double val)
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
switch_memory_pool_t * pool
void switch_core_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
Set a float parameter on a TTS handle.
#define SWITCH_RESAMPLE_QUALITY
void switch_core_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
Set a numeric parameter on a TTS handle.
void(* speech_text_param_tts)(switch_speech_handle_t *sh, char *param, const char *val)
void switch_core_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
Set a text parameter on a TTS handle.
void switch_resample_destroy(switch_audio_resampler_t **resampler)
Destroy an existing resampler handle.
switch_size_t switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen)
Write data into a switch_buffer_t up to the length of datalen.
switch_status_t(* speech_feed_tts)(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
switch_memory_pool_t * memory_pool
#define UNPROTECT_INTERFACE(_it)
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
switch_status_t switch_core_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags)
Close an open speech handle.
switch_byte_t switch_byte_t * buf
unsigned int switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen)
Separate a string into an array based on a character delimiter.
void(* speech_flush_tts)(switch_speech_handle_t *sh)
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
switch_speech_interface_t * speech_interface
#define switch_samples_per_packet(rate, interval)
void switch_core_speech_flush_tts(switch_speech_handle_t *sh)
Flush TTS audio on a given handle.
void switch_mux_channels(int16_t *data, switch_size_t samples, uint32_t orig_channels, uint32_t channels)
switch_status_t(* speech_open)(switch_speech_handle_t *sh, const char *voice_name, int rate, int channels, switch_speech_flag_t *flags)
switch_audio_resampler_t * resampler
switch_status_t
Common return values.
switch_status_t switch_core_speech_open(switch_speech_handle_t *sh, const char *module_name, const char *voice_name, unsigned int rate, unsigned int interval, unsigned int channels, switch_speech_flag_t *flags, switch_memory_pool_t *pool)
#define switch_set_string(_dst, _src)
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
struct fspr_pool_t switch_memory_pool_t
switch_size_t switch_buffer_inuse(_In_ switch_buffer_t *buffer)
Get the in use amount of a switch_buffer_t.
void switch_buffer_destroy(switch_buffer_t **buffer)
Destroy the buffer.
switch_status_t(* speech_read_tts)(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags)
#define switch_resample_create(_n, _fr, _tr, _ts, _q, _c)
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.
switch_status_t(* speech_close)(switch_speech_handle_t *, switch_speech_flag_t *flags)
switch_speech_interface_t * switch_loadable_module_get_speech_interface(const char *name)
Retrieve the speech interface by it's registered name.