[Scummvm-git-logs] scummvm master -> 8d4eb1f1fc56622a6e6219aa671b13d84054b52b
criezy
noreply at scummvm.org
Fri Jun 20 00:42:41 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
9381fb22cc TESTBED: Add test for queuing empty text
8d4eb1f1fc MACOSX, TTS: Fix handling of queued empty strings
Commit: 9381fb22cc6cf35d5ab5d9244f1e0060e23dd5e1
https://github.com/scummvm/scummvm/commit/9381fb22cc6cf35d5ab5d9244f1e0060e23dd5e1
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2025-06-20T01:34:40+01:00
Commit Message:
TESTBED: Add test for queuing empty text
This is not something common, but it currently trips the TTS implementation
on macOS and if there is another text queued after it, that text is not started.
Changed paths:
engines/testbed/speech.cpp
engines/testbed/speech.h
diff --git a/engines/testbed/speech.cpp b/engines/testbed/speech.cpp
index 1cb8e938531..ad4430a2c9c 100644
--- a/engines/testbed/speech.cpp
+++ b/engines/testbed/speech.cpp
@@ -538,6 +538,36 @@ TestExitStatus Speechtests::testQueueNoRepeat() {
return kTestPassed;
}
+TestExitStatus Speechtests::testQueueEmptyString() {
+ Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
+ ttsMan->setLanguage("en");
+ ttsMan->setVolume(100);
+ ttsMan->setRate(0);
+ ttsMan->setPitch(0);
+ ttsMan->setVoice(ttsMan->getDefaultVoice());
+ Testsuite::clearScreen();
+ Common::String info = "Text to speech queue empty test. You should expect a voice to start say:\"This is the first sentence. This is the third sentence\"";
+
+ Common::Point pt(0, 100);
+ Testsuite::writeOnScreen("Testing TTS Queue No Repeat", pt);
+
+ if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
+ Testsuite::logPrintf("Info! Skipping test : testQueueNoRepeat\n");
+ return kTestSkipped;
+ }
+
+ ttsMan->say("This is the first sentence.");
+ ttsMan->say("", Common::TextToSpeechManager::QUEUE);
+ ttsMan->say("This is the third sentence.", Common::TextToSpeechManager::QUEUE);
+ waitForSpeechEnd(ttsMan);
+ Common::String prompt = "Did you hear a voice say: \"This is the first sentence. This the third sentence\"?";
+ if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
+ Testsuite::logDetailedPrintf("TTS QueueEmptyText failed\n");
+ return kTestFailed;
+ }
+ return kTestPassed;
+}
+
SpeechTestSuite::SpeechTestSuite() {
_isTsEnabled = true;
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
@@ -559,6 +589,7 @@ SpeechTestSuite::SpeechTestSuite() {
addTest("testDroping", &Speechtests::testDroping, true);
addTest("testInterruptNoRepeat", &Speechtests::testInterruptNoRepeat, true);
addTest("testQueueNoRepeat", &Speechtests::testQueueNoRepeat, true);
+ addTest("testQueueEmptyString", &Speechtests::testQueueEmptyString, true);
}
} // End of namespace Testbed
diff --git a/engines/testbed/speech.h b/engines/testbed/speech.h
index 893ccb8cea5..f043f565f7f 100644
--- a/engines/testbed/speech.h
+++ b/engines/testbed/speech.h
@@ -48,6 +48,7 @@ TestExitStatus testInterrupting();
TestExitStatus testDroping();
TestExitStatus testInterruptNoRepeat();
TestExitStatus testQueueNoRepeat();
+TestExitStatus testQueueEmptyString();
// Utility function to avoid dupplicated code
void waitForSpeechEnd(Common::TextToSpeechManager *);
Commit: 8d4eb1f1fc56622a6e6219aa671b13d84054b52b
https://github.com/scummvm/scummvm/commit/8d4eb1f1fc56622a6e6219aa671b13d84054b52b
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2025-06-20T01:37:57+01:00
Commit Message:
MACOSX, TTS: Fix handling of queued empty strings
When asking the NSSpeechSynthesizer to speak an empty string it
does not actually starts speaking (since there is nothing to speak)
and does not call the NSSpeechSynthesizerDelagate didFinishSpeaking
method. As a result if there another text queued after it was not
started. Now empty strings are skipped. They may still interrupt
previous speech though when getting an empty string with INTERRUPT
action.
Changed paths:
backends/text-to-speech/macosx/macosx-text-to-speech.mm
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 54c7629c05e..6640562c215 100644
--- a/backends/text-to-speech/macosx/macosx-text-to-speech.mm
+++ b/backends/text-to-speech/macosx/macosx-text-to-speech.mm
@@ -117,7 +117,12 @@ bool MacOSXTextToSpeechManager::startNextSpeech() {
if (_messageQueue.empty())
return false;
- Common::String textToSpeak = _messageQueue.pop();
+ Common::String textToSpeak;
+ do {
+ textToSpeak = _messageQueue.pop();
+ } while (textToSpeak.empty() && !_messageQueue.empty());
+ if (textToSpeak.empty())
+ return false;
// Get current encoding
CFStringEncoding stringEncoding = kCFStringEncodingUTF8;
More information about the Scummvm-git-logs
mailing list