Ejemplo n.º 1
0
static apt_bool_t demo_verifier_msg_process(apt_task_t *task, apt_task_msg_t *msg)
{
	demo_verifier_msg_t *demo_msg = (demo_verifier_msg_t*)msg->data;
	switch(demo_msg->type) {
		case DEMO_VERIF_MSG_OPEN_CHANNEL:
			/* open channel and send asynch response */
			mrcp_engine_channel_open_respond(demo_msg->channel,TRUE);
			break;
		case DEMO_VERIF_MSG_CLOSE_CHANNEL:
		{
			/* close channel, make sure there is no activity and send asynch response */
			demo_verifier_channel_t *verifier_channel = demo_msg->channel->method_obj;
			if(verifier_channel->audio_out) {
				fclose(verifier_channel->audio_out);
				verifier_channel->audio_out = NULL;
			}

			mrcp_engine_channel_close_respond(demo_msg->channel);
			break;
		}
		case DEMO_VERIF_MSG_REQUEST_PROCESS:
			demo_verifier_channel_request_dispatch(demo_msg->channel,demo_msg->request);
			break;
		default:
			break;
	}
	return TRUE;
}
Ejemplo n.º 2
0
/** Open engine channel (asynchronous response MUST be sent)*/
static apt_bool_t mrcp_swift_channel_open(mrcp_engine_channel_t *channel)
{
	/* open channel and send asynch response */
	apt_bool_t status = FALSE;
	mrcp_swift_channel_t *synth_channel = channel->method_obj;
	mrcp_swift_engine_t *synth_engine = channel->engine->obj;
	const mpf_codec_descriptor_t *descriptor = mrcp_engine_source_stream_codec_get(synth_channel->channel);
	if(descriptor) {
		swift_params *params;
		swift_port *port;

		params = swift_params_new(NULL);
		swift_params_set_string(params, "audio/encoding", "pcm16");
		swift_params_set_int(params, "audio/sampling-rate", descriptor->sampling_rate);
		/* open swift port */ 
		apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Swift Port");
		port = swift_port_open(synth_engine->swift,params);
		if(port) {
			/* set swift_write_audio as a callback, with the output file as its param */
			swift_port_set_callback(port, &mrcp_swift_write_audio, SWIFT_EVENT_AUDIO | SWIFT_EVENT_END, synth_channel);
			synth_channel->port = port;
			status = TRUE;
		}
		else {
			apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Swift Port");
		}
	}

	return mrcp_engine_channel_open_respond(channel,status);
}
Ejemplo n.º 3
0
static apt_bool_t demo_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg)
{
	demo_synth_msg_t *demo_msg = (demo_synth_msg_t*)msg->data;
	switch(demo_msg->type) {
		case DEMO_SYNTH_MSG_OPEN_CHANNEL:
			/* open channel and send asynch response */
			mrcp_engine_channel_open_respond(demo_msg->channel,TRUE);
			break;
		case DEMO_SYNTH_MSG_CLOSE_CHANNEL:
			/* close channel, make sure there is no activity and send asynch response */
			mrcp_engine_channel_close_respond(demo_msg->channel);
			break;
		case DEMO_SYNTH_MSG_REQUEST_PROCESS:
			demo_synth_channel_request_dispatch(demo_msg->channel,demo_msg->request);
			break;
		default:
			break;
	}
	return TRUE;
}
Ejemplo n.º 4
0
/** Open engine channel (asynchronous response MUST be sent)*/
static apt_bool_t mrcp_swift_channel_open(mrcp_engine_channel_t *channel)
{
	/* open channel and send asynch response */
	return mrcp_engine_channel_open_respond(channel,TRUE);
}