You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Implement text-to-speech support on Android, iOS, HTML5, Linux, macOS and Windows.
Implement TextServer word break method.
This commit is contained in:
@@ -139,6 +139,7 @@ bool DisplayServerX11::has_feature(Feature p_feature) const {
|
||||
case FEATURE_KEEP_SCREEN_ON:
|
||||
#endif
|
||||
case FEATURE_CLIPBOARD_PRIMARY:
|
||||
case FEATURE_TEXT_TO_SPEECH:
|
||||
return true;
|
||||
default: {
|
||||
}
|
||||
@@ -307,6 +308,45 @@ void DisplayServerX11::_flush_mouse_motion() {
|
||||
xi.relative_motion.y = 0;
|
||||
}
|
||||
|
||||
#ifdef SPEECHD_ENABLED
|
||||
|
||||
bool DisplayServerX11::tts_is_speaking() const {
|
||||
ERR_FAIL_COND_V(!tts, false);
|
||||
return tts->is_speaking();
|
||||
}
|
||||
|
||||
bool DisplayServerX11::tts_is_paused() const {
|
||||
ERR_FAIL_COND_V(!tts, false);
|
||||
return tts->is_paused();
|
||||
}
|
||||
|
||||
Array DisplayServerX11::tts_get_voices() const {
|
||||
ERR_FAIL_COND_V(!tts, Array());
|
||||
return tts->get_voices();
|
||||
}
|
||||
|
||||
void DisplayServerX11::tts_speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int p_utterance_id, bool p_interrupt) {
|
||||
ERR_FAIL_COND(!tts);
|
||||
tts->speak(p_text, p_voice, p_volume, p_pitch, p_rate, p_utterance_id, p_interrupt);
|
||||
}
|
||||
|
||||
void DisplayServerX11::tts_pause() {
|
||||
ERR_FAIL_COND(!tts);
|
||||
tts->pause();
|
||||
}
|
||||
|
||||
void DisplayServerX11::tts_resume() {
|
||||
ERR_FAIL_COND(!tts);
|
||||
tts->resume();
|
||||
}
|
||||
|
||||
void DisplayServerX11::tts_stop() {
|
||||
ERR_FAIL_COND(!tts);
|
||||
tts->stop();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void DisplayServerX11::mouse_set_mode(MouseMode p_mode) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
@@ -4633,6 +4673,11 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
|
||||
xdnd_finished = XInternAtom(x11_display, "XdndFinished", False);
|
||||
xdnd_selection = XInternAtom(x11_display, "XdndSelection", False);
|
||||
|
||||
#ifdef SPEECHD_ENABLED
|
||||
// Init TTS
|
||||
tts = memnew(TTS_Linux);
|
||||
#endif
|
||||
|
||||
//!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
//TODO - do Vulkan and OpenGL support checks, driver selection and fallback
|
||||
rendering_driver = p_rendering_driver;
|
||||
@@ -4985,6 +5030,10 @@ DisplayServerX11::~DisplayServerX11() {
|
||||
memfree(xmbstring);
|
||||
}
|
||||
|
||||
#ifdef SPEECHD_ENABLED
|
||||
memdelete(tts);
|
||||
#endif
|
||||
|
||||
#ifdef DBUS_ENABLED
|
||||
memdelete(screensaver);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user