[Scummvm-git-logs] scummvm master -> 5021e47aacc28cc028efc0828aadf8c74b8f0eda

criezy noreply at scummvm.org
Thu Apr 23 23:25:42 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
5021e47aac TTS: MACOSX: Fix issue speaking text that ends with a space


Commit: 5021e47aacc28cc028efc0828aadf8c74b8f0eda
    https://github.com/scummvm/scummvm/commit/5021e47aacc28cc028efc0828aadf8c74b8f0eda
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2026-04-24T00:23:16+01:00

Commit Message:
TTS: MACOSX: Fix issue speaking text that ends with a space

The macOS speech synthesizer does not like sentences that end with
a space and hangs (possibly waiting for more text?). This happens
for example in the first scene in from of the Theatre in Indy 4.
The text is now trimmed before being passed to the synthesizer
to avoid this issue.

Changed paths:
    backends/text-to-speech/avfaudio/avfaudio-text-to-speech.mm
    backends/text-to-speech/macosx/macosx-text-to-speech.mm


diff --git a/backends/text-to-speech/avfaudio/avfaudio-text-to-speech.mm b/backends/text-to-speech/avfaudio/avfaudio-text-to-speech.mm
index 0686e31898d..2ee07298350 100644
--- a/backends/text-to-speech/avfaudio/avfaudio-text-to-speech.mm
+++ b/backends/text-to-speech/avfaudio/avfaudio-text-to-speech.mm
@@ -88,6 +88,9 @@ AVFAudioTextToSpeechManager::~AVFAudioTextToSpeechManager() {
 
 bool AVFAudioTextToSpeechManager::say(const Common::U32String &text, Action action) {
 	Common::String textToSpeak = text.encode();
+	// AVSpeechSynthesizer does not like text that ends with a space and hangs.
+	// Trim the text to speak to ensure this does not happen.
+	textToSpeak.trim();
 	if (isSpeaking()) {
 		// Interruptions are done on word boundaries for nice transitions.
 		// Should we interrupt immediately?
diff --git a/backends/text-to-speech/macosx/macosx-text-to-speech.mm b/backends/text-to-speech/macosx/macosx-text-to-speech.mm
index 55d63de3374..4102cadb17b 100644
--- a/backends/text-to-speech/macosx/macosx-text-to-speech.mm
+++ b/backends/text-to-speech/macosx/macosx-text-to-speech.mm
@@ -92,6 +92,9 @@ MacOSXTextToSpeechManager::~MacOSXTextToSpeechManager() {
 
 bool MacOSXTextToSpeechManager::say(const Common::U32String &text, Action action) {
 	Common::String textToSpeak = text.encode();
+	// NSSpeechSynthesizer does not like text that ends with a space and hangs.
+	// Trim the text to speak to ensure this does not happen.
+	textToSpeak.trim();
 	if (isSpeaking()) {
 		// Interruptions are done on word boundaries for nice transitions.
 		// Should we interrupt immediately?




More information about the Scummvm-git-logs mailing list