summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/ttscarbon.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-03-11 20:09:22 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-03-11 20:09:22 +0000
commitb4401e589e6a4f138e718cce527c5da95907d240 (patch)
treed6bccb60ed2e25975f94c8dee586ef89811d721c /rbutil/rbutilqt/base/ttscarbon.cpp
parentc8752b428dc11db98f2ccd16d2e4239dd731f992 (diff)
downloadrockbox-b4401e589e6a4f138e718cce527c5da95907d240.tar.gz
rockbox-b4401e589e6a4f138e718cce527c5da95907d240.zip
Implement speed adjustment for OS X TTS.
Note that some voices don't support speed adjustment. These voices will ignore the selected value. The current implementation doesn't mark those voices in any way. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25125 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/ttscarbon.cpp')
-rw-r--r--rbutil/rbutilqt/base/ttscarbon.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/ttscarbon.cpp b/rbutil/rbutilqt/base/ttscarbon.cpp
index b8259a374b..a74cb23da3 100644
--- a/rbutil/rbutilqt/base/ttscarbon.cpp
+++ b/rbutil/rbutilqt/base/ttscarbon.cpp
@@ -24,6 +24,7 @@
#include "rbsettings.h"
#include <CoreFoundation/CoreFoundation.h>
+#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
#include <unistd.h>
#include <sys/stat.h>
@@ -81,6 +82,10 @@ bool TTSCarbon::start(QString *errStr)
error = NewSpeechChannel(vspecref, &m_channel);
//SetSpeechInfo(channel, soSpeechDoneCallBack, speechDone);
+ Fixed rate = (Fixed)(0x10000 * RbSettings::subValue("carbon",
+ RbSettings::TtsSpeed).toInt());
+ if(rate != 0)
+ SetSpeechRate(m_channel, rate);
return (error == 0) ? true : false;
}
@@ -125,6 +130,12 @@ void TTSCarbon::generateSettings(void)
tr("Voice:"), voice, voiceNames, EncTtsSetting::eNOBTN);
insertSetting(ConfigVoice, setting);
+ // speed
+ int speed = RbSettings::subValue("carbon", RbSettings::TtsSpeed).toInt();
+ setting = new EncTtsSetting(this, EncTtsSetting::eINT,
+ tr("Speed (words/min):"), speed, 80, 500,
+ EncTtsSetting::eNOBTN);
+ insertSetting(ConfigSpeed, setting);
}
@@ -133,6 +144,8 @@ void TTSCarbon::saveSettings(void)
// save settings in user config
RbSettings::setSubValue("carbon", RbSettings::TtsVoice,
getSetting(ConfigVoice)->current().toString());
+ RbSettings::setSubValue("carbon", RbSettings::TtsSpeed,
+ getSetting(ConfigSpeed)->current().toInt());
RbSettings::sync();
}