Skip to content

Commit 281c745

Browse files
committed
Make utterance_id 64-bit.
1 parent cb3af5a commit 281c745

34 files changed

+69
-63
lines changed

drivers/apple_embedded/display_server_apple_embedded.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class DisplayServerAppleEmbedded : public DisplayServer {
142142
virtual bool tts_is_paused() const override;
143143
virtual TypedArray<Dictionary> tts_get_voices() const override;
144144

145-
virtual void tts_speak(const String &p_text, const String &p_voice, int p_volume = 50, float p_pitch = 1.f, float p_rate = 1.f, int p_utterance_id = 0, bool p_interrupt = false) override;
145+
virtual void tts_speak(const String &p_text, const String &p_voice, int p_volume = 50, float p_pitch = 1.f, float p_rate = 1.f, int64_t p_utterance_id = 0, bool p_interrupt = false) override;
146146
virtual void tts_pause() override;
147147
virtual void tts_resume() override;
148148
virtual void tts_stop() override;

drivers/apple_embedded/display_server_apple_embedded.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@
413413
return [tts getVoices];
414414
}
415415

416-
void DisplayServerAppleEmbedded::tts_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) {
416+
void DisplayServerAppleEmbedded::tts_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) {
417417
if (unlikely(!tts)) {
418418
initialize_tts();
419419
}

drivers/apple_embedded/tts_apple_embedded.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
@interface GDTTTS : NSObject <AVSpeechSynthesizerDelegate> {
4646
bool speaking;
47-
HashMap<id, int> ids;
47+
HashMap<id, int64_t> ids;
4848

4949
AVSpeechSynthesizer *av_synth;
5050
List<DisplayServer::TTSUtterance> queue;
@@ -55,6 +55,6 @@
5555
- (void)stopSpeaking;
5656
- (bool)isSpeaking;
5757
- (bool)isPaused;
58-
- (void)speak:(const String &)text voice:(const String &)voice volume:(int)volume pitch:(float)pitch rate:(float)rate utterance_id:(int)utterance_id interrupt:(bool)interrupt;
58+
- (void)speak:(const String &)text voice:(const String &)voice volume:(int)volume pitch:(float)pitch rate:(float)rate utterance_id:(int64_t)utterance_id interrupt:(bool)interrupt;
5959
- (Array)getVoices;
6060
@end

drivers/apple_embedded/tts_apple_embedded.mm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,9 @@ - (void)update {
8787

8888
ids[new_utterance] = message.id;
8989
[av_synth speakUtterance:new_utterance];
90+
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_STARTED, message.id);
9091

9192
queue.pop_front();
92-
93-
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_STARTED, message.id);
9493
speaking = true;
9594
}
9695
}
@@ -120,7 +119,7 @@ - (bool)isPaused {
120119
return [av_synth isPaused];
121120
}
122121

123-
- (void)speak:(const String &)text voice:(const String &)voice volume:(int)volume pitch:(float)pitch rate:(float)rate utterance_id:(int)utterance_id interrupt:(bool)interrupt {
122+
- (void)speak:(const String &)text voice:(const String &)voice volume:(int)volume pitch:(float)pitch rate:(float)rate utterance_id:(int64_t)utterance_id interrupt:(bool)interrupt {
124123
if (interrupt) {
125124
[self stopSpeaking];
126125
}

misc/extension_api_validation/4.5-stable.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,10 @@ Validate extension JSON: Error: Field 'builtin_classes/PackedVector3Array/method
9999
Validate extension JSON: Error: Field 'builtin_classes/PackedVector4Array/methods/duplicate': is_const changed value in new API, from false to true.
100100

101101
Duplicate method made const. Compatibility methods registered.
102+
103+
104+
GH-112379
105+
---------
106+
Validate extension JSON: Error: Field 'classes/DisplayServer/methods/tts_speak/arguments/5': meta changed value in new API, from "int32" to "int64".
107+
108+
`utterance_id` argument changed from `int32` to `int64`. No compatibility method needed.

platform/android/display_server_android.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ TypedArray<Dictionary> DisplayServerAndroid::tts_get_voices() const {
109109
return TTS_Android::get_voices();
110110
}
111111

112-
void DisplayServerAndroid::tts_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) {
112+
void DisplayServerAndroid::tts_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) {
113113
TTS_Android::speak(p_text, p_voice, p_volume, p_pitch, p_rate, p_utterance_id, p_interrupt);
114114
}
115115

platform/android/display_server_android.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class DisplayServerAndroid : public DisplayServer {
110110
virtual bool tts_is_paused() const override;
111111
virtual TypedArray<Dictionary> tts_get_voices() const override;
112112

113-
virtual void tts_speak(const String &p_text, const String &p_voice, int p_volume = 50, float p_pitch = 1.f, float p_rate = 1.f, int p_utterance_id = 0, bool p_interrupt = false) override;
113+
virtual void tts_speak(const String &p_text, const String &p_voice, int p_volume = 50, float p_pitch = 1.f, float p_rate = 1.f, int64_t p_utterance_id = 0, bool p_interrupt = false) override;
114114
virtual void tts_pause() override;
115115
virtual void tts_resume() override;
116116
virtual void tts_stop() override;

platform/android/java/lib/src/main/java/org/godotengine/godot/GodotLib.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static native boolean initialize(
105105
/**
106106
* TTS callback.
107107
*/
108-
public static native void ttsCallback(int event, int id, int pos);
108+
public static native void ttsCallback(int event, long id, int pos);
109109

110110
/**
111111
* Forward touch events.

platform/android/java/lib/src/main/java/org/godotengine/godot/tts/GodotTTS.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private void updateTTS() {
119119
@Override
120120
public void onRangeStart(String utteranceId, int start, int end, int frame) {
121121
synchronized (lock) {
122-
if (lastUtterance != null && Integer.parseInt(utteranceId) == lastUtterance.id) {
122+
if (lastUtterance != null && Long.parseLong(utteranceId) == lastUtterance.id) {
123123
lastUtterance.offset = start;
124124
GodotLib.ttsCallback(EVENT_BOUNDARY, lastUtterance.id, start + lastUtterance.start);
125125
}
@@ -132,7 +132,7 @@ public void onRangeStart(String utteranceId, int start, int end, int frame) {
132132
@Override
133133
public void onStop(String utteranceId, boolean interrupted) {
134134
synchronized (lock) {
135-
if (lastUtterance != null && !paused && Integer.parseInt(utteranceId) == lastUtterance.id) {
135+
if (lastUtterance != null && !paused && Long.parseLong(utteranceId) == lastUtterance.id) {
136136
GodotLib.ttsCallback(EVENT_CANCEL, lastUtterance.id, 0);
137137
speaking = false;
138138
updateTTS();
@@ -146,7 +146,7 @@ public void onStop(String utteranceId, boolean interrupted) {
146146
@Override
147147
public void onStart(String utteranceId) {
148148
synchronized (lock) {
149-
if (lastUtterance != null && lastUtterance.start == 0 && Integer.parseInt(utteranceId) == lastUtterance.id) {
149+
if (lastUtterance != null && lastUtterance.start == 0 && Long.parseLong(utteranceId) == lastUtterance.id) {
150150
GodotLib.ttsCallback(EVENT_START, lastUtterance.id, 0);
151151
}
152152
}
@@ -158,7 +158,7 @@ public void onStart(String utteranceId) {
158158
@Override
159159
public void onDone(String utteranceId) {
160160
synchronized (lock) {
161-
if (lastUtterance != null && !paused && Integer.parseInt(utteranceId) == lastUtterance.id) {
161+
if (lastUtterance != null && !paused && Long.parseLong(utteranceId) == lastUtterance.id) {
162162
GodotLib.ttsCallback(EVENT_END, lastUtterance.id, 0);
163163
speaking = false;
164164
updateTTS();
@@ -172,7 +172,7 @@ public void onDone(String utteranceId) {
172172
@Override
173173
public void onError(String utteranceId, int errorCode) {
174174
synchronized (lock) {
175-
if (lastUtterance != null && !paused && Integer.parseInt(utteranceId) == lastUtterance.id) {
175+
if (lastUtterance != null && !paused && Long.parseLong(utteranceId) == lastUtterance.id) {
176176
GodotLib.ttsCallback(EVENT_CANCEL, lastUtterance.id, 0);
177177
speaking = false;
178178
updateTTS();
@@ -186,7 +186,7 @@ public void onError(String utteranceId, int errorCode) {
186186
@Override
187187
public void onError(String utteranceId) {
188188
synchronized (lock) {
189-
if (lastUtterance != null && !paused && Integer.parseInt(utteranceId) == lastUtterance.id) {
189+
if (lastUtterance != null && !paused && Long.parseLong(utteranceId) == lastUtterance.id) {
190190
GodotLib.ttsCallback(EVENT_CANCEL, lastUtterance.id, 0);
191191
speaking = false;
192192
updateTTS();
@@ -222,7 +222,7 @@ public void onInit(int status) {
222222
/**
223223
* Adds an utterance to the queue.
224224
*/
225-
public void speak(String text, String voice, int volume, float pitch, float rate, int utterance_id, boolean interrupt) {
225+
public void speak(String text, String voice, int volume, float pitch, float rate, long utterance_id, boolean interrupt) {
226226
synchronized (lock) {
227227
if (state != INIT_STATE_SUCCESS) {
228228
return;

platform/android/java/lib/src/main/java/org/godotengine/godot/tts/GodotUtterance.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ class GodotUtterance {
3939
final int volume;
4040
final float pitch;
4141
final float rate;
42-
final int id;
42+
final long id;
4343

4444
int offset = -1;
4545
int start = 0;
4646

47-
GodotUtterance(String text, String voice, int volume, float pitch, float rate, int id) {
47+
GodotUtterance(String text, String voice, int volume, float pitch, float rate, long id) {
4848
this.text = text;
4949
this.voice = voice;
5050
this.volume = volume;

0 commit comments

Comments
 (0)