[Freeswitch-svn] [commit] r9083 - freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx
Freeswitch SVN
brian at freeswitch.org
Thu Jul 17 19:46:47 EDT 2008
Author: brian
Date: Thu Jul 17 19:46:47 2008
New Revision: 9083
Modified:
freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c
Log:
move the models into the config so you can override them and set the defaults if you dont
Modified: freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c (original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c Thu Jul 17 19:46:47 2008
@@ -49,6 +49,7 @@
uint32_t silence_hits;
uint32_t listen_hits;
int auto_reload;
+ switch_memory_pool_t *pool;
} globals;
typedef enum {
@@ -442,9 +443,22 @@
globals.listen_hits = atoi(val);
} else if (!strcasecmp(var, "auto-reload")) {
globals.auto_reload = switch_true(val);
+ } else if (!strcasecmp(var, "narrowband_model")) {
+ globals.model8k = switch_core_strdup(globals.pool, val);
+ } else if (!strcasecmp(var, "wideband_model")) {
+ globals.model16k = switch_core_strdup(globals.pool, val);
}
}
}
+
+ if (!globals.model8k) {
+ globals.model8k = switch_core_strdup(globals.pool, "communicator");
+ }
+
+ if (!globals.model16k) {
+ globals.model16k = switch_core_strdup(globals.pool, "wsj1");
+ }
+
done:
if (xml) {
switch_xml_free(xml);
@@ -473,6 +487,8 @@
switch_asr_interface_t *asr_interface;
switch_mutex_init(&MUTEX, SWITCH_MUTEX_NESTED, pool);
+
+ globals.pool = pool;
if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
@@ -495,9 +511,6 @@
asr_interface->asr_check_results = pocketsphinx_asr_check_results;
asr_interface->asr_get_results = pocketsphinx_asr_get_results;
- globals.model8k = switch_core_strdup(pool, "communicator");
- globals.model16k = switch_core_strdup(pool, "wsj1");
-
err_set_logfp(NULL);
/* indicate that the module should continue to be loaded */
More information about the Freeswitch-svn
mailing list