summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base
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
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')
-rw-r--r--rbutil/rbutilqt/base/rbsettings.cpp2
-rw-r--r--rbutil/rbutilqt/base/ttscarbon.cpp13
-rw-r--r--rbutil/rbutilqt/base/ttscarbon.h3
3 files changed, 16 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/base/rbsettings.cpp b/rbutil/rbutilqt/base/rbsettings.cpp
index 37f01c6c1c..c6f1bfcf6b 100644
--- a/rbutil/rbutilqt/base/rbsettings.cpp
+++ b/rbutil/rbutilqt/base/rbsettings.cpp
@@ -55,7 +55,7 @@ const static struct {
{ RbSettings::TtsUseSapi4, "sapi/useSapi4", "false" },
{ RbSettings::EncoderNarrowBand, ":encoder:/narrowband", "false" },
{ RbSettings::WavtrimThreshold, "wavtrimthreshold", "500"},
- { RbSettings::TtsSpeed, ":tts:/speed", "0" },
+ { RbSettings::TtsSpeed, ":tts:/speed", "175" },
{ RbSettings::EncoderComplexity, ":encoder:/complexity", "10" },
{ RbSettings::EncoderQuality, ":encoder:/quality", "8.0" },
{ RbSettings::EncoderVolume, ":encoder:/volume", "1.0" },
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();
}
diff --git a/rbutil/rbutilqt/base/ttscarbon.h b/rbutil/rbutilqt/base/ttscarbon.h
index c6b4a61320..b2d39047a5 100644
--- a/rbutil/rbutilqt/base/ttscarbon.h
+++ b/rbutil/rbutilqt/base/ttscarbon.h
@@ -32,7 +32,8 @@ class TTSCarbon : public TTSBase
//! Enum to identify the settings
enum ConfigValuesCarbon
{
- ConfigVoice
+ ConfigVoice,
+ ConfigSpeed
};
public:
TTSCarbon(QObject *parent = NULL);