diff options
-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 */ |