Skip to content

Commit

Permalink
Also load espeak-ng-fallback and dummy on autodetection
Browse files Browse the repository at this point in the history
In case the user configuration breaks all modules, we will fallback to
espeak-ng without configuration, and at really worse, on dummy.
  • Loading branch information
sthibaul committed Mar 18, 2024
1 parent f10532f commit 6f6dcc0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions src/server/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ char *parse_list(const char *buf, const int bytes, const int fd,
for (i = 0; i < len; i++) {
mod = g_list_nth_data(output_modules, i);
if (strcmp(mod->name, "dummy") &&
strcmp(mod->name, "espeak-ng-fallback") &&
strcmp(mod->name, "generic"))
g_string_append_printf(result, C_OK_MODULES
"-%s" NEWLINE,
Expand Down
44 changes: 22 additions & 22 deletions src/server/speechd.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,30 +816,30 @@ static gboolean speechd_load_configuration(gpointer user_data)
g_list_delete_link(detected_modules,
detected_modules);
}
} else {
/* Try to make sure we have something that can speak (with no user parameter) */
module_add_load_request(
g_strdup("espeak-ng-fallback"),
g_strdup("sd_espeak-ng"),
NULL,
g_strdup_printf("%s/%s.log",
SpeechdOptions.log_dir,
"espeak-ng"),
NULL,
NULL);

/* At worse, tell what is happening */
module_add_load_request(
g_strdup("dummy"),
g_strdup("sd_dummy"),
NULL,
g_strdup_printf("%s/%s.log",
SpeechdOptions.log_dir,
"dummy"),
NULL,
NULL);
}

/* Try to make sure we have something that can speak (with no user parameter) */
module_add_load_request(
g_strdup("espeak-ng-fallback"),
g_strdup("sd_espeak-ng"),
g_strdup(""),
g_strdup_printf("%s/%s.log",
SpeechdOptions.log_dir,
"espeak-ng-fallback"),
NULL,
NULL);

/* At worse, tell what is happening */
module_add_load_request(
g_strdup("dummy"),
g_strdup("sd_dummy"),
g_strdup(""),
g_strdup_printf("%s/%s.log",
SpeechdOptions.log_dir,
"dummy"),
NULL,
NULL);

module_load_requested_modules();
} else {
MSG(1, "Can't open %s", SpeechdOptions.conf_file);
Expand Down

0 comments on commit 6f6dcc0

Please sign in to comment.