aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asm/jo_r_loop.asm4
-rw-r--r--src/jo_lowbat.c7
-rw-r--r--src/jo_lowbat.h3
-rw-r--r--src/jo_n_notify.c11
-rw-r--r--src/jo_n_speak.c34
-rw-r--r--src/jo_n_speak.h6
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 *);