Browse Source

Add espeak_TextToPhonemesWithTerminator (#2127)

master
Jonathan McDowell 3 months ago
parent
commit
2108b1e8ae
No account linked to committer's email address
2 changed files with 13 additions and 2 deletions
  1. 6
    0
      src/include/espeak-ng/speak_lib.h
  2. 7
    2
      src/libespeak-ng/speech.c

+ 6
- 0
src/include/espeak-ng/speak_lib.h View File



*/ */


#ifdef __cplusplus
extern "C"
#endif
ESPEAK_API const char *espeak_TextToPhonemesWithTerminator(const void **textptr, int textmode, int phonememode, int *terminator);
/* Version of espeak_TextToPhonemes that also returns the clause terminator (e.g., CLAUSE_INTONATION_FULL_STOP) */

#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif

+ 7
- 2
src/libespeak-ng/speech.c View File

f_trans = stderr; f_trans = stderr;
} }


ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode)
ESPEAK_API const char* espeak_TextToPhonemesWithTerminator(const void** textptr, int textmode, int phonememode, int* terminator)
{ {
/* phoneme_mode /* phoneme_mode
bit 1: 0=eSpeak's ascii phoneme names, 1= International Phonetic Alphabet (as UTF-8 characters). bit 1: 0=eSpeak's ascii phoneme names, 1= International Phonetic Alphabet (as UTF-8 characters).
if (text_decoder_decode_string_multibyte(p_decoder, *textptr, translator->encoding, textmode) != ENS_OK) if (text_decoder_decode_string_multibyte(p_decoder, *textptr, translator->encoding, textmode) != ENS_OK)
return NULL; return NULL;


TranslateClause(translator, NULL, NULL);
TranslateClauseWithTerminator(translator, NULL, NULL, terminator);
*textptr = text_decoder_get_buffer(p_decoder); *textptr = text_decoder_get_buffer(p_decoder);


return GetTranslatedPhonemeString(phonememode); return GetTranslatedPhonemeString(phonememode);
} }


ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode)
{
return espeak_TextToPhonemesWithTerminator(textptr, textmode, phonememode, NULL);
}

ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Cancel(void) ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Cancel(void)
{ {
#if USE_ASYNC #if USE_ASYNC

Loading…
Cancel
Save