/* * Copyright (c) 2004-2017 SELVAS AI, All rights reserved. * * PTTSNET (Selvy TTS Network Service API) */ #ifndef _PTTSNET_H_ #define _PTTSNET_H_ #ifdef WIN32 #include #endif #if defined(__cplusplus) extern "C" { #endif #define PTTSNET_VERSION "Version 2.4" //2017-02-28 Selvy TTS Client API #if !defined(DllExport) #ifdef WIN32 #define DllExport __declspec( dllexport ) #else #define DllExport extern #endif #endif #define PTTSNET_DBMAX 20 /* the maximum number of speakers */ #define PTTSNET_LANG_KOR 0 #define PTTSNET_LANG_ENG 1 #define PTTSNET_LANG_CHN 2 #define PTTSNET_LANG_JAP 3 #define PTTSNET_LANG_SPA 4 #define PTTSNET_LANG_GBR 5 #define PTTSNET_LANG_BRA 6 #define PTTSNET_LANG_CAN 7 #define PTTSNET_LANGMAX 8 /* the maximum number of language */ /* * Maximum PTTSNET_INIT() per process - OBSOLETE */ #define PTTSNET_MAXINIT 1024 /* * default timeout value definitions */ #define PTTSNET_DEFAULT_CTIMEOUT 60 /* TTS Server Connection Timeout */ #define PTTSNET_DEFAULT_RTIMEOUT 180 /* TTS Server Read Timeout */ /* * PTTSNET_GETOPT()::request Attributes */ #define PTTSNET_GET_VERSION 1 /* output (char *) */ #define PTTSNET_GET_MAXOPEN 2 /* output (int *) */ #define PTTSNET_GET_PITCH 3 /* output (int *) */ #define PTTSNET_GET_SPEED 4 /* output (int *) */ #define PTTSNET_GET_VOLUME 5 /* output (int *) */ #define PTTSNET_GET_SAMPLE 6 /* output (int *) */ #define PTTSNET_GET_PAUSELENSENT 7 /* output (int *) */ #define PTTSNET_GET_PAUSELENCOMMA 8 /* output (int *) */ #define PTTSNET_GET_READGWALHO 9 /* output (int *) */ #define PTTSNET_GET_SENTDELIMLF 10 /* output (int *) */ /* * PTTSNET_SETOPT()::request Attributes */ #define PTTSNET_SET_PAUSELENSENT 7 /* output (int *) */ #define PTTSNET_SET_PAUSELENCOMMA 8 /* output (int *) */ #define PTTSNET_SET_READGWALHO 9 /* output (int *) */ #define PTTSNET_SET_SENTDELIMLF 10 /* output (int *) */ /* * PTTSNET_CONTROL()::request Attributes */ #define PTTSNET_COMMAND_START 1 /* output (none) */ #define PTTSNET_COMMAND_STOP 2 /* output (none) */ #define PTTSNET_COMMAND_RESTART 3 /* output (none) */ #define PTTSNET_COMMAND_EXIT 4 /* output (none) */ #define PTTSNET_COMMAND_STAT 5 /* output (none), return (Service status) */ #define PTTSNET_COMMAND_USAGE 6 /* output (64Bytes char *) */ #define PTTSNET_COMMAND_CHANNEL 7 /* output (20KBytes char *), return (Max. number of channels) */ /* * Service status */ #define PTTSNET_SERVICE_START_PENDING 0 /* Initializing (init, reload) */ #define PTTSNET_SERVICE_RUNNING 1 /* Running, started */ #define PTTSNET_SERVICE_PAUSED 2 /* Paused (pause, stop) */ #define PTTSNET_SERVICE_CONTINUE 3 /* Start pending (continue, restart, start) */ #define PTTSNET_SERVICE_STOPPED 4 /* Stopped (exit) */ #define PTTSNET_SERVICE_PAUSE_PENDING 5 /* Pause pending */ #define PTTSNET_SERVICE_STOP_PENDING 6 /* Stop pending */ /* * PTTSNET_FILE(), PTTSNET_BUFFER(), PTTSNET_RFILE(), PTTSNET_OPEN()::content_type Attributes */ #define PTTSNET_CONTENT_DEFAULT (-1) /* Text/Plain */ #define PTTSNET_CONTENT_PLAIN 0 /* Text/Plain */ #define PTTSNET_CONTENT_VOICEXML 1 /* Text/VoiceXML */ #define PTTSNET_CONTENT_HTML 2 /* Text/HTML */ /* * PTTSNET_FILE(), PTTSNET_BUFFER(), PTTSNET_RFILE(), PTTSNET_OPEN()::charset Attributes */ #define PTTSNET_CHARSET_DEFAULT (-1) /* KSC5601 */ #define PTTSNET_CHARSET_KSC5601 0 /* KSC5601 */ #define PTTSNET_CHARSET_MS949 0 /* MS949(Windows Korean) (Extended Korean) */ #define PTTSNET_CHARSET_UTF8 1 /* UTF8 */ /* * PTTSNET_FILE(), PTTSNET_BUFFER(), PTTSNET_RFILE(), PTTSNET_OPEN()::audio_offset Attributes */ #define PTTSNET_AUDIO_NULL (-1) /* It doesn't do anything */ #define PTTSNET_AUDIO_INSERT 0 /* Insert at first */ #define PTTSNET_AUDIO_ADD 1 /* Add at last */ #define PTTSNET_AUDIO_MIX 2 /* Mix */ /* * PTTSNET_FILE(), PTTSNET_BUFFER(), PTTSNET_RFILE(), PTTSNET_OPEN()::sformat Attributes */ #define PTTSNET_FMT8K_16BIT_PCM 0x0111 /* 273, 8KHz, 16bit Linear PCM (INTEL LSB,MSB) */ #define PTTSNET_FMT8K_8BIT_PCM 0x0112 /* 274, 8KHz, 8bit Linear PCM (unsigned) */ #define PTTSNET_FMT8K_MULAW_PCM 0x0113 /* 275, 8KHz, 8bit Mu-Law PCM */ #define PTTSNET_FMT8K_ALAW_PCM 0x0114 /* 276, 8KHz, 8bit A-Law PCM */ #define PTTSNET_FMT8K_VOX 0x0115 /* 277, 8KHz, 4bit 32K VOX ADPCM */ #define PTTSNET_FMT8K_ADPCM_PCM 0x0116 /* 278, 8KHz, 4-bit CCITT g.721 ADPCM */ #define PTTSNET_FMT8K_16BIT_WAVE 0x0121 /* 289, 8KHz, 16bit Linear PCM (INTEL LSB,MSB) WAVE */ #define PTTSNET_FMT8K_8BIT_WAVE 0x0122 /* 290, 8KHz, 8bit Linear PCM (unsigned) WAVE */ #define PTTSNET_FMT8K_MULAW_WAVE 0x0123 /* 291, 8KHz, 8bit Mu-Law PCM WAVE */ #define PTTSNET_FMT8K_ALAW_WAVE 0x0124 /* 292, 8KHz, 8bit A-Law PCM WAVE */ #define PTTSNET_FMT8K_16BIT_AU 0x0131 /* 305, 8KHz, 16bit Linear PCM (Motorola MSB,LSB) AU */ #define PTTSNET_FMT8K_8BIT_AU 0x0132 /* 306, 8KHz, 8bit Linear PCM (signed) AU */ #define PTTSNET_FMT8K_MULAW_AU 0x0133 /* 307, 8KHz, 8bit Mu-Law PCM AU */ #define PTTSNET_FMT8K_ALAW_AU 0x0134 /* 308, 8KHz, 8bit A-Law PCM AU */ #define PTTSNET_FMT8K_ADPCM_AU 0x0136 /* 310, 8KHz, 4-bit CCITT g.721 ADPCM */ #define PTTSNET_FMT8K_OGG 0x0141 /* 321, 8KHz, OGG (from 16bit Linear PCM) */ #define PTTSNET_FMT8K_16BIT_ASF 0x1121 /* 4385, 8KHz, 16bit Linear PCM (INTEL LSB,MSB) ASF */ #define PTTSNET_FMT8K_8BIT_ASF 0x1122 /* 4386, 8KHz, 8bit Linear PCM (unsigned) ASF */ #define PTTSNET_FMT8K_ASF 0x1121 /* 4385, 8KHz, ASF (from 16bit Linear PCM) */ #define PTTSNET_FMT16K_16BIT_PCM 0x0211 /* 529, 16KHz, 16bit Linear PCM (INTEL LSB,MSB) */ #define PTTSNET_FMT16K_8BIT_PCM 0x0212 /* 530, 16KHz, 8bit Linear PCM (unsigned) */ #define PTTSNET_FMT16K_MULAW_PCM 0x0213 /* 531, 16KHz, 8bit Mu-Law PCM */ #define PTTSNET_FMT16K_ALAW_PCM 0x0214 /* 532, 16KHz, 8bit A-Law PCM */ #define PTTSNET_FMT16K_VOX 0x0215 /* 533, 16KHz, 4bit 32K VOX ADPCM */ #define PTTSNET_FMT16K_ADPCM_PCM 0x0216 /* 534, 16KHz, 4-bit CCITT g.721 ADPCM */ #define PTTSNET_FMT16K_16BIT_WAVE 0x0221 /* 545, 16KHz, 16bit Linear PCM (INTEL LSB,MSB) WAVE */ #define PTTSNET_FMT16K_8BIT_WAVE 0x0222 /* 546, 16KHz, 8bit Linear PCM (unsigned) WAVE */ #define PTTSNET_FMT16K_MULAW_WAVE 0x0223 /* 547, 16KHz, 8bit Mu-Law PCM WAVE */ #define PTTSNET_FMT16K_ALAW_WAVE 0x0224 /* 548, 16KHz, 8bit A-Law PCM WAVE */ #define PTTSNET_FMT16K_16BIT_AU 0x0231 /* 561, 16KHz, 16bit Linear PCM (Motorola MSB,LSB) AU */ #define PTTSNET_FMT16K_8BIT_AU 0x0232 /* 562, 16KHz, 8bit Linear PCM (signed) AU */ #define PTTSNET_FMT16K_MULAW_AU 0x0233 /* 563, 16KHz, 8bit Mu-Law PCM AU */ #define PTTSNET_FMT16K_ALAW_AU 0x0234 /* 564, 16KHz, 8bit A-Law PCM AU */ #define PTTSNET_FMT16K_ADPCM_AU 0x0236 /* 566, 16KHz, 4-bit CCITT g.721 ADPCM */ #define PTTSNET_FMT16K_OGG 0x0241 /* 577, 16KHz, OGG (from 16bit Linear PCM) */ #define PTTSNET_FMT16K_16BIT_ASF 0x1221 /* 4641,16KHz, 16bit Linear PCM (INTEL LSB,MSB) ASF */ #define PTTSNET_FMT16K_8BIT_ASF 0x1222 /* 4642,16KHz, 8bit Linear PCM (unsigned) ASF */ #define PTTSNET_FMT16K_ASF 0x1221 /* 4641,16KHz, ASF (from 16bit Linear PCM) */ #define PTTSNET_FMT11K_16BIT_WAVE 0x0421 /* 1057 11KHz, 16bit Linear PCM (INTEL LSB,MSB) WAVE */ #define PTTSNET_FMT22K_16BIT_WAVE 0x0521 /* 1313 22KHz, 16bit Linear PCM (INTEL LSB,MSB) WAVE */ #define PTTSNET_FMT44K_16BIT_WAVE 0x0621 /* 1569 44KHz, 16bit Linear PCM (INTEL LSB,MSB) WAVE */ #define PTTSNET_FMT22K_MP3_LAME 0x2511 /* 9489 22KHz, MP3 (from 16bit Linear PCM), mono */ #define PTTSNET_FMT22K_MP3 0x2521 /* 9505 22KHz, MP3 (from 16bit Linear PCM), stereo */ #define PTTSNET_FMT44K_MP3 0x2621 /* 9761 44KHz, MP3 (from 16bit Linear PCM), stereo */ #define PTTSNET_SAMPLE_MASK 0x0F00 /* Sampling rate mask */ #define PTTSNET_SAMPLE_8K 0x0100 /* 8KHz Sampling rate */ #define PTTSNET_SAMPLE_16K 0x0200 /* 16KHz Sampling rate */ #define PTTSNET_SAMPLE_32K 0x0300 /* 32KHz Sampling rate */ #define PTTSNET_SAMPLE_11K 0x0400 /* 11025Hz Sampling rate */ #define PTTSNET_SAMPLE_22K 0x0500 /* 22050Hz Sampling rate */ #define PTTSNET_SAMPLE_44K 0x0600 /* 44100Hz Sampling rate */ #define PTTSNET_FORMAT_MASK 0x00F0 /* Format mask */ #define PTTSNET_FORMAT_PCM 0x0010 /* PCM Format (Linear, Mu-Law, A-Law, ADPCM) */ #define PTTSNET_FORMAT_WAVE 0x0020 /* WAVE Format (Linear, Mu-Law, A-Law) */ #define PTTSNET_FORMAT_AU 0x0030 /* AU Format (Linear, Mu-Law, A-Law) */ #define PTTSNET_FORMAT_OGG 0x0040 /* OGG Format (16bit Linear) */ #define PTTSNET_CODEC_MASK 0xF000 /* CODEC mask */ #define PTTSNET_CODEC_ASF 0x1000 /* ASF/WMA Format (Linear) */ #define PTTSNET_CODEC_MP3 0x2000 /* MP3 codec (16bit Linear), stereo */ #define PTTSNET_ENCODE_MASK 0x000F /* Encoding mask */ #define PTTSNET_ENCODE_16BIT_PCM 0x0001 /* 16bit Linear PCM */ #define PTTSNET_ENCODE_8BIT_PCM 0x0002 /* 8bit Linear PCM */ #define PTTSNET_ENCODE_MULAW_PCM 0x0003 /* 8bit Mu-Law PCM */ #define PTTSNET_ENCODE_ALAW_PCM 0x0004 /* 8bit A-Law PCM */ #define PTTSNET_ENCODE_VOX 0x0005 /* 4bit 32K VOX ADPCM */ #define PTTSNET_ENCODE_ADPCM 0x0006 /* 4-bit CCITT g.721 ADPCM */ /* * Maximum PTTSNET_OPEN() per process - OBSOLETE */ #define PTTSNET_MAXOPEN 1024 #define PTTSNET_SERVER_TYPE_STANDALONE 0 // standalone #define PTTSNET_SERVER_TYPE_MASTER_PRI 1 // master_primary #define PTTSNET_SERVER_TYPE_MASTER_SEC 2 // master_secondary #define PTTSNET_SERVER_TYPE_SLAVE 3 // slave typedef struct _MAC_ADDR { int numCard; unsigned char MacAddr [10][7]; } MAC_ADDR; MAC_ADDR gMacAddr; /* * PTTSNET function prototype definitions: */ DllExport int PTTSNET_INIT (int language, int speakerid, char *host, char *port, int connection_timeout, int read_timeout); DllExport int PTTSNET_EXIT (int td); DllExport int PTTSNET_CONTROL (char *host, char *port, int connection_timeout, int read_timeout, int request, void *value, int valuelen, int language); DllExport int PTTSNET_GETOPT (int td, int request, void *value); DllExport int PTTSNET_SETOPT (int td, int request, void *value); DllExport void PTTSNET_FREE (char *ptr); DllExport int PTTSNET_ERROR (void); DllExport char *PTTSNET_STRERR (int errnum); DllExport int PTTSNET_FILE (int td, char *text, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, float *elapsed_time); DllExport int PTTSNET_RFILE (int td, char *text, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, float *elapsed_time); DllExport int PTTSNET_BUFFER (int td, char *text, char **speech, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, float *elapsed_time); DllExport int PTTSNET_SFILE (int td, char *file, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, float *elapsed_time); DllExport int PTTSNET_SRFILE (int td, char *file, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, float *elapsed_time); DllExport int PTTSNET_SBUFFER (int td, char *file, char **speech, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, float *elapsed_time); DllExport int PTTSNET_OPEN (int td, char *text, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset); DllExport int PTTSNET_READ (int fd, char *framebuffer, int size); DllExport int PTTSNET_CLOSE (int fd, float *elapsed_time); DllExport int PTTSNET_OPEN_VC (int td, char *text, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type); /* * PTTSNET Audio Extended function prototype definitions: */ DllExport int PTTSNET_BUFFER_A (int td, char *text, char **speech, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SBUFFER_A (int td, char *file, char **speech, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_FILE_A (int td, char *text, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SFILE_A (int td, char *file, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_RFILE_A (int td, char *text, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SRFILE_A (int td, char *file, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_BUFFER_H (int td, char *text, char **speech, char *highlight, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SBUFFER_H (int td, char *file, char **speech, char *highlight, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_FILE_H (int td, char *text, char *path, char *highlight, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SFILE_H (int td, char *file, char *path, char *highlight, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_BUFFER_A_EX (int td, char *text, char **speech, char *highlight, char *lipsync, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SBUFFER_A_EX (int td, char *file, char **speech, char *highlight, char *lipsync, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_FILE_A_EX (int td, char *text, char *path, char *highlight, char *lipsync, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SFILE_A_EX (int td, char *file, char *path, char *highlight, char *lipsync, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_RFILE_A_EX (int td, char *text, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SRFILE_A_EX (int td, char *file, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, char *audio_file, int audio_offset, float *elapsed_time); /* * PTTSNET Simple function prototype definitions: */ DllExport int PTTSNET_FILE_S (int td, char *text, char *path, int sformat); DllExport int PTTSNET_RFILE_S (int td, char *text, char *path, int sformat); DllExport int PTTSNET_BUFFER_S (int td, char *text, char **speech, int sformat); DllExport int PTTSNET_SFILE_S (int td, char *file, char *path, int sformat); DllExport int PTTSNET_SRFILE_S (int td, char *file, char *path, int sformat); DllExport int PTTSNET_SBUFFER_S (int td, char *file, char **speech, int sformat); DllExport int PTTSNET_OPEN_S (int td, char *text, int sformat); DllExport int PTTSNET_CLOSE_S (int fd); DllExport int PTTSNET_BUFFER_T_EX (int language, int speakerid, char *host, char *port, int connection_timeout, int read_timeout, char *text, char **speech, char *highlight, char *lipsync, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, int nPauseLenSent, int nPauseLenComma, int nReadGwalho, int nSentDelimLF, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SBUFFER_T_EX (int language, int speakerid, char *host, char *port, int connection_timeout, int read_timeout, char *file, char **speech, char *highlight, char *lipsync, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, int nPauseLenSent, int nPauseLenComma, int nReadGwalho, int nSentDelimLF, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_FILE_T_EX (int language, int speakerid, char *host, char *port, int connection_timeout, int read_timeout, char *text, char *path, char *highlight, char *lipsync, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, int nPauseLenSent, int nPauseLenComma, int nReadGwalho, int nSentDelimLF, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SFILE_T_EX (int language, int speakerid, char *host, char *port, int connection_timeout, int read_timeout, char *file, char *path, char *highlight, char *lipsync, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, int nPauseLenSent, int nPauseLenComma, int nReadGwalho, int nSentDelimLF, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_RFILE_T_EX (int language, int speakerid, char *host, char *port, int connection_timeout, int read_timeout, char *text, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, int nPauseLenSent, int nPauseLenComma, int nReadGwalho, int nSentDelimLF, char *audio_file, int audio_offset, float *elapsed_time); DllExport int PTTSNET_SRFILE_T_EX (int language, int speakerid, char *host, char *port, int connection_timeout, int read_timeout, char *file, char *path, int sformat, int pitch, int speed, int volume, int nflag, int content_type, int charset, int vc_type, int nPauseLenSent, int nPauseLenComma, int nReadGwalho, int nSentDelimLF, char *audio_file, int audio_offset, float *elapsed_time); /* * PTTSNET Debug/Log function prototype definitions: */ DllExport void PTTSNET_OPENLOG (int debuglevel, char *logfile, int maxlogsize, int maxrotate); DllExport void PTTSNET_CLOSELOG (void); DllExport void plprintf (int level, int channel_id, const char *fmt,...); #if defined(__cplusplus) } #endif #endif /* _PTTSNET_H_ */