Skip to content

Commit

Permalink
Port to espeak-ng
Browse files Browse the repository at this point in the history
- use "english" as default voice when built with espeak-ng 1.49 and
  later,

- use "default" when built with espeak 1.48 and earlier,

- fixes Debian #877750 ("silence, loops, and errors if no voice set"),

- regression caused by espeak-ng 59ca718 ("Always use 'en' as the
  default voice/language.")
  • Loading branch information
quozl committed Oct 5, 2017
1 parent 3184978 commit 00ac552
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/espeak.c
Expand Up @@ -127,6 +127,14 @@ static GValueArray *espeak_voices = NULL;

// -----------------------------------------------------------------------------

const char* espeak_default_voice() {
#if ESPEAK_API_REVISION < 10
return "default";
#else
return "english";
#endif
}

Econtext *espeak_new (GstElement * emitter) {
init ();

Expand All @@ -150,7 +158,7 @@ Econtext *espeak_new (GstElement * emitter) {

self->pitch = 50;
self->rate = 170;
self->voice = ESPEAK_DEFAULT_VOICE;
self->voice = espeak_default_voice();
self->gap = 0;
self->track = ESPEAK_TRACK_NONE;

Expand Down
3 changes: 1 addition & 2 deletions src/espeak.h
Expand Up @@ -18,15 +18,14 @@
#ifndef ESPEAK_H
#define ESPEAK_H

#define ESPEAK_DEFAULT_VOICE "default"

#define ESPEAK_TRACK_NONE 0
#define ESPEAK_TRACK_WORD 1
#define ESPEAK_TRACK_MARK 2

struct _Econtext;
typedef struct _Econtext Econtext;

const char* espeak_default_voice();
Econtext *espeak_new (GstElement *);
void espeak_unref (Econtext *);

Expand Down
4 changes: 2 additions & 2 deletions src/gstespeak.c
Expand Up @@ -106,7 +106,7 @@ static void gst_espeak_class_init (GstEspeakClass * klass) {
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_VOICE,
g_param_spec_string ("voice", "Current voice",
"Current voice", ESPEAK_DEFAULT_VOICE,
"Current voice", espeak_default_voice (),
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_GAP,
g_param_spec_uint ("gap", "Gap",
Expand Down Expand Up @@ -144,7 +144,7 @@ static void gst_espeak_init (GstEspeak * self) {
self->text = NULL;
self->pitch = 0;
self->rate = 0;
self->voice = g_strdup (ESPEAK_DEFAULT_VOICE);
self->voice = g_strdup (espeak_default_voice ());
self->voices = espeak_get_voices ();
self->speak = espeak_new (GST_ELEMENT (self));

Expand Down

0 comments on commit 00ac552

Please sign in to comment.