#include #include #include #include #include #include #include #include #include #include #include // SocketWrapper.h #include #include #include #include #include #include #include #include #include //#include "SocketWrapper.h" #include "ulaw.h" #include "SayTranUtil.h" #define ERROR_SVR_INFO -1 #define ERROR_SVR_CONNECT -2 #define AUDIO_TYPE_MULAW 1 #define AUDIO_TYPE_PCM 2 #define ERR_INVALID_USER_LENGTH -100 #define ERR_RECV_RECOG_DATA -300 #define SUCCESS_SEND_DATA 100 #define SUCCESS_RECV_HEADER_DATA 200 #define SUCCESS_RECV_RECOG_DATA 300 #if defined(_16K_AUDIO_) #define SAMP_PER_MS 16 #elif defined(_8K_AUDIO_) #define SAMP_PER_MS 8 #else #define SAMP_PER_MS 16 #endif #define FRAME_SHIFT 10 * SAMP_PER_MS // One frame size // Open int VST_Connect_To_Server(char *server_ip, int server_port); // Close int VST_Disconnect(int sockfd); // Write (Send) int VST_Send_Header_Data(int sockfd, char *User, char *Type); int VST_Send_Audio_Data(int sockfd, char *data, short len); int VST_Send_Final_Data(int sockfd, char *data, int sample_rate, int type); // Read (Recv) int VST_Recv_Header_Data(int sockfd, int *code, int *size); int VST_Recv_Recog_Data(int sockfd, int size, char *result, FILE *output); // Option long VST_Get_filesize(FILE *fd);