diff options
author | Jaromir Wysoglad | 2019-07-22 19:39:20 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | 33549d9c0225a1ecfc5924b5584cdcee466498cc (patch) | |
tree | c010622e0d2b34fe747fd5b695dbb05a26dc216b /common | |
parent | 134d955006072720031c989a151ee14875bfcf05 (diff) | |
download | scummvm-rg350-33549d9c0225a1ecfc5924b5584cdcee466498cc.tar.gz scummvm-rg350-33549d9c0225a1ecfc5924b5584cdcee466498cc.tar.bz2 scummvm-rg350-33549d9c0225a1ecfc5924b5584cdcee466498cc.zip |
TTS: Add getVoiceIndicesByGender to the base class
This is a way to easily get a list of voices with the given gender
Diffstat (limited to 'common')
-rw-r--r-- | common/text-to-speech.cpp | 9 | ||||
-rw-r--r-- | common/text-to-speech.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/common/text-to-speech.cpp b/common/text-to-speech.cpp index 5bdf05e4dc..9289cba214 100644 --- a/common/text-to-speech.cpp +++ b/common/text-to-speech.cpp @@ -132,5 +132,14 @@ TTSVoice TextToSpeechManager::getVoice() { return TTSVoice(); } +Array<int> TextToSpeechManager::getVoiceIndicesByGender(TTSVoice::Gender gender) { + Array<int> results; + for (unsigned i = 0; i < _ttsState->_availableVoices.size(); i++) { + if (_ttsState->_availableVoices[i].getGender() == gender) + results.push_back(i); + } + return results; +} + } #endif diff --git a/common/text-to-speech.h b/common/text-to-speech.h index 012a1e2e25..9662783b46 100644 --- a/common/text-to-speech.h +++ b/common/text-to-speech.h @@ -251,6 +251,8 @@ public: */ Array<TTSVoice> getVoicesArray() { return _ttsState->_availableVoices; } + Array<int> getVoiceIndicesByGender (TTSVoice::Gender gender); + /** * Pushes the current state of the TTS */ |