mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
commit 027047ed7b07832456cd5d13f4c85da24aca26b5
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Tue Jul 14 18:17:37 2009 +0000 Added missing UNIMRCP_APU_INCLUDES in pkg-config files git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1054 f001bc3a-424a-0410-80a0-a715b8f413a8 commit b0e1c8251f8039a8a22662120e5a362340733a9e Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Mon Jul 13 17:25:34 2009 +0000 if state != RECOGNIZING, there is nothing to do on deactivation git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1053 f001bc3a-424a-0410-80a0-a715b8f413a8 commit 3581b9d3ba59177f4aaced327e20b8dc53e234e3 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Mon Jul 13 16:14:38 2009 +0000 Do not include Completion-Cause header field in the IN-PROGRESS response sent by PocketSphinx plugin git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1052 f001bc3a-424a-0410-80a0-a715b8f413a8 commit 831f43f9071e491169d4d5a7e3d0cb2009c3af21 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Mon Jul 13 15:27:33 2009 +0000 Using MRCP_SESSION_SID(session) macro wherever session id is logged git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1051 f001bc3a-424a-0410-80a0-a715b8f413a8 commit 9349bd2b393ee0b300942bfa8cacc264687ecea9 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Sat Jul 11 15:17:42 2009 +0000 Sent async channel_open and channel_close responses git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1050 f001bc3a-424a-0410-80a0-a715b8f413a8 commit 5775dfc74e8fe982735da32dfa12dc05f0d20892 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Sat Jul 11 15:15:47 2009 +0000 Sent async channel_close response git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1049 f001bc3a-424a-0410-80a0-a715b8f413a8 commit efa4d10b2dc3de238dfb4a26b25ef3a580fb0bf0 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Sat Jul 11 12:54:47 2009 +0000 Enhanced state machine to STOP in-progress SPEAK or RECOGNIZE requests on session termination, thus guarantee there is no remaining request, when plugin cha nnel_close() method is called. channel_open() -> SPEAK -> STOP -> channel_close() channel_open() -> SPEAK -> SPEAK-COMPLETE -> channel_close() This allows to simplify implementation of plugins (nothing has to be changed). git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1048 f001bc3a-424a-0410-80a0-a715b8f413a8 commit aaf53907ea0705bc2a44fe785c8f7762e20e52cf Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Fri Jul 10 12:57:33 2009 +0000 Added utility function to get attributes of NLSML results such as confidence and grammar git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1047 f001bc3a-424a-0410-80a0-a715b8f413a8 commit f7c4dff83199cb9af8dc7ec6f121c384d2b6cea0 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Fri Jul 10 09:51:23 2009 +0000 Added missing includes for <stdlib.h> and <stdio.h> required on some platforms git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1046 f001bc3a-424a-0410-80a0-a715b8f413a8 commit 1cb7ccb6e63f4d34b6cfcbdc386446a36d052af1 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Thu Jul 9 19:05:18 2009 +0000 Using NLSML processor in demo git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1045 f001bc3a-424a-0410-80a0-a715b8f413a8 commit cd74eee440dd94cabe814c7d4f64dfef187b7445 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Thu Jul 9 18:52:49 2009 +0000 Added basic NLSML document processor git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1044 f001bc3a-424a-0410-80a0-a715b8f413a8 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14260 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -119,6 +119,8 @@ typedef struct flite_speak_msg_t flite_speak_msg_t;
|
||||
/* we have a special task for the actual synthesis -
|
||||
the task is created when a mrcp speak message is received */
|
||||
static apt_bool_t flite_speak(apt_task_t *task, apt_task_msg_t *msg);
|
||||
static apt_bool_t flite_on_start(apt_task_t *task);
|
||||
static apt_bool_t flite_on_terminate(apt_task_t *task);
|
||||
|
||||
/** Declare this macro to use log routine of the server where the plugin is loaded from */
|
||||
MRCP_PLUGIN_LOGGER_IMPLEMENT
|
||||
@@ -184,14 +186,16 @@ static apt_bool_t flite_synth_task_create(flite_synth_channel_t *synth_channel)
|
||||
}
|
||||
|
||||
task_vtable = apt_consumer_task_vtable_get(consumer_task);
|
||||
if(!task_vtable) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_ERROR, "flite_synth_channel_speak cannot use flite speak task vtable - channel:%d", synth_channel->iId);
|
||||
return FALSE;
|
||||
if(task_vtable) {
|
||||
task_vtable->process_msg = flite_speak;
|
||||
task_vtable->on_pre_run = flite_on_start;
|
||||
task_vtable->on_post_run = flite_on_terminate;
|
||||
}
|
||||
|
||||
task_vtable->process_msg = flite_speak;
|
||||
synth_channel->msg_pool = msg_pool;
|
||||
synth_channel->task = apt_consumer_task_base_get(consumer_task);
|
||||
if(synth_channel->task) {
|
||||
apt_task_name_set(synth_channel->task,"Flite Task");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -199,19 +203,10 @@ static apt_bool_t flite_synth_task_create(flite_synth_channel_t *synth_channel)
|
||||
static mrcp_engine_channel_t* flite_synth_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
|
||||
{
|
||||
/* create flite synth channel */
|
||||
flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) apr_palloc(pool,sizeof(flite_synth_channel_t));
|
||||
mpf_codec_descriptor_t *codec_descriptor = NULL;
|
||||
flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) apr_palloc(pool,sizeof(flite_synth_channel_t));
|
||||
|
||||
apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_engine_channel_create");
|
||||
#if 0
|
||||
codec_descriptor = (mpf_codec_descriptor_t *) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
|
||||
mpf_codec_descriptor_init(codec_descriptor);
|
||||
codec_descriptor->channel_count = 1;
|
||||
codec_descriptor->payload_type = 96;
|
||||
apt_string_set(&codec_descriptor->name,"LPCM");
|
||||
codec_descriptor->sampling_rate = 16000;
|
||||
#endif
|
||||
|
||||
synth_channel->flite_engine = (flite_synth_engine_t *) engine->obj;
|
||||
synth_channel->speak_request = NULL; // no active speak request in progress
|
||||
synth_channel->speak_response = NULL;
|
||||
@@ -228,6 +223,15 @@ static mrcp_engine_channel_t* flite_synth_engine_channel_create(mrcp_resource_en
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
codec_descriptor = (mpf_codec_descriptor_t *) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
|
||||
mpf_codec_descriptor_init(codec_descriptor);
|
||||
codec_descriptor->channel_count = 1;
|
||||
codec_descriptor->payload_type = 96;
|
||||
apt_string_set(&codec_descriptor->name,"LPCM");
|
||||
codec_descriptor->sampling_rate = 16000;
|
||||
#endif
|
||||
|
||||
/* create engine channel base */
|
||||
synth_channel->channel = mrcp_engine_source_channel_create(
|
||||
engine, /* resource engine */
|
||||
@@ -272,14 +276,15 @@ static apt_bool_t flite_synth_channel_open(mrcp_engine_channel_t *channel)
|
||||
|
||||
if(synth_channel->task) {
|
||||
if(apt_task_start(synth_channel->task) == TRUE) {
|
||||
apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "Speak task started - channel %d", synth_channel->iId);
|
||||
/* async response will be sent */
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "Speak task start failed - channel %d", synth_channel->iId);
|
||||
}
|
||||
}
|
||||
|
||||
return mrcp_engine_channel_open_respond(channel,TRUE);
|
||||
return mrcp_engine_channel_open_respond(channel,FALSE);
|
||||
}
|
||||
|
||||
/** Close engine channel (asynchronous response MUST be sent)*/
|
||||
@@ -289,15 +294,15 @@ static apt_bool_t flite_synth_channel_close(mrcp_engine_channel_t *channel)
|
||||
apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "flite_synth_channel_close - channel %d", synth_channel->iId);
|
||||
|
||||
if(synth_channel->task) {
|
||||
if(apt_task_terminate(synth_channel->task,TRUE) == TRUE) {
|
||||
apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "Speak task terminated - channel %d", synth_channel->iId);
|
||||
if(apt_task_terminate(synth_channel->task,FALSE) == TRUE) {
|
||||
/* async response will be sent */
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "Speak task terminate failed - channel %d", synth_channel->iId);
|
||||
}
|
||||
}
|
||||
mrcp_engine_channel_close_respond(channel);
|
||||
return TRUE;
|
||||
return mrcp_engine_channel_close_respond(channel);
|
||||
}
|
||||
|
||||
/** Process MRCP channel request (asynchronous response MUST be sent)*/
|
||||
@@ -428,7 +433,7 @@ static apt_bool_t flite_speak(apt_task_t *task, apt_task_msg_t *msg)
|
||||
apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "< flite_speak_msg_process speak - channel %d", synth_channel->iId);
|
||||
|
||||
/* just sequential stuff */
|
||||
start = apr_time_now(); // in microsec
|
||||
start = apr_time_now(); /* in microsec */
|
||||
if(!body->length) {
|
||||
synth_channel->speak_request = NULL;
|
||||
synth_response_construct(response,MRCP_STATUS_CODE_MISSING_PARAM,SYNTHESIZER_COMPLETION_CAUSE_ERROR);
|
||||
@@ -479,7 +484,7 @@ static apt_bool_t flite_speak(apt_task_t *task, apt_task_msg_t *msg)
|
||||
delete_wave(wave);
|
||||
}
|
||||
|
||||
// this will notify the callback that feeds the client that synthesis is complete
|
||||
/* this will notify the callback that feeds the client that synthesis is complete */
|
||||
mpf_buffer_event_write(synth_channel->audio_buffer, MEDIA_FRAME_TYPE_EVENT);
|
||||
synth_channel->synthesizing = FALSE;
|
||||
|
||||
@@ -487,6 +492,26 @@ static apt_bool_t flite_speak(apt_task_t *task, apt_task_msg_t *msg)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static APR_INLINE flite_synth_channel_t* flite_synth_channel_get(apt_task_t *task)
|
||||
{
|
||||
apt_consumer_task_t *consumer_task = apt_task_object_get(task);
|
||||
return apt_consumer_task_object_get(consumer_task);
|
||||
}
|
||||
|
||||
static apt_bool_t flite_on_start(apt_task_t *task)
|
||||
{
|
||||
flite_synth_channel_t *synth_channel = flite_synth_channel_get(task);
|
||||
apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "Speak task started - channel %d", synth_channel->iId);
|
||||
return mrcp_engine_channel_open_respond(synth_channel->channel,TRUE);
|
||||
}
|
||||
|
||||
static apt_bool_t flite_on_terminate(apt_task_t *task)
|
||||
{
|
||||
flite_synth_channel_t *synth_channel = flite_synth_channel_get(task);
|
||||
apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "Speak task terminated - channel %d", synth_channel->iId);
|
||||
return mrcp_engine_channel_close_respond(synth_channel->channel);
|
||||
}
|
||||
|
||||
/** Process STOP request */
|
||||
static apt_bool_t flite_synth_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
|
||||
{
|
||||
|
Reference in New Issue
Block a user