Skip to content

WAGE: Add text-to-speech (TTS) #6546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

InfinityColme1
Copy link

@InfinityColme1 InfinityColme1 commented Apr 8, 2025

Adds text-to-speech to the following:

  • Appended text on the GUI
  • Names of scene objects when hovered over

Copy link
Member

@sev- sev- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added my notes

@@ -197,6 +197,14 @@ bool Gui::processSceneEvents(WindowClick click, Common::Event &event) {

return true;
}
if (event.type = Common::EVENT_MOUSEMOVE) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (event.type = Common::EVENT_MOUSEMOVE) {
if (event.type = Common::EVENT_MOUSEMOVE) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E.g. it is best to split the blocks with an empty line, so there is a visual cue to the reader.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this should be a check for equality, not an assignment, i.e:

Suggested change
if (event.type = Common::EVENT_MOUSEMOVE) {
if (event.type == Common::EVENT_MOUSEMOVE) {

if (event.type = Common::EVENT_MOUSEMOVE) {
Designed *obj = _scene->lookUpEntity(event.mouse.x, event.mouse.y);

if (obj != nullptr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (obj != nullptr)
if (obj)

This is a common practice to make it less comprehensive

@@ -219,6 +223,11 @@ class WageEngine : public Engine {
void updateSoundTimerForScene(Scene *scene, bool firstTime);
void setMenu(Common::String soundName);
void appendText(const char *str);
void sayText(const Common::String str) {
sayText(str, Common::TextToSpeechManager::INTERRUPT_NO_REPEAT);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to move this to C++ code and as such, eliminate #include "common/text-to-speech.h" which increases header dependency -> longer compilation time

@@ -47,6 +47,7 @@
#ifndef WAGE_WAGE_H
#define WAGE_WAGE_H

#include "engines/advancedDetector.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be needed.

@@ -118,6 +119,12 @@ Common::Error WageEngine::run() {
height = 768;
}

Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
if (ttsMan != nullptr) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (ttsMan != nullptr) {
if (ttsMan) {

@@ -264,14 +271,28 @@ void WageEngine::setMenu(Common::String menu) {

void WageEngine::appendText(const char *str) {
Common::String s(str);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this

_inputText.clear();
}

void WageEngine::sayText(const Common::String str, Common::TextToSpeechManager::Action action) {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
if (ttsMan != nullptr && ConfMan.getBool("tts_enabled"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (ttsMan != nullptr && ConfMan.getBool("tts_enabled"))
if (ttsMan && ConfMan.getBool("tts_enabled"))

and below

@@ -574,7 +596,7 @@ void WageEngine::processTurn(Common::String *textInput, Designed *clickInput) {
processTurnInternal(&input, clickInput);
Scene *playerScene = _world->_player->_currentScene;

if (prevScene != playerScene && playerScene != _world->_storageScene) {
if (prevScene != playerScene && playerScene != _world->_storageScene) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert

@@ -605,5 +627,9 @@ void WageEngine::processTurn(Common::String *textInput, Designed *clickInput) {
_inputText.clear();
}

Common::Language WageEngine::getLanguage() const{

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this empty line

@@ -605,5 +627,9 @@ void WageEngine::processTurn(Common::String *textInput, Designed *clickInput) {
_inputText.clear();
}

Common::Language WageEngine::getLanguage() const{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Common::Language WageEngine::getLanguage() const{
Common::Language WageEngine::getLanguage() const {

Please follow our code formatting guidelines. Adn you may see this formatting everywhere

@InfinityColme1 InfinityColme1 changed the title WAGE: Add TTS WAGE: Add text-to-speech (TTS) Apr 8, 2025
@bluegr bluegr added the GSoC Part of a Google Summer of Code project label Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC Part of a Google Summer of Code project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants