espeakup: Upgrade to version 0.90 (#7573)

This commit is contained in:
Sumynwa 2024-02-20 15:12:08 +05:30 коммит произвёл GitHub
Родитель 0affcff47d
Коммит 02c994b558
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
9 изменённых файлов: 32 добавлений и 282 удалений

Просмотреть файл

@ -1,24 +0,0 @@
From 5f01999726b606c038fa1cd38df421a8ba10baee Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sat, 30 Jun 2018 15:43:56 +0200
Subject: [PATCH] Make empty voice name select the default voice
See http://bugs.debian.org/872194
This fixes #11.
---
espeak.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/espeak.c b/espeak.c
index 5fd9342..8871d1b 100644
--- a/espeak.c
+++ b/espeak.c
@@ -311,7 +311,7 @@ int initialize_espeak(struct synth_t *s)
espeak_SetSynthCallback(acsint_callback);
/* Setup initial voice parameters */
- if (defaultVoice) {
+ if (defaultVoice && defaultVoice[0]) {
set_voice(s, defaultVoice);
free(defaultVoice);
defaultVoice = NULL;

Просмотреть файл

@ -1,14 +1,17 @@
[Unit]
Description=Connector between espeak-ng userspace synthesizer and speakup kernel module
Wants=dev-softsynthu.device
After=sound.target
Description=Software speech output for Speakup
Documentation=man:espeakup(8)
Wants=systemd-udev-settle.service
After=systemd-udev-settle.service sound.target
[Service]
Type=forking
PIDFile=/var/run/espeakup.pid
ExecStart=/bin/sh -c '/usr/bin/espeakup -V en+f2'
ExecReload=/bin/kill $MAINPID
PIDFile=/run/espeakup.pid
Environment="default_voice="
ExecStartPre=+modprobe speakup_soft
ExecStart=/usr/bin/espeakup --default-voice=${default_voice}
ExecReload=kill -HUP $MAINPID
Restart=always
[Install]
WantedBy=sound.target multi-user.target
WantedBy=sound.target

Просмотреть файл

@ -1,7 +1,7 @@
{
"Signatures": {
"espeakup-0.80.tar.gz": "4de284e30b6bdb0f9dee9c8ea02d13a3d20a61415b812338446b8b381e997ef4",
"espeakup-0.90.tar.gz": "c708a0c3889466a7aa14a52687af8f49abb4dfb01fb9afbeb1e2507247494432",
"espeakup.conf": "ba35728af4a472f8abf727efb8efc080f89ac358da49a68071fd407379f319c4",
"espeakup.service": "7dde4063f5525e7545ebc64f7dbb232ee81d1a2a43845ad34c51aeb171a7a1f6"
"espeakup.service": "298c8fcef28ca639c6d32c860e9e5cf088a993028242f21042792bd2ec7a2a4b"
}
}
}

Просмотреть файл

@ -1,25 +1,21 @@
Summary: Connector for espeak and speakup
Name: espeakup
Version: 0.80
Release: 2%{?dist}
Version: 0.90
Release: 1%{?dist}
License: GPLv3
Vendor: Microsoft Corporation
Distribution: Azure Linux
URL: https://github.com/williamh/espeakup
#Source0: https://github.com/williamh/%{name}/archive/v%{version}.tar.gz
Source0: %{name}-%{version}.tar.gz
URL: https://github.com/linux-speakup/espeakup
Source0: https://github.com/linux-speakup/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: %{name}.conf
Source2: %{name}.service
Patch0: unicode-device.patch
Patch1: speaking-spaces.patch
Patch2: support-pauses.patch
Patch3: default-voice.patch
Patch4: missing-mutex-calls.patch
BuildRequires: alsa-lib-devel
BuildRequires: espeak-ng-devel
BuildRequires: gcc
BuildRequires: make
BuildRequires: meson
BuildRequires: systemd
Requires: espeak-ng
Requires: glibc
Requires: kernel-drivers-accessibility
Requires: systemd
@ -27,31 +23,35 @@ Requires: systemd
espeakup is a light weight connector for espeak and speakup.
%prep
%autosetup
%autosetup -p1
%build
make %{_smp_mflags}
%meson -Dsystemd=enabled -Dman=disabled
%meson_build
%install
make DESTDIR=%{buildroot} PREFIX=%{_prefix} install
export MESON_INSTALL_DESTDIR_PREFIX=%{buildroot}%{_prefix} %meson_install
mkdir -p %{buildroot}%{_libdir}/modules-load.d
install -m755 %{SOURCE1} %{buildroot}%{_libdir}/modules-load.d/%{name}.conf
mkdir -p %{buildroot}%{_libdir}/systemd/system
install -m755 %{SOURCE2} %{buildroot}%{_libdir}/systemd/system/%{name}.service
# %check
# This package has no check section as of version 0.80
# This package has no check section as of version 0.90
%files
%defattr(-,root,root)
%license COPYING
%doc ChangeLog README
%doc README.md
%{_bindir}/%{name}
%{_libdir}/systemd/system/%{name}.service
%{_libdir}/modules-load.d/%{name}.conf
%{_mandir}/man8/*
%changelog
* Wed Jan 31 2024 Sumedh Sharma <sumsharma@microsoft.com> - 0.90-1
- Bump version to 0.90.
- Remove unneeded patch files.
* Wed Sep 20 2023 Jon Slobodzian <joslobo@microsoft.com> - 0.80-2
- Recompile with stack-protection fixed gcc version (CVE-2023-4039)

Просмотреть файл

@ -1,24 +0,0 @@
From e69d61b2d88d8dc679558dea03c48130127102ac Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sat, 30 Jun 2018 15:45:24 +0200
Subject: [PATCH] signal: Add missing mutex_lock/unlock around the while loop
This fixes #12.
---
signal.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/signal.c b/signal.c
index 102c3cf..3096b30 100644
--- a/signal.c
+++ b/signal.c
@@ -63,7 +63,9 @@ void *signal_thread(void *arg)
printf("espeakup caught signal %d\n", sig);
break;
}
+ pthread_mutex_lock(&queue_guard);
}
+ pthread_mutex_unlock(&queue_guard);
/* Tell the reader to stop, if it is in a select() call. */
write(PIPE_WRITE_FD, STOP_MSG, strlen(STOP_MSG));
return NULL;

Просмотреть файл

@ -1,31 +0,0 @@
From a5b655ddb066eb5915117452f62937b2a9bf3256 Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Tue, 14 Mar 2017 21:56:31 -0500
Subject: [PATCH] fix speaking spaces
Espeak doesn't speak spaces unless it is specifically told to do so.
---
espeak.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/espeak.c b/espeak.c
index f09d3c4..f1f8064 100644
--- a/espeak.c
+++ b/espeak.c
@@ -170,9 +170,13 @@ static espeak_ERROR speak_text(struct synth_t *s)
if (espeakup_mode == ESPEAKUP_MODE_SPEAKUP && (s->len == 1)) {
char *buf;
int n;
- n = asprintf(&buf,
- "<say-as interpret-as=\"characters\">%c</say-as>",
- s->buf[0]);
+ if (s->buf[0] == ' ')
+ n = asprintf(&buf,
+ "<say-as interpret-as=\"tts:char\">&#32;</say-as>");
+ else
+ n = asprintf(&buf,
+ "<say-as interpret-as=\"characters\">%c</say-as>",
+ s->buf[0]);
if (n == -1) {
/* D'oh. Not much to do on allocation failure.
* Perhaps espeak will happen to say the character */

Просмотреть файл

@ -1,149 +0,0 @@
From 5339da3144f394eb6e6dd3df116b854d78476565 Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sat, 30 Jun 2018 15:41:20 +0200
Subject: [PATCH] Support audio pauses
When the Linux console is e.g. switched to a graphical VT, the kernel
emits \x01P to notify that it is not able to read the screen any more,
and the software synthesis can thus release the audio card, for other
screen readers to take over.
This implements it by adding a paused_espeak variable that tracks
whether we have suspended espeak. When more text comes, we can simply
reinitialize espeak.
This fixes #10.
---
espeak.c | 40 ++++++++++++++++++++++++++++++++++++++++
espeakup.c | 3 ++-
espeakup.h | 2 ++
softsynth.c | 3 +++
4 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/espeak.c b/espeak.c
index f1f8064..5fd9342 100644
--- a/espeak.c
+++ b/espeak.c
@@ -40,6 +40,7 @@ const int rateOffset = 80;
const int volumeMultiplier = 22;
volatile int stop_requested = 0;
+int paused_espeak = 1;
static int acsint_callback(short *wav, int numsamples, espeak_EVENT * events)
{
@@ -211,6 +212,32 @@ static void synth_queue_clear()
}
}
+static void reinitialize_espeak(struct synth_t *s)
+{
+ int rate;
+
+ /* Re-initialize espeak */
+ rate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 50, NULL, 0);
+ if (rate < 0) {
+ fprintf(stderr, "Unable to initialize espeak.\n");
+ return;
+ }
+
+ /* We need a callback in acsint mode, but not in speakup mode. */
+ if (espeakup_mode == ESPEAKUP_MODE_ACSINT)
+ espeak_SetSynthCallback(acsint_callback);
+
+ /* Set parameters again */
+ espeak_SetVoiceByName(s->voice);
+ espeak_SetParameter(espeakRANGE, s->frequency * frequencyMultiplier, 0);
+ espeak_SetParameter(espeakPITCH, s->pitch * pitchMultiplier, 0);
+ espeak_SetParameter(espeakRATE, s->rate * rateMultiplier + rateOffset, 0);
+ espeak_SetParameter(espeakVOLUME, (s->volume + 1) * volumeMultiplier, 0);
+ espeak_SetParameter(espeakCAPITALS, 0, 0);
+ paused_espeak = 0;
+ return;
+}
+
static void queue_process_entry(struct synth_t *s)
{
espeak_ERROR error;
@@ -222,6 +249,11 @@ static void queue_process_entry(struct synth_t *s)
current = (struct espeak_entry_t *) queue_remove(synth_queue);
}
pthread_mutex_unlock(&queue_guard);
+
+ if (current->cmd != CMD_PAUSE && paused_espeak) {
+ reinitialize_espeak(s);
+ }
+
switch (current->cmd) {
case CMD_SET_FREQUENCY:
error = set_frequency(s, current->value, current->adjust);
@@ -246,6 +278,13 @@ static void queue_process_entry(struct synth_t *s)
s->len = current->len;
error = speak_text(s);
break;
+ case CMD_PAUSE:
+ if (!paused_espeak) {
+ espeak_Cancel();
+ espeak_Terminate();
+ paused_espeak = 1;
+ }
+ break;
default:
break;
}
@@ -282,6 +321,7 @@ int initialize_espeak(struct synth_t *s)
set_rate(s, defaultRate, ADJ_SET);
set_volume(s, defaultVolume, ADJ_SET);
espeak_SetParameter(espeakCAPITALS, 0, 0);
+ paused_espeak = 0;
return 0;
}
diff --git a/espeakup.c b/espeakup.c
index 1981430..eda3e9c 100644
--- a/espeakup.c
+++ b/espeakup.c
@@ -231,7 +231,8 @@ int main(int argc, char **argv)
pthread_join(softsynth_thread_id, NULL);
pthread_join(espeak_thread_id, NULL);
- espeak_Terminate();
+ if (!paused_espeak)
+ espeak_Terminate();
close_softsynth();
out:
diff --git a/espeakup.h b/espeakup.h
index 8fc0ee2..e8e89a7 100644
--- a/espeakup.h
+++ b/espeakup.h
@@ -45,6 +45,7 @@ enum command_t {
CMD_SET_VOLUME,
CMD_SPEAK_TEXT,
CMD_FLUSH,
+ CMD_PAUSE,
CMD_UNKNOWN,
};
@@ -86,6 +87,7 @@ extern void close_softsynth(void);
extern void *softsynth_thread(void *arg);
extern volatile int should_run;
extern volatile int stop_requested;
+extern int paused_espeak;
extern int self_pipe_fds[2];
#define PIPE_READ_FD (self_pipe_fds[0])
#define PIPE_WRITE_FD (self_pipe_fds[1])
diff --git a/softsynth.c b/softsynth.c
index efa2351..ca9c5c3 100644
--- a/softsynth.c
+++ b/softsynth.c
@@ -133,6 +133,9 @@ static int process_command(struct synth_t *s, char *buf, int start)
case 'v':
cmd = CMD_SET_VOLUME;
break;
+ case 'P':
+ cmd = CMD_PAUSE;
+ break;
default:
cmd = CMD_UNKNOWN;
break;

Просмотреть файл

@ -1,25 +0,0 @@
From b7fe3af320226600c6162252f040b21d6323e07c Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Tue, 14 Mar 2017 21:52:14 -0500
Subject: [PATCH] add unicode variant of /dev/softsynth
---
softsynth.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/softsynth.c b/softsynth.c
index 3394434..efa2351 100644
--- a/softsynth.c
+++ b/softsynth.c
@@ -235,7 +235,10 @@ int open_softsynth(void)
}
/* open the softsynth. */
- softFD = open("/dev/softsynth", O_RDWR | O_NONBLOCK);
+ softFD = open("/dev/softsynthu", O_RDWR | O_NONBLOCK);
+ if (softFD < 0 && errno == ENOENT)
+ /* Kernel without unicode support? Try without unicode. */
+ softFD = open("/dev/softsynth", O_RDWR | O_NONBLOCK);
if (softFD < 0) {
perror("Unable to open the softsynth device");
rc = -1;

Просмотреть файл

@ -3298,8 +3298,8 @@
"type": "other",
"other": {
"name": "espeakup",
"version": "0.80",
"downloadUrl": "https://github.com/williamh/espeakup/archive/v0.80.tar.gz"
"version": "0.90",
"downloadUrl": "https://github.com/linux-speakup/espeakup/archive/refs/tags/v0.90.tar.gz"
}
}
},