Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

switch_core_speech.c File Reference


Functions

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, switch_speech_flag_t *flags, switch_memory_pool_t *pool)
switch_status_t switch_core_speech_feed_tts (switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
 Feed text to the TTS module.
void switch_core_speech_flush_tts (switch_speech_handle_t *sh)
 Flush TTS audio on a given handle.
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_core_speech_numeric_param_tts (switch_speech_handle_t *sh, char *param, int val)
 Set a numeric parameter on a TTS handle.
void switch_core_speech_float_param_tts (switch_speech_handle_t *sh, char *param, double val)
 Set a float parameter on a TTS handle.
switch_status_t switch_core_speech_read_tts (switch_speech_handle_t *sh, void *data, switch_size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
 Read rendered audio from the TTS module.
switch_status_t switch_core_speech_close (switch_speech_handle_t *sh, switch_speech_flag_t *flags)
 Close an open speech handle.


Function Documentation

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,
switch_speech_flag_t flags,
switch_memory_pool_t pool
 

00045 {
00046         switch_status_t status;
00047         char buf[256] = "";
00048         char *param = NULL;
00049 
00050         if (!sh || !flags || switch_strlen_zero(module_name)) {
00051                 return SWITCH_STATUS_FALSE;
00052         }
00053 
00054         if (strchr(module_name, ':')) {
00055                 switch_set_string(buf, module_name);
00056                 if ((param = strchr(buf, ':'))) {
00057                         *param++ = '\0';
00058                         module_name = buf;
00059                 }
00060         }
00061 
00062         if ((sh->speech_interface = switch_loadable_module_get_speech_interface(module_name)) == 0) {
00063                 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid speech module [%s]!\n", module_name);
00064                 return SWITCH_STATUS_GENERR;
00065         }
00066 
00067         sh->flags = *flags;
00068         if (pool) {
00069                 sh->memory_pool = pool;
00070         } else {
00071                 if ((status = switch_core_new_memory_pool(&sh->memory_pool)) != SWITCH_STATUS_SUCCESS) {
00072                         return status;
00073                 }
00074                 switch_set_flag(sh, SWITCH_SPEECH_FLAG_FREE_POOL);
00075         }
00076 
00077         sh->engine = switch_core_strdup(sh->memory_pool, module_name);
00078         if (param) {
00079                 sh->param = switch_core_strdup(sh->memory_pool, param);
00080         }
00081 
00082         sh->rate = rate;
00083         sh->name = switch_core_strdup(pool, module_name);
00084         sh->samples = switch_samples_per_frame(rate, interval);
00085 
00086         return sh->speech_interface->speech_open(sh, voice_name, rate, flags);
00087 }

Here is the call graph for this function:


Generated on Mon May 26 22:06:52 2008 for FreeSWITCH by  doxygen 1.3.9.1