From 990ab617939c301b49fa6399180d4370deeb0461 Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Thu, 25 Jul 2019 21:28:08 +0200 Subject: MORTEVIELLE: Improve voice mapping to characters. * Return pitch -= 6 to females, this brings the pitch closer to zero * Add array of indices which ensures, that we use as many voices as we can. --- engines/mortevielle/sound.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'engines/mortevielle/sound.cpp') diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 01a9dbbaac..841a184d7a 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -772,25 +772,28 @@ void SoundManager::startSpeech(int rep, int character, int typ) { // Speech #ifdef USE_TTS const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 }; + const int voiceIndices[9] = { 0, 1, 2, 3, 0, 4, 5, 1, 6 }; if (!_ttsMan) return; Common::Array voices; - int pitch = haut[character] * 5; + int pitch = haut[character]; bool male; if (haut[character] > 5) { voices = _ttsMan->getVoiceIndicesByGender(Common::TTSVoice::FEMALE); male = false; + pitch -= 6; } else { voices = _ttsMan->getVoiceIndicesByGender(Common::TTSVoice::MALE); male = true; } + pitch *= 5; // If there is no voice available for the given gender, just set it to the 0th // voice if (voices.empty()) _ttsMan->setVoice(0); else { - character %= voices.size(); - _ttsMan->setVoice(voices[character]); + int voiceIndex = voiceIndices[character] % voices.size(); + _ttsMan->setVoice(voices[voiceIndex]); } // If the selected voice is a different gender, than we want, just try to // set the pitch so it may sound a little bit closer to the gender we want -- cgit v1.2.3