diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-18 16:02:21 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-18 16:02:21 +0200 |
commit | 9a364f3ad2056fba6260ab519e6efc13439ba2cb (patch) | |
tree | 87055f4004c0aec0fd03f1755a6a6b3887187dfe /src/jo_n_speak.c | |
parent | eSpeak is the problem (diff) | |
download | lowbat-bsd-9a364f3ad2056fba6260ab519e6efc13439ba2cb.tar.gz lowbat-bsd-9a364f3ad2056fba6260ab519e6efc13439ba2cb.tar.bz2 lowbat-bsd-9a364f3ad2056fba6260ab519e6efc13439ba2cb.tar.xz lowbat-bsd-9a364f3ad2056fba6260ab519e6efc13439ba2cb.tar.zst lowbat-bsd-9a364f3ad2056fba6260ab519e6efc13439ba2cb.zip |
Everything is fine
Diffstat (limited to 'src/jo_n_speak.c')
-rw-r--r-- | src/jo_n_speak.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/jo_n_speak.c b/src/jo_n_speak.c index 5fc935e..48fcbaa 100644 --- a/src/jo_n_speak.c +++ b/src/jo_n_speak.c @@ -15,15 +15,31 @@ void jo_n_speak(const char *msg) { - espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, NULL, 0); - espeak_Synth(msg, - strlen(msg), - 0, - POS_CHARACTER, - 0, - espeakCHARS_UTF8 | espeakENDPAUSE, - NULL, - NULL); + espeak_ERROR err; + int32_t samplerate; + + samplerate = espeak_Initialize + (AUDIO_OUTPUT_PLAYBACK, + 500, + NULL, + 0); + if (samplerate == -1) { + dprintf(2, "Failed to initialize espeak\n"); + exit(JO_RET_ESPEAK_FAILED); + } + espeak_SetVoiceByName(JO_ESPEAK_VOICE); + err = espeak_Synth + (msg, + strlen(msg) + 1, + 0, + POS_CHARACTER, + 0, + espeakCHARS_AUTO | espeakENDPAUSE, + NULL, + NULL); + if (err != EE_OK) { + dprintf(STDERR_FILENO, "espeak synth error\n"); + } espeak_Synchronize(); espeak_Terminate(); } |