mirror of
https://github.com/lightsoutgames/godot-tts
synced 2024-12-22 12:45:57 +00:00
Add property indicating whether utterance callbacks are supported.
This commit is contained in:
parent
795cc4790c
commit
abe9ab3f55
17
TTS.gd
17
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
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user