Make utterance_id 64-bit.

This commit is contained in:
Pāvels Nadtočajevs
2025-11-03 23:25:29 +02:00
parent cb3af5afff
commit 281c74550a
34 changed files with 69 additions and 63 deletions

View File

@@ -52,7 +52,7 @@ jmethodID TTS_Android::_pause_speaking = nullptr;
jmethodID TTS_Android::_resume_speaking = nullptr;
jmethodID TTS_Android::_stop_speaking = nullptr;
HashMap<int, Char16String> TTS_Android::ids;
HashMap<int64_t, Char16String> TTS_Android::ids;
void TTS_Android::_thread_function(void *self) {
JNIEnv *env = get_jni_env();
@@ -117,7 +117,7 @@ void TTS_Android::setup(jobject p_tts) {
_is_paused = env->GetMethodID(cls, "isPaused", "()Z");
_get_state = env->GetMethodID(cls, "getState", "()I");
_get_voices = env->GetMethodID(cls, "getVoices", "()[Ljava/lang/String;");
_speak = env->GetMethodID(cls, "speak", "(Ljava/lang/String;Ljava/lang/String;IFFIZ)V");
_speak = env->GetMethodID(cls, "speak", "(Ljava/lang/String;Ljava/lang/String;IFFJZ)V");
_pause_speaking = env->GetMethodID(cls, "pauseSpeaking", "()V");
_resume_speaking = env->GetMethodID(cls, "resumeSpeaking", "()V");
_stop_speaking = env->GetMethodID(cls, "stopSpeaking", "()V");
@@ -145,7 +145,7 @@ void TTS_Android::terminate() {
}
}
void TTS_Android::_java_utterance_callback(int p_event, int p_id, int p_pos) {
void TTS_Android::_java_utterance_callback(int p_event, int64_t p_id, int p_pos) {
if (unlikely(!initialized)) {
initialize_tts();
}
@@ -230,7 +230,7 @@ Array TTS_Android::get_voices() {
return list;
}
void TTS_Android::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) {
void TTS_Android::speak(const String &p_text, const String &p_voice, int p_volume, float p_pitch, float p_rate, int64_t p_utterance_id, bool p_interrupt) {
if (unlikely(!initialized)) {
initialize_tts();
}
@@ -289,7 +289,7 @@ void TTS_Android::stop() {
initialize_tts();
}
ERR_FAIL_COND_MSG(!initialized || tts == nullptr, "Text to Speech not initialized.");
for (const KeyValue<int, Char16String> &E : ids) {
for (const KeyValue<int64_t, Char16String> &E : ids) {
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_CANCELED, E.key);
}
ids.clear();