festival.h

00001 
00012 #ifndef GITKR_SPEECH_FESTIVAL_H
00013 #define GITKR_SPEECH_FESTIVAL_H
00014 
00016 #define FESTIVAL_DEFAULT_SERVER_HOST "localhost"
00017 
00018 #define FESTIVAL_DEFAULT_SERVER_PORT 1314
00019 
00020 #define FESTIVAL_DEFAULT_TEXT_MODE "fundamental"
00021 
00023 #define FESTIVAL_SERVER_OK 0
00024 
00025 #define FESTIVAL_SERVER_WAVEFORM 1
00026 
00027 #define FESTIVAL_SERVER_EXPR 2
00028 
00029 #define FESTIVAL_SERVER_ERROR 3
00030 
00031 
00035 typedef struct FT_Info {
00036     char *server_host;  
00037     int server_port;    
00038     char *text_mode;    
00040     int server_fd;      
00041 } FT_Info;
00042 
00046 typedef struct FT_Wave {
00047     int num_samples;
00048     int sample_rate;
00049     short *samples;
00050 } FT_Wave;
00051 
00055 typedef struct FT_Alaw {
00056     int num_samples;
00057     char *samples;
00058 } FT_Alaw;
00059 
00060 /* von festival_client.h geborgt */
00061 #define SWAPSHORT(x) ((((unsigned)x) & 0xff) << 8 | \
00062                       (((unsigned)x) & 0xff00) >> 8)
00063 #define SWAPINT(x) ((((unsigned)x) & 0xff) << 24 | \
00064                     (((unsigned)x) & 0xff00) << 8 | \
00065         (((unsigned)x) & 0xff0000) >> 8 | \
00066                     (((unsigned)x) & 0xff000000) >> 24)
00067 
00068 /* Sun, HP, SGI Mips, M68000 */
00069 #define FAPI_BIG_ENDIAN (((char *)&fapi_endian_loc)[0] == 0)
00070 /* Intel, Alpha, DEC Mips, Vax */
00071 #define FAPI_LITTLE_ENDIAN (((char *)&fapi_endian_loc)[0] != 0)
00072 /* von festival_client.h geborgt */
00073 
00074 
00075 #ifdef GITKR_SPEECH_FESTIVAL_C
00076 FT_Info *festival_initialize(char *host, int port, char *mode);
00077 void festival_done(FT_Info *info);
00078 void festival_say_text(FT_Info *info, const char *text);
00079 void festival_play_wave(FT_Info *info, const char *filename);
00080 static int festival_socket_open(const char *host, int port);
00081 static int festival_server_results(int fd);
00082 static char *socket_receive_file_to_buff(int fd,int *size);
00083 int festival_wav2alaw(FT_Wave *wave, FT_Alaw *alaw);
00084 
00085 FT_Wave *festival_string_to_wave(FT_Info *info,const char *text);
00086 FT_Wave *festival_text2wave(FT_Info *info, const char *text);
00087 FT_Alaw *festival_string_to_alaw(FT_Info *info,const char *text);
00088 #else
00089 extern FT_Info *festival_initialize(char *host, int port, char *mode);
00090 extern void festival_done(FT_Info *info);
00091 extern void festival_say_text(FT_Info *info, const char *text);
00092 extern void festival_play_wave(FT_Info *info, const char *filename);
00093 extern FT_Wave *festival_string_to_wave(FT_Info *info,const char *text);
00094 extern FT_Wave *festival_text2wave(FT_Info *info, const char *text);
00095 extern FT_Alaw *festival_string_to_alaw(FT_Info *info,const char *text);
00096 extern int festival_wav2alaw(FT_Wave *wave, FT_Alaw *alaw);
00097 #endif
00098 
00099 #endif /* GITKR_SPEECH_FESTIVAL_H */

Generated on Thu Oct 28 10:59:07 2004 for gitk by doxygen 1.3.6