aboutsummaryrefslogtreecommitdiff
path: root/backends/text-to-speech
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-12 12:52:18 +0200
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commitb5cebcbeaed5b1b860f2686379fc288c137a4c2f (patch)
tree190f839f6c3d8c3176db62db36de12715d371431 /backends/text-to-speech
parentfa6faca76a35028e288753c3d74f2c81228ec5bb (diff)
downloadscummvm-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.cpp10
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.h3
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);