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

@@ -80,7 +80,7 @@ public:
virtual bool tts_is_paused() const override;
virtual TypedArray<Dictionary> tts_get_voices() const override;
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;
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;
virtual void tts_pause() override;
virtual void tts_resume() override;
virtual void tts_stop() override;

View File

@@ -128,7 +128,7 @@ TypedArray<Dictionary> DisplayServerMacOSBase::tts_get_voices() const {
return [tts getVoices];
}
void DisplayServerMacOSBase::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) {
void DisplayServerMacOSBase::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) {
if (unlikely(!tts)) {
initialize_tts();
}

View File

@@ -47,12 +47,12 @@
@interface TTS_MacOS : NSObject <AVSpeechSynthesizerDelegate> {
// AVSpeechSynthesizer
bool speaking;
HashMap<id, int> ids;
HashMap<id, int64_t> ids;
// NSSpeechSynthesizer
bool paused;
bool have_utterance;
int last_utterance;
int64_t last_utterance;
id synth; // NSSpeechSynthesizer or AVSpeechSynthesizer
List<DisplayServer::TTSUtterance> queue;
@@ -63,6 +63,6 @@
- (void)stopSpeaking;
- (bool)isSpeaking;
- (bool)isPaused;
- (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;
- (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;
- (Array)getVoices;
@end

View File

@@ -148,9 +148,9 @@
have_utterance = true;
[ns_synth startSpeakingString:[NSString stringWithUTF8String:message.text.utf8().get_data()]];
}
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_STARTED, message.id);
queue.pop_front();
DisplayServer::get_singleton()->tts_post_utterance_event(DisplayServer::TTS_UTTERANCE_STARTED, message.id);
speaking = true;
}
}
@@ -210,7 +210,7 @@
}
}
- (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 {
- (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 {
if (interrupt) {
[self stopSpeaking];
}