1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-21 14:57:09 +00:00

Merge pull request #112379 from bruvzg/tts64id

Make `utterance_id` 64-bit.
This commit is contained in:
Thaddeus Crews
2025-11-14 14:23:17 -06:00
34 changed files with 69 additions and 63 deletions

View File

@@ -105,7 +105,7 @@ public class GodotLib {
/**
* TTS callback.
*/
public static native void ttsCallback(int event, int id, int pos);
public static native void ttsCallback(int event, long id, int pos);
/**
* Forward touch events.

View File

@@ -119,7 +119,7 @@ public class GodotTTS extends UtteranceProgressListener implements TextToSpeech.
@Override
public void onRangeStart(String utteranceId, int start, int end, int frame) {
synchronized (lock) {
if (lastUtterance != null && Integer.parseInt(utteranceId) == lastUtterance.id) {
if (lastUtterance != null && Long.parseLong(utteranceId) == lastUtterance.id) {
lastUtterance.offset = start;
GodotLib.ttsCallback(EVENT_BOUNDARY, lastUtterance.id, start + lastUtterance.start);
}
@@ -132,7 +132,7 @@ public class GodotTTS extends UtteranceProgressListener implements TextToSpeech.
@Override
public void onStop(String utteranceId, boolean interrupted) {
synchronized (lock) {
if (lastUtterance != null && !paused && Integer.parseInt(utteranceId) == lastUtterance.id) {
if (lastUtterance != null && !paused && Long.parseLong(utteranceId) == lastUtterance.id) {
GodotLib.ttsCallback(EVENT_CANCEL, lastUtterance.id, 0);
speaking = false;
updateTTS();
@@ -146,7 +146,7 @@ public class GodotTTS extends UtteranceProgressListener implements TextToSpeech.
@Override
public void onStart(String utteranceId) {
synchronized (lock) {
if (lastUtterance != null && lastUtterance.start == 0 && Integer.parseInt(utteranceId) == lastUtterance.id) {
if (lastUtterance != null && lastUtterance.start == 0 && Long.parseLong(utteranceId) == lastUtterance.id) {
GodotLib.ttsCallback(EVENT_START, lastUtterance.id, 0);
}
}
@@ -158,7 +158,7 @@ public class GodotTTS extends UtteranceProgressListener implements TextToSpeech.
@Override
public void onDone(String utteranceId) {
synchronized (lock) {
if (lastUtterance != null && !paused && Integer.parseInt(utteranceId) == lastUtterance.id) {
if (lastUtterance != null && !paused && Long.parseLong(utteranceId) == lastUtterance.id) {
GodotLib.ttsCallback(EVENT_END, lastUtterance.id, 0);
speaking = false;
updateTTS();
@@ -172,7 +172,7 @@ public class GodotTTS extends UtteranceProgressListener implements TextToSpeech.
@Override
public void onError(String utteranceId, int errorCode) {
synchronized (lock) {
if (lastUtterance != null && !paused && Integer.parseInt(utteranceId) == lastUtterance.id) {
if (lastUtterance != null && !paused && Long.parseLong(utteranceId) == lastUtterance.id) {
GodotLib.ttsCallback(EVENT_CANCEL, lastUtterance.id, 0);
speaking = false;
updateTTS();
@@ -186,7 +186,7 @@ public class GodotTTS extends UtteranceProgressListener implements TextToSpeech.
@Override
public void onError(String utteranceId) {
synchronized (lock) {
if (lastUtterance != null && !paused && Integer.parseInt(utteranceId) == lastUtterance.id) {
if (lastUtterance != null && !paused && Long.parseLong(utteranceId) == lastUtterance.id) {
GodotLib.ttsCallback(EVENT_CANCEL, lastUtterance.id, 0);
speaking = false;
updateTTS();
@@ -222,7 +222,7 @@ public class GodotTTS extends UtteranceProgressListener implements TextToSpeech.
/**
* Adds an utterance to the queue.
*/
public void speak(String text, String voice, int volume, float pitch, float rate, int utterance_id, boolean interrupt) {
public void speak(String text, String voice, int volume, float pitch, float rate, long utterance_id, boolean interrupt) {
synchronized (lock) {
if (state != INIT_STATE_SUCCESS) {
return;

View File

@@ -39,12 +39,12 @@ class GodotUtterance {
final int volume;
final float pitch;
final float rate;
final int id;
final long id;
int offset = -1;
int start = 0;
GodotUtterance(String text, String voice, int volume, float pitch, float rate, int id) {
GodotUtterance(String text, String voice, int volume, float pitch, float rate, long id) {
this.text = text;
this.voice = voice;
this.volume = volume;