Skip to content

PRINCE: Add text-to-speech (TTS)#6807

Merged
sev- merged 1 commit intoscummvm:masterfrom
ellm135:prince-tts
Jul 21, 2025
Merged

PRINCE: Add text-to-speech (TTS)#6807
sev- merged 1 commit intoscummvm:masterfrom
ellm135:prince-tts

Conversation

@ellm135
Copy link
Contributor

@ellm135 ellm135 commented Jul 11, 2025

Adds toggles for text-to-speech to the game options.
Adds text-to-speech for the following:

  • Subtitles
  • Dialog options
  • Objects when hovered over
  • Options menus

kSecondHero
};

bool _intro;
Copy link
Contributor

Choose a reason for hiding this comment

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

grouping the bool values would make the PrinceEngine a few bytes smaller.


void PrinceEngine::stopTextToSpeech() const {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
if (ttsMan != nullptr && (ConfMan.getBool("tts_enabled_objects") || ConfMan.getBool("tts_enabled_speech") || ConfMan.getBool("tts_enabled_missing_voice")) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure about this one... What if the intro plays, you go into the scummvm options menu to disable the tts features - but the voice is still speaking (and the game continues after you've left the scummvm options menu)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I might be misunderstanding, but I don't think the TTS features can be disabled using the ScummVM menu while in-game. The current implementation for this engine does stop voicing new text if the speech volume is set above 0, but this doesn't change the value of the tts_enabled bools, so this method would be unaffected. It also seems that opening the options menu immediately stops whatever TTS is speaking at the moment regardless.

};

struct CharacterVoiceData {
uint32 textColor;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this table could be reduced in size by using uint8, uint8, uint8, int8, bool

};

// Custom encoding
static const int germanEncodingTable[] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

the encoding tables could be uint16 to reduce the size on some systems.

Comment on lines +877 to +881
if (cursorId == 0) {
_vm->_isConversing = true;
} else if (cursorId == 1) {
_vm->_isConversing = false;
}
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 (cursorId == 0) {
_vm->_isConversing = true;
} else if (cursorId == 1) {
_vm->_isConversing = false;
}
_vm->_isConversing = (cursorId == 0);

bool male;
};

static const CharacterVoiceData characterVoiceDatas[] = {
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
static const CharacterVoiceData characterVoiceDatas[] = {
static const CharacterVoiceData characterVoiceData[] = {

{ 217, 31, 0, -1, true } // Narrator
};

static const int kNumberOfCharacterDatas = ARRAYSIZE(characterVoiceDatas);
Copy link
Member

@bluegr bluegr Jul 14, 2025

Choose a reason for hiding this comment

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

Suggested change
static const int kNumberOfCharacterDatas = ARRAYSIZE(characterVoiceDatas);
static const int kCharacterVoiceDataCount = ARRAYSIZE(characterVoiceData);

@criezy criezy added the GSoC Part of a Google Summer of Code project label Jul 14, 2025
@sev-
Copy link
Member

sev- commented Jul 21, 2025

Thank you!

@sev- sev- merged commit bef5a55 into scummvm:master Jul 21, 2025
8 checks passed
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.

5 participants