From e1f8b66c054661217a896d8534c6b79047dc69e4 Mon Sep 17 00:00:00 2001 From: Barry Rowe Date: Wed, 4 Dec 2019 19:44:08 -0800 Subject: [PATCH] More build fixes. --- msg_hash.c | 2 +- retroarch.c | 62 ++++++++++++++++++++++++++--------------------------- retroarch.h | 6 +++--- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/msg_hash.c b/msg_hash.c index e38ba1fe43..36a14c1655 100644 --- a/msg_hash.c +++ b/msg_hash.c @@ -104,7 +104,7 @@ int menu_hash_get_help_enum(enum msg_hash_enums msg, char *s, size_t len) const char *get_user_language_iso639_1(bool limit) { - char *voice; + const char *voice; voice = "en"; switch (uint_user_language) { diff --git a/retroarch.c b/retroarch.c index 6134c7347d..fc5ef29ac0 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2289,6 +2289,9 @@ void dir_check_defaults(void) } } +/* Is text-to-speech accessibility turned on? */ +static bool accessibility_enabled = false; + #ifdef HAVE_MENU /* MENU INPUT GLOBAL VARIABLES */ static const char **menu_input_dialog_keyboard_buffer = {NULL}; @@ -2311,9 +2314,6 @@ static bool menu_driver_is_binding = false; * it will be closed; if the menu was not running, it will be opened */ static bool menu_driver_toggled = false; -/* Is text-to-speech accessibility turned on? */ -static bool accessibility_enabled = false; - #ifdef HAVE_LIBNX #define LIBNX_SWKBD_LIMIT 500 /* enforced by HOS */ @@ -4304,17 +4304,18 @@ static void handle_translation_cb( * image, so we have to change that to RGB first. This should * probably be replaced with a scaler call.*/ { + unsigned ui; int d,tw,th,tc; d=0; raw_image_data = malloc(image_width*image_height*3*sizeof(uint8_t)); - for (i=0;i 0) snprintf(cmd, sizeof(cmd), - "powershell.exe -NoProfile -WindowStyle Hidden -Command \"Add-Type -AssemblyName System.Speech; $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer; $synth.SelectVoice(\\\"%s\\\"); $synth.Rate = %s; $synth.Speak(\\\"%s\\\");\"", language, speeds[speed-1], speak_text); + "powershell.exe -NoProfile -WindowStyle Hidden -Command \"Add-Type -AssemblyName System.Speech; $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer; $synth.SelectVoice(\\\"%s\\\"); $synth.Rate = %s; $synth.Speak(\\\"%s\\\");\"", language, speeds[speed-1], (char*) speak_text); else snprintf(cmd, sizeof(cmd), - "powershell.exe -NoProfile -WindowStyle Hidden -Command \"Add-Type -AssemblyName System.Speech; $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer; $synth.Rate = %s; $synth.Speak(\\\"%s\\\");\"", speeds[speed-1], speak_text); + "powershell.exe -NoProfile -WindowStyle Hidden -Command \"Add-Type -AssemblyName System.Speech; $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer; $synth.Rate = %s; $synth.Speak(\\\"%s\\\");\"", speeds[speed-1], (char*) speak_text); if (pi_set) terminate_win32_process(pi); res = create_win32_process(cmd); @@ -29268,14 +29271,14 @@ bool is_narrator_running_linux(void) bool accessibility_speak_linux( - char* speak_text, const char* language, int priority) + const char* speak_text, const char* language, int priority) { int pid; - char* voice_out = malloc(3+strlen(language)); - char* speed_out = malloc(3+3); + char* voice_out = (char *) malloc(3+strlen(language)); + char* speed_out = (char *) malloc(3+3); settings_t *settings = configuration_settings; - char* speeds[10] = {"80", "100", "125", "150", "170", "210", "260", "310", "380", "450"}; + const char* speeds[10] = {"80", "100", "125", "150", "170", "210", "260", "310", "380", "450"}; int speed = settings->uints.accessibility_narrator_speech_speed; if (speed < 1) @@ -29321,17 +29324,17 @@ bool accessibility_speak_linux( else { /* child process: replace process with the espeak command */ - char* cmd[] = {"espeak", NULL, NULL, NULL, NULL}; + char* cmd[] = { (char*) "espeak", NULL, NULL, NULL, NULL}; cmd[1] = voice_out; cmd[2] = speed_out; - cmd[3] = speak_text; + cmd[3] = (char *) speak_text; execvp("espeak", cmd); } return true; } #endif -bool accessibility_speak_priority(char* speak_text, int priority) +bool accessibility_speak_priority(const char* speak_text, int priority) { const char* voice = NULL; @@ -29356,7 +29359,9 @@ bool accessibility_speak_priority(char* speak_text, int priority) mixer can handle playing streams while the core is paused, then we can use this. */ /* +#if defined(HAVE_NETWORKING) return accessibility_speak_ai_service(speak_text, voice, priority); +#endif */ } return true; @@ -29378,7 +29383,7 @@ bool is_narrator_running(void) } -bool accessibility_speak_ai_service(char* speak_text, const char* language, int priority) +bool accessibility_speak_ai_service(const char* speak_text, const char* language, int priority) { #if defined(HAVE_NETWORKING) && defined(HAVE_TRANSLATE) /* Call the AI service listed to do espeak for us. */ @@ -29422,11 +29427,6 @@ bool accessibility_speak_ai_service(char* speak_text, const char* language, int bool accessibility_startup_message(void) { -#ifdef HAVE_NETWORKING - /* Note: for the ai service tts call, this is called too early... */ accessibility_speak("RetroArch accessibility on."); return true; -#else - return false; -#endif } diff --git a/retroarch.h b/retroarch.h index b4bf65641a..4c4db9d222 100644 --- a/retroarch.h +++ b/retroarch.h @@ -2022,14 +2022,14 @@ unsigned int retroarch_get_rotation(void); bool is_input_keyboard_display_on(void); bool is_accessibility_enabled(void); -bool accessibility_speak(char* speak_text); -bool accessibility_speak_priority(char* speak_text, int priority); +bool accessibility_speak(const char* speak_text); +bool accessibility_speak_priority(const char* speak_text, int priority); bool accessibility_startup_message(void); bool is_narrator_running(void); bool accessibility_speak_ai_service( - char* speak_text, const char* voice, int priority); + const char* speak_text, const char* voice, int priority); RETRO_END_DECLS