From ea0eca4f717d7f4408273613a566f3550d27085b Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 27 Apr 2020 01:02:18 +0200 Subject: Rewrite started --- src/jo_n_notify.c | 31 ------------------------------- src/jo_n_notify.h | 29 ----------------------------- src/jo_n_speak.c | 45 --------------------------------------------- src/jo_n_speak.h | 34 ---------------------------------- src/n_notify.c | 31 +++++++++++++++++++++++++++++++ src/n_notify.h | 29 +++++++++++++++++++++++++++++ src/n_speak.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/n_speak.h | 34 ++++++++++++++++++++++++++++++++++ 8 files changed, 139 insertions(+), 139 deletions(-) delete mode 100644 src/jo_n_notify.c delete mode 100644 src/jo_n_notify.h delete mode 100644 src/jo_n_speak.c delete mode 100644 src/jo_n_speak.h create mode 100644 src/n_notify.c create mode 100644 src/n_notify.h create mode 100644 src/n_speak.c create mode 100644 src/n_speak.h (limited to 'src') diff --git a/src/jo_n_notify.c b/src/jo_n_notify.c deleted file mode 100644 index f98ea1d..0000000 --- a/src/jo_n_notify.c +++ /dev/null @@ -1,31 +0,0 @@ -/****************************************************************************************/ -/* */ -/* File : jo_n_notify.c /_________/ */ -/* Author : Joe | */ -/* Date : 04/2020 | */ -/* Info : Uses libnotify lib to notify | */ -/* / | */ -/* \ / */ -/* \_____/ */ -/* */ -/****************************************************************************************/ - -#include - -void -jo_n_notify -(const char head[], - const char body[], - NotifyUrgency u, - int32_t t) -{ - NotifyNotification *n; - - notify_init(JO_LOWBAT); - n = notify_notification_new(head, body, NULL); - notify_notification_set_urgency(n, u); - notify_notification_set_timeout(n, t); - notify_notification_show(n, NULL); - notify_uninit(); - n = NULL; -} diff --git a/src/jo_n_notify.h b/src/jo_n_notify.h deleted file mode 100644 index a72395a..0000000 --- a/src/jo_n_notify.h +++ /dev/null @@ -1,29 +0,0 @@ -/****************************************************************************************/ -/* */ -/* File : jo_n_notify.h /_________/ */ -/* Author : Joe | */ -/* Date : 04/2020 | */ -/* Info : Uses libnotify lib to notify | */ -/* / | */ -/* \ / */ -/* \_____/ */ -/* */ -/****************************************************************************************/ - -#ifndef JO_N_NOTIFY_H -#define JO_N_NOTIFY_H - -#include -#include -#include - -#define JO_LOWBAT "lowbat" - -void jo_n_notify( - const char[], - const char[], - NotifyUrgency, - int32_t - ); - -#endif diff --git a/src/jo_n_speak.c b/src/jo_n_speak.c deleted file mode 100644 index 48fcbaa..0000000 --- a/src/jo_n_speak.c +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************************************/ -/* */ -/* File : jo_n_speak.c /_________/ */ -/* Author : Joe | */ -/* Date : 04/2020 | */ -/* Info : Uses espeak lib to speak | */ -/* / | */ -/* \ / */ -/* \_____/ */ -/* */ -/****************************************************************************************/ - -#include - -void -jo_n_speak(const char *msg) -{ - 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 deleted file mode 100644 index 79ca683..0000000 --- a/src/jo_n_speak.h +++ /dev/null @@ -1,34 +0,0 @@ -/****************************************************************************************/ -/* */ -/* File : jo_n_speak.h /_________/ */ -/* Author : Joe | */ -/* Date : 04/2020 | */ -/* Info : Use espeak lib to speak | */ -/* / | */ -/* \ / */ -/* \_____/ */ -/* */ -/****************************************************************************************/ - -#ifndef JO_N_SPEAK_H -#define JO_N_SPEAK_H - -#include -#include -#include -#include -#include -#include - -enum -{ - JO_RET_FINE, - JO_RET_RD_FAILED, - JO_RET_ESPEAK_FAILED -}; - -#define JO_ESPEAK_VOICE "English" - -void jo_n_speak(const char *); - -#endif diff --git a/src/n_notify.c b/src/n_notify.c new file mode 100644 index 0000000..3ed6d40 --- /dev/null +++ b/src/n_notify.c @@ -0,0 +1,31 @@ +/* ************************************************************************************ */ +/* */ +/* File : n_notify.c /_________/ */ +/* Author : Joe | */ +/* Date : 04/2020 | */ +/* Info : Uses libnotify lib to notify | */ +/* / | */ +/* \ / */ +/* \_____/ */ +/* */ +/* ************************************************************************************ */ + +#include + +void +jo_n_notify +(const char head[], + const char body[], + NotifyUrgency u, + int32_t t) +{ + NotifyNotification *n; + + notify_init(JO_LOWBAT); + n = notify_notification_new(head, body, NULL); + notify_notification_set_urgency(n, u); + notify_notification_set_timeout(n, t); + notify_notification_show(n, NULL); + notify_uninit(); + n = NULL; +} diff --git a/src/n_notify.h b/src/n_notify.h new file mode 100644 index 0000000..0c69fa7 --- /dev/null +++ b/src/n_notify.h @@ -0,0 +1,29 @@ +/* ************************************************************************************ */ +/* */ +/* File : n_notify.h /_________/ */ +/* Author : Joe | */ +/* Date : 04/2020 | */ +/* Info : Uses libnotify lib to notify | */ +/* / | */ +/* \ / */ +/* \_____/ */ +/* */ +/* ************************************************************************************ */ + +#ifndef JO_N_NOTIFY_H +#define JO_N_NOTIFY_H + +#include +#include +#include + +#define JO_LOWBAT "lowbat" + +void jo_n_notify( + const char[], + const char[], + NotifyUrgency, + int32_t + ); + +#endif diff --git a/src/n_speak.c b/src/n_speak.c new file mode 100644 index 0000000..c6d46f0 --- /dev/null +++ b/src/n_speak.c @@ -0,0 +1,45 @@ +/* ************************************************************************************ */ +/* */ +/* File : n_speak.c /_________/ */ +/* Author : Joe | */ +/* Date : 04/2020 | */ +/* Info : Uses espeak lib to speak | */ +/* / | */ +/* \ / */ +/* \_____/ */ +/* */ +/* ************************************************************************************ */ + +#include + +void +jo_n_speak(const char *msg) +{ + 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/n_speak.h b/src/n_speak.h new file mode 100644 index 0000000..dd65b7e --- /dev/null +++ b/src/n_speak.h @@ -0,0 +1,34 @@ +/* ************************************************************************************ */ +/* */ +/* File : n_speak.h /_________/ */ +/* Author : Joe | */ +/* Date : 04/2020 | */ +/* Info : Use espeak lib to speak | */ +/* / | */ +/* \ / */ +/* \_____/ */ +/* */ +/* ************************************************************************************ */ + +#ifndef JO_N_SPEAK_H +#define JO_N_SPEAK_H + +#include +#include +#include +#include +#include +#include + +enum +{ + JO_RET_FINE, + JO_RET_RD_FAILED, + JO_RET_ESPEAK_FAILED +}; + +#define JO_ESPEAK_VOICE "English" + +void jo_n_speak(const char *); + +#endif -- cgit v1.2.3