From abe9ab3f558d389ffd4934ab2f4123f25060779c Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 29 Sep 2020 10:53:35 -0500 Subject: [PATCH] Add property indicating whether utterance callbacks are supported. --- TTS.gd | 17 ++++++++++++++++- src/lib.rs | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/TTS.gd b/TTS.gd index d15e189..0339518 100644 --- a/TTS.gd +++ b/TTS.gd @@ -7,6 +7,7 @@ var tts signal done + func _init(): if OS.get_name() == "Server" or OS.has_feature("JavaScript"): return @@ -20,10 +21,10 @@ func _init(): print_debug("TTS not available!") - func _ready(): pause_mode = Node.PAUSE_MODE_PROCESS + func _get_min_rate(): if OS.has_feature('JavaScript'): return 0.1 @@ -155,6 +156,20 @@ func get_is_rate_supported(): var is_rate_supported setget , get_is_rate_supported +func _get_are_utterance_callbacks_supported(): + if Engine.has_singleton("GodotTTS"): + return false + elif OS.has_feature('JavaScript'): + return false + elif tts != null: + return tts.are_utterance_callbacks_supported() + else: + return false + + +var are_utterance_callbacks_supported setget , _get_are_utterance_callbacks_supported + + func _get_can_detect_is_speaking(): if Engine.has_singleton("GodotTTS"): return true diff --git a/src/lib.rs b/src/lib.rs index a957bfc..8e51317 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -165,6 +165,15 @@ impl TTS { rate_supported } + #[export] + fn are_utterance_callbacks_supported(&mut self, _owner: &Node) -> bool { + let Features { + utterance_callbacks: supported, + .. + } = self.0.supported_features(); + supported + } + #[export] fn _process(&mut self, owner: &Node, _delta: f32) { if let Some(msg) = self.1.try_recv().ok() {