Navit SVN

/work/compile/navit/src/navit/support/espeak/fifo.h

00001 #ifndef FIFO_H
00002 #define FIFO_H
00003 
00004 // Helps to add espeak commands in a first-in first-out queue 
00005 // and run them asynchronously.
00006 
00007 #include "espeak_command.h"
00008 #include "speak_lib.h"
00009 
00010 // Initialize the fifo component.
00011 // First function to be called.
00012 void fifo_init();
00013 
00014 // Add an espeak command.
00015 //
00016 // Note: this function fails if too many commands are already buffered.
00017 // In such a case, the calling function could wait and then add again its command. 
00018 //
00019 // Return: EE_OK: operation achieved 
00020 //         EE_BUFFER_FULL: the command can not be buffered; 
00021 //           you may try after a while to call the function again.
00022 //         EE_INTERNAL_ERROR.
00023 espeak_ERROR fifo_add_command (t_espeak_command* c);
00024 
00025 // Add two espeak commands in a single transaction.
00026 //
00027 // Note: this function fails if too many commands are already buffered.
00028 // In such a case, the calling function could wait and then add again these commands. 
00029 //
00030 // Return: EE_OK: operation achieved 
00031 //         EE_BUFFER_FULL: at least one command can not be buffered; 
00032 //           you may try after a while to call the function again.
00033 //         EE_INTERNAL_ERROR.
00034 espeak_ERROR fifo_add_commands (t_espeak_command* c1, t_espeak_command* c2);
00035 
00036 // The current running command must be stopped and the awaiting commands are cleared.
00037 // Return: EE_OK: operation achieved 
00038 //         EE_INTERNAL_ERROR.
00039 espeak_ERROR fifo_stop ();
00040 
00041 // Is there a running command?
00042 // Returns 1 if yes; 0 otherwise.
00043 int fifo_is_busy ();
00044 
00045 // Terminate the fifo component.
00046 // Last function to be called.
00047 void fifo_terminate();
00048 
00049 // Indicates if the running command is still enabled.
00050 //
00051 // Note: this function is mainly called by the SynthCallback (speak_lib.cpp)
00052 // It indicates if the actual wave sample can still be played. It is helpful for 
00053 // stopping speech as soon as a cancel command is applied. 
00054 //
00055 // Returns 1 if yes, or 0 otherwise.
00056 int fifo_is_command_enabled();
00057 
00058 #endif