forked from len0rd/rockbox
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
This commit is contained in:
parent
c8752b428d
commit
b4401e589e
3 changed files with 16 additions and 2 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue