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 | |
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
-rw-r--r-- | asm/jo_r_loop.asm | 4 | ||||
-rw-r--r-- | src/jo_lowbat.c | 7 | ||||
-rw-r--r-- | src/jo_lowbat.h | 3 | ||||
-rw-r--r-- | src/jo_n_notify.c | 11 | ||||
-rw-r--r-- | src/jo_n_speak.c | 34 | ||||
-rw-r--r-- | src/jo_n_speak.h | 6 |
6 files changed, 43 insertions, 22 deletions
diff --git a/asm/jo_r_loop.asm b/asm/jo_r_loop.asm index a8b41e0..7a810be 100644 --- a/asm/jo_r_loop.asm +++ b/asm/jo_r_loop.asm @@ -25,8 +25,8 @@ jo_r_loop: mov ebp, edi speak1: - ;; cmp edx, 1 - ;; jne speak1 + cmp ebp, 1 + jne speak1 mov rdi, [rbx + 8 * 2] call jo_n_speak jmp speak1 diff --git a/src/jo_lowbat.c b/src/jo_lowbat.c index 1963b26..bcfd3c8 100644 --- a/src/jo_lowbat.c +++ b/src/jo_lowbat.c @@ -14,10 +14,9 @@ #include <libnotify/notify.h> int -main( - int argc, - const char *argv[] - ) +main +(int argc, + const char *argv[]) { return (jo_r_lowbat(argc, argv)); } diff --git a/src/jo_lowbat.h b/src/jo_lowbat.h index e56903a..2a664db 100644 --- a/src/jo_lowbat.h +++ b/src/jo_lowbat.h @@ -24,7 +24,8 @@ enum { JO_RET_FINE, - JO_RET_RD_FAILED + JO_RET_RD_FAILED, + JO_RET_ESPEAK_FAILED }; int8_t jo_r_lowbat( diff --git a/src/jo_n_notify.c b/src/jo_n_notify.c index 7abb827..a92f2b2 100644 --- a/src/jo_n_notify.c +++ b/src/jo_n_notify.c @@ -13,12 +13,11 @@ #include <jo_n_notify.h> void -jo_n_notify( - const char head[], - const char body[], - NotifyUrgency u, - int32_t t - ) +jo_n_notify +(const char head[], + const char body[], + NotifyUrgency u, + int32_t t) { NotifyNotification *n; 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(); } diff --git a/src/jo_n_speak.h b/src/jo_n_speak.h index c0eb40f..aedd837 100644 --- a/src/jo_n_speak.h +++ b/src/jo_n_speak.h @@ -13,9 +13,15 @@ #ifndef JO_N_SPEAK_H #define JO_N_SPEAK_H +#include <jo_lowbat.h> #include <espeak/speak_lib.h> #include <string.h> +#include <stdlib.h> #include <stddef.h> +#include <stdio.h> +#include <unistd.h> + +#define JO_ESPEAK_VOICE "English" void jo_n_speak(const char *); |