speak_lib.h
来自「a good tool for converting text to speec」· C头文件 代码 · 共 594 行 · 第 1/2 页
H
594 行
unsigned int* unique_identifier, void* user_data);/* Synthesize speech for the specified text. Similar to espeak_Synth() but the start position is specified by the name of a <mark> element in the text. index_mark: The "name" attribute of a <mark> element within the text which specified the point at which synthesis starts. UTF8 string. For the other parameters, see espeak_Synth() Return: EE_OK: operation achieved EE_BUFFER_FULL: the command can not be buffered; you may try after a while to call the function again. EE_INTERNAL_ERROR.*/#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_ERROR espeak_Key(const char *key_name);/* Speak the name of a keyboard key. Currently this just speaks the "key_name" as given Return: EE_OK: operation achieved EE_BUFFER_FULL: the command can not be buffered; you may try after a while to call the function again. EE_INTERNAL_ERROR.*/#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_ERROR espeak_Char(wchar_t character);/* Speak the name of the given character Return: EE_OK: operation achieved EE_BUFFER_FULL: the command can not be buffered; you may try after a while to call the function again. EE_INTERNAL_ERROR.*//* Note, there is no function to play a sound icon. This would be done by the calling program */ /***********************/ /* Speech Parameters */ /***********************/typedef enum { espeakSILENCE=0, /* internal use */ espeakRATE=1, espeakVOLUME=2, espeakPITCH=3, espeakRANGE=4, espeakPUNCTUATION=5, espeakCAPITALS=6, espeakWORDGAP=7, espeakOPTIONS=8, // reserved for misc. options. not yet used espeakINTONATION=9, espeakRESERVED1=10, espeakRESERVED2=11, espeakEMPHASIS, /* internal use */ espeakLINELENGTH, /* internal use */ espeakVOICETYPE, // internal, 1=mbrola N_SPEECH_PARAM /* last enum */} espeak_PARAMETER;typedef enum { espeakPUNCT_NONE=0, espeakPUNCT_ALL=1, espeakPUNCT_SOME=2} espeak_PUNCT_TYPE;#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);/* Sets the value of the specified parameter. relative=0 Sets the absolute value of the parameter. relative=1 Sets a relative value of the parameter. parameter: espeakRATE: speaking speed in word per minute. espeakVOLUME: volume in range 0-100 0=silence espeakPITCH: base pitch, range 0-100. 50=normal espeakRANGE: pitch range, range 0-100. 0-monotone, 50=normal espeakPUNCTUATION: which punctuation characters to announce: value in espeak_PUNCT_TYPE (none, all, some), see espeak_GetParameter() to specify which characters are announced. espeakCAPITALS: announce capital letters by: 0=none, 1=sound icon, 2=spelling, 3 or higher, by raising pitch. This values gives the amount in Hz by which the pitch of a word raised to indicate it has a capital letter. espeakWORDGAP: pause between words, units of 10mS (at the default speed) Return: EE_OK: operation achieved EE_BUFFER_FULL: the command can not be buffered; you may try after a while to call the function again. EE_INTERNAL_ERROR.*/#ifdef __cplusplusextern "C"#endifESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current);/* current=0 Returns the default value of the specified parameter. current=1 Returns the current value of the specified parameter, as set by SetParameter()*/#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);/* Specified a list of punctuation characters whose names are to be spoken when the value of the Punctuation parameter is set to "some". punctlist: A list of character codes, terminated by a zero character. Return: EE_OK: operation achieved EE_BUFFER_FULL: the command can not be buffered; you may try after a while to call the function again. EE_INTERNAL_ERROR.*/#ifdef __cplusplusextern "C"#endifESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream);/* Controls the output of phoneme symbols for the text value=0 No phoneme output (default) value=1 Output the translated phoneme symbols for the text value=2 as (1), but also output a trace of how the translation was done (matching rules and list entries) stream output stream for the phoneme symbols (and trace). If stream=NULL then it uses stdout.*/#ifdef __cplusplusextern "C"#endifESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log);/* Compile pronunciation dictionary for a language which corresponds to the currently selected voice. The required voice should be selected before calling this function. path: The directory which contains the language's '_rules' and '_list' files. 'path' should end with a path separator character ('/'). log: Stream for error reports and statistics information. If log=NULL then stderr will be used.*/ /***********************/ /* Voice Selection */ /***********************/// voice tabletypedef struct { char *name; // a given name for this voice. UTF8 string. char *languages; // list of pairs of (byte) priority + (string) language (and dialect qualifier) char *identifier; // the filename for this voice within espeak-data/voices unsigned char gender; // 0=none 1=male, 2=female, unsigned char age; // 0=not specified, or age in years unsigned char variant; // only used when passed as a parameter to espeak_SetVoiceByProperties unsigned char xx1; // for internal use int score; // for internal use void *spare; // for internal use} espeak_VOICE;/* Note: The espeak_VOICE structure is used for two purposes: 1. To return the details of the available voices. 2. As a parameter to espeak_SetVoiceByProperties() in order to specify selection criteria. In (1), the "languages" field consists of a list of (UTF8) language names for which this voice may be used, each language name in the list is terminated by a zero byte and is also preceded by a single byte which gives a "priority" number. The list of languages is terminated by an additional zero byte. A language name consists of a language code, optionally followed by one or more qualifier (dialect) names separated by hyphens (eg. "en-uk"). A voice might, for example, have languages "en-uk" and "en". Even without "en" listed, voice would still be selected for the "en" language (because "en-uk" is related) but at a lower priority. The priority byte indicates how the voice is preferred for the language. A low number indicates a more preferred voice, a higher number indicates a less preferred voice. In (2), the "languages" field consists simply of a single (UTF8) language name, with no preceding priority byte.*/#ifdef __cplusplusextern "C"#endifESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);/* Reads the voice files from espeak-data/voices and creates an array of espeak_VOICE pointers. The list is terminated by a NULL pointer If voice_spec is NULL then all voices are listed. If voice spec is give, then only the voices which are compatible with the voice_spec are listed, and they are listed in preference order.*/#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name);/* Searches for a voice with a matching "name" field. Language is not considered. "name" is a UTF8 string. Return: EE_OK: operation achieved EE_BUFFER_FULL: the command can not be buffered; you may try after a while to call the function again. EE_INTERNAL_ERROR.*/#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);/* An espeak_VOICE structure is used to pass criteria to select a voice. Any of the following fields may be set: name NULL, or a voice name languages NULL, or a single language string (with optional dialect), eg. "en-uk", or "en" gender 0=not specified, 1=male, 2=female age 0=not specified, or an age in years variant After a list of candidates is produced, scored and sorted, "variant" is used to index that list and choose a voice. variant=0 takes the top voice (i.e. best match). variant=1 takes the next voice, etc*/#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void);/* Returns the espeak_VOICE data for the currently selected voice. This is not affected by temporary voice changes caused by SSML elements such as <voice> and <s>*/#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_ERROR espeak_Cancel(void);/* Stop immediately synthesis and audio output of the current text. When this function returns, the audio output is fully stopped and the synthesizer is ready to synthesize a new message. Return: EE_OK: operation achieved EE_INTERNAL_ERROR.*/#ifdef __cplusplusextern "C"#endifESPEAK_API int espeak_IsPlaying(void);/* Returns 1 if audio is played, 0 otherwise.*/#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_ERROR espeak_Synchronize(void);/* This function returns when all data have been spoken. Return: EE_OK: operation achieved EE_INTERNAL_ERROR.*/#ifdef __cplusplusextern "C"#endifESPEAK_API espeak_ERROR espeak_Terminate(void);/* last function to be called. Return: EE_OK: operation achieved EE_INTERNAL_ERROR.*/#ifdef __cplusplusextern "C"#endifESPEAK_API const char *espeak_Info(void* ptr);/* Returns the version number string. The parameter is for future use, and should be set to NULL*/#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?