diff options
author | Jaromir Wysoglad | 2019-07-12 12:52:18 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | b5cebcbeaed5b1b860f2686379fc288c137a4c2f (patch) | |
tree | 190f839f6c3d8c3176db62db36de12715d371431 /backends/text-to-speech | |
parent | fa6faca76a35028e288753c3d74f2c81228ec5bb (diff) | |
download | scummvm-rg350-b5cebcbeaed5b1b860f2686379fc288c137a4c2f.tar.gz scummvm-rg350-b5cebcbeaed5b1b860f2686379fc288c137a4c2f.tar.bz2 scummvm-rg350-b5cebcbeaed5b1b860f2686379fc288c137a4c2f.zip |
TTS: Add text to speech to the GUI.
Diffstat (limited to 'backends/text-to-speech')
-rw-r--r-- | backends/text-to-speech/linux/linux-text-to-speech.cpp | 10 | ||||
-rw-r--r-- | backends/text-to-speech/linux/linux-text-to-speech.h | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/backends/text-to-speech/linux/linux-text-to-speech.cpp b/backends/text-to-speech/linux/linux-text-to-speech.cpp index 7ddd4ac2b4..47c441a361 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.cpp +++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp @@ -160,14 +160,18 @@ void LinuxTextToSpeechManager::setPitch(int pitch) { _ttsState->_pitch = pitch; } -void LinuxTextToSpeechManager::setVolume(int volume) { +void LinuxTextToSpeechManager::setVolume(unsigned volume) { if (_speechState == BROKEN) return; - assert(volume >= -100 && volume <= 100); - spd_set_volume(_connection, volume); + assert(volume <= 100); + spd_set_volume(_connection, (volume - 50) * 2); _ttsState->_volume = volume; } +int LinuxTextToSpeechManager::getVolume() { + return (_ttsState->_volume - 50) * 2; +} + void LinuxTextToSpeechManager::setLanguage(Common::String language) { if (_speechState == BROKEN) return; diff --git a/backends/text-to-speech/linux/linux-text-to-speech.h b/backends/text-to-speech/linux/linux-text-to-speech.h index 85f53eb2f8..faa6a9d468 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.h +++ b/backends/text-to-speech/linux/linux-text-to-speech.h @@ -58,7 +58,8 @@ public: virtual void setPitch(int pitch); - virtual void setVolume(int volume); + virtual void setVolume(unsigned volume); + virtual int getVolume(); virtual void setLanguage(Common::String language); |