feat: updated godot version
This commit is contained in:
parent
0c508b0831
commit
42b028dbb5
4694 changed files with 236470 additions and 401376 deletions
|
|
@ -31,8 +31,6 @@
|
|||
#include "tts_linux.h"
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/object/callable_mp.h"
|
||||
#include "servers/display/display_server.h"
|
||||
#include "servers/text/text_server.h"
|
||||
|
||||
TTS_Linux *TTS_Linux::singleton = nullptr;
|
||||
|
|
@ -92,7 +90,7 @@ void TTS_Linux::_speech_index_mark(int p_msg_id, int p_type, const String &p_ind
|
|||
_THREAD_SAFE_METHOD_
|
||||
|
||||
if (ids.has(p_msg_id)) {
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_BOUNDARY, ids[p_msg_id], p_index_mark.to_int());
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_BOUNDARY, ids[p_msg_id], p_index_mark.to_int());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,19 +124,19 @@ void TTS_Linux::_speech_event(int p_msg_id, int p_type) {
|
|||
|
||||
if (!paused && ids.has(p_msg_id)) {
|
||||
if ((SPDNotificationType)p_type == SPD_EVENT_END) {
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_ENDED, ids[p_msg_id]);
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_ENDED, ids[p_msg_id]);
|
||||
ids.erase(p_msg_id);
|
||||
last_msg_id = -1;
|
||||
speaking = false;
|
||||
} else if ((SPDNotificationType)p_type == SPD_EVENT_CANCEL) {
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_CANCELED, ids[p_msg_id]);
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, ids[p_msg_id]);
|
||||
ids.erase(p_msg_id);
|
||||
last_msg_id = -1;
|
||||
speaking = false;
|
||||
}
|
||||
}
|
||||
if (!speaking && queue.size() > 0) {
|
||||
TTSUtterance &message = queue.front()->get();
|
||||
DisplayServer::TTSUtterance &message = queue.front()->get();
|
||||
|
||||
// Inject index mark after each word.
|
||||
String text;
|
||||
|
|
@ -176,7 +174,7 @@ void TTS_Linux::_speech_event(int p_msg_id, int p_type) {
|
|||
spd_set_data_mode(synth, SPD_DATA_SSML);
|
||||
last_msg_id = spd_say(synth, SPD_TEXT, text.utf8().get_data());
|
||||
ids[last_msg_id] = message.id;
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_STARTED, message.id);
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_STARTED, message.id);
|
||||
|
||||
queue.pop_front();
|
||||
speaking = true;
|
||||
|
|
@ -218,11 +216,11 @@ void TTS_Linux::speak(const String &p_text, const String &p_voice, int p_volume,
|
|||
}
|
||||
|
||||
if (p_text.is_empty()) {
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_CANCELED, p_utterance_id);
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, p_utterance_id);
|
||||
return;
|
||||
}
|
||||
|
||||
TTSUtterance message;
|
||||
DisplayServer::TTSUtterance message;
|
||||
message.text = p_text;
|
||||
message.voice = p_voice;
|
||||
message.volume = CLAMP(p_volume, 0, 100);
|
||||
|
|
@ -259,11 +257,11 @@ void TTS_Linux::stop() {
|
|||
_THREAD_SAFE_METHOD_
|
||||
|
||||
ERR_FAIL_NULL(synth);
|
||||
for (TTSUtterance &message : queue) {
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_CANCELED, message.id);
|
||||
for (DisplayServer::TTSUtterance &message : queue) {
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, message.id);
|
||||
}
|
||||
if ((last_msg_id != -1) && ids.has(last_msg_id)) {
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServerEnums::TTS_UTTERANCE_CANCELED, ids[last_msg_id]);
|
||||
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, ids[last_msg_id]);
|
||||
}
|
||||
queue.clear();
|
||||
ids.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue