Skip to content

Godot signed 64 bit integer becomes signed 32 bit integer for utterance_id in DisplayServer.tts_speak #112346

@Grandro

Description

@Grandro

Tested versions

  • 4.5.stable

System information

Windows 11

Issue description

Compare these two outputs:

var locale: String = TranslationServer.get_locale()
var voices: PackedStringArray = DisplayServer.tts_get_voices_for_language(locale)
if voices.is_empty():
    return

var id: int = (2**31) - 1
print(id)
DisplayServer.tts_speak("Test", voices[0], 50, 1.0, 1.0, id, true)
DisplayServer.tts_set_utterance_callback(DisplayServer.TTS_UTTERANCE_ENDED, _CB_TTS_Utterance_Ended)

func _CB_TTS_Utterance_Ended(p_utterance_id: int) -> void:
	print("CALLBACK: ", p_utterance_id)
CALL: 2147483647
CALLBACK: 2147483647
var locale: String = TranslationServer.get_locale()
var voices: PackedStringArray = DisplayServer.tts_get_voices_for_language(locale)
if voices.is_empty():
    return

var id: int = (2**31)
print(id)
DisplayServer.tts_speak("Test", voices[0], 50, 1.0, 1.0, id, true)
DisplayServer.tts_set_utterance_callback(DisplayServer.TTS_UTTERANCE_ENDED, _CB_TTS_Utterance_Ended)

func _CB_TTS_Utterance_Ended(p_utterance_id: int) -> void:
	print("CALLBACK: ", p_utterance_id)
CALL: 2147483648
CALLBACK: -2147483648

This makes it impossible to use Object.get_instance_id() as the utterance_id.

Steps to reproduce

  1. Create an empty project with a node and a script attached to it.
  2. Add the code examples provided above inside the _ready function.

Minimal reproduction project (MRP)

Utterance_Id_Signed_32_Bit.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions