audio/espeak-ng: import upstream patch for support of "Piper"

This patch imports the upstream pull request #2127 that has been
accepted on 2025-03-04.

It adds the espeak_TextToPhonemesWithTerminator() function to the
library, which is required by the Piper text to speech software.

PR:		287241
This commit is contained in:
Kenneth Raplee
2025-06-03 08:46:34 +02:00
committed by Stefan Eßer
parent fd6a710e19
commit e54088787f
3 changed files with 44 additions and 0 deletions
+1
View File
@@ -1,5 +1,6 @@
PORTNAME= espeak-ng
PORTVERSION= 1.52.0
PORTREVISION= 1
CATEGORIES= audio
#MASTER_SITES= https://github.com/espeak-ng/${PORTNAME}/releases/download/${PORTVERSION}/
@@ -0,0 +1,15 @@
--- src/include/espeak-ng/speak_lib.h.orig 2024-12-12 13:28:01 UTC
+++ src/include/espeak-ng/speak_lib.h
@@ -544,6 +544,12 @@ extern "C"
#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
+extern "C"
+#endif
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags);
/* Compile pronunciation dictionary for a language which corresponds to the currently
selected voice. The required voice should be selected before calling this function.
@@ -0,0 +1,28 @@
--- src/libespeak-ng/speech.c.orig 2024-12-12 13:28:01 UTC
+++ src/libespeak-ng/speech.c
@@ -850,7 +850,7 @@ ESPEAK_API void espeak_SetPhonemeTrace(int phonememode
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
bit 1: 0=eSpeak's ascii phoneme names, 1= International Phonetic Alphabet (as UTF-8 characters).
@@ -864,10 +864,15 @@ ESPEAK_API const char *espeak_TextToPhonemes(const voi
if (text_decoder_decode_string_multibyte(p_decoder, *textptr, translator->encoding, textmode) != ENS_OK)
return NULL;
- TranslateClause(translator, NULL, NULL);
+ TranslateClauseWithTerminator(translator, NULL, NULL, terminator);
*textptr = text_decoder_get_buffer(p_decoder);
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)