julius/module.c File Reference

Main loop for module mode (server mode). More...

#include <julius.h>
#include <stdarg.h>

Include dependency graph for module.c:

Go to the source code of this file.

Defines

#define MAXBUFLEN   4096
 Maximum line length of a message sent from a client.

Functions

void main_module_loop ()
 Application main loop for module mode.
boolean module_disconnect ()
boolean module_is_connected ()
void msock_exec_command (char *command)
 Process a module command.
boolean module_is_active ()
 Return the process activity status.
boolean module_wants_terminate ()
 Return whether we currently has a request of immediate termination.
void module_reset_reload ()
void msock_process_command ()
void msock_check_and_process_command ()
int msock_check_in_adin ()
 callback function to process module command while input detection.

Variables

static int listen_sd = -1
 Socket to listen to a client.
static char mbuf [MAXBUFLEN]
 Work buffer for message output.
static boolean process_active = TRUE
static boolean process_want_terminate = FALSE
static boolean process_want_reload = FALSE


Detailed Description

Main loop for module mode (server mode).

Author:
Akinobu Lee
Date:
Mon May 30 15:59:54 2005
Revision
1.5

Definition in file module.c.


Function Documentation

void main_module_loop (  ) 

Application main loop for module mode.

This function wait for a connection request from a client process, and when connected, it calls the recognition main loop for that. The established socket descriptor will be stored in the global variable "module_sd". In Win32, this process will not fork by the connection acceptance.

Definition at line 89 of file module.c.

Referenced by main().

boolean module_disconnect (  ) 

Disconnect the current client.

Returns:
TRUE on success, or FALSE on failure.

Definition at line 152 of file module.c.

Referenced by m_errexit(), m_exit(), and msock_exec_command().

boolean module_is_connected (  ) 

Return whether a client process has been connected.

Returns:
TRUE if currently connected, or FALSE if not.

Definition at line 172 of file module.c.

Referenced by m_errexit(), m_exit(), and msock_check_in_adin().

void msock_exec_command ( char *  command  ) 

Process a module command.

This function processes command string received from module client. This will be called whenever a command arrives from a client, interrupting the main recognition process. The status responses will be performed at this function immediately. On the whole, grammar modification (add/delete/(de)activation) will not be performed here. The received data are just stored in this function, and they will be processed later by calling multigram_exec() between the recognition process.

Parameters:
command [in] command string

Definition at line 326 of file module.c.

Referenced by main_recognition_loop(), msock_check_and_process_command(), and msock_process_command().

boolean module_is_active (  ) 

Return the process activity status.

If TRUE, the process is currently activated, either monitoring an audio input or recognizing the current input. If FALSE, recognition is currently disabled, ignoring all the speech inputs.

Returns:
TRUE if process is currently activated, or FALSE if not.

Definition at line 563 of file module.c.

Referenced by adin_cut_callback_store_buffer(), and main_recognition_loop().

boolean module_wants_terminate (  ) 

Return whether we currently has a request of immediate termination.

This function returns whether we now has an order for immediate termination. This status will be set by receiving "TERMINATE" command from module client, or when a grammar has been received with immediate update option. This function is typically called from several recognition functions and ad-in processing function to check if we should stop the current recognition process immediately.

Returns:
TRUE if we have a request of immediate termination, or FALSE if not.

Definition at line 592 of file module.c.

Referenced by adin_cut_callback_store_buffer(), get_back_trellis(), main_recognition_loop(), and msock_check_in_adin().

void module_reset_reload (  ) 

Clear the process_want_reload flag.

Definition at line 608 of file module.c.

Referenced by main_recognition_loop().

void msock_process_command (  ) 

Process one commands from client module. If no command is in the buffer, it will block until next command comes.

Definition at line 626 of file module.c.

Referenced by main_recognition_loop().

void msock_check_and_process_command (  ) 

Process one commands from client module. If no command is in the buffer, it will return without blocking.

Definition at line 652 of file module.c.

Referenced by adin_cut_callback_store_buffer(), main_recognition_loop(), and msock_check_in_adin().

int msock_check_in_adin (  ) 

callback function to process module command while input detection.

This function will be called periodically from A/D-in function to check and process commands from module client. If some commands are found, it will be processed here. Also, if some termination or stop of recognition process is requested, this function returns to the caller as so.

Returns:
0 normally, -2 when there is immediate termination request, and -1 if there is recognition stop command.

Definition at line 707 of file module.c.

Referenced by main_recognition_loop().


Variable Documentation

boolean process_active = TRUE [static]

Status flag indicating whether the recognition is alive or not. If TRUE, the process is currently activated, either monitoring an audio input or recognizing the current input. If FALSE, the recognition is now disabled until some activation command has been arrived from client. While disabled, all the inputs are ignored.

If set to FALSE in the program, Julius/Julian will stop after the current recognition ends, and enter the disabled status.

Definition at line 43 of file module.c.

Referenced by module_is_active(), and msock_exec_command().

boolean process_want_terminate = FALSE [static]

If set to TRUE, Julius/Julian stops recognition immediately, terminating the currenct recognition process, and enter into disabled status.

Definition at line 50 of file module.c.

Referenced by module_wants_terminate(), and msock_exec_command().

boolean process_want_reload = FALSE [static]

If set to TRUE, Julius/Julian stops recognition softly. If it is performing recognition of the 1st pass, it immediately segments the current input, process the 2nd pass, and output the result. Then it enters the disabled status.

Definition at line 59 of file module.c.

Referenced by module_reset_reload(), msock_check_in_adin(), and msock_exec_command().


Generated on Tue Dec 26 16:16:51 2006 for Julius by  doxygen 1.5.0