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
|
|
@ -55,7 +55,7 @@ const static struct {
|
||||||
{ RbSettings::TtsUseSapi4, "sapi/useSapi4", "false" },
|
{ RbSettings::TtsUseSapi4, "sapi/useSapi4", "false" },
|
||||||
{ RbSettings::EncoderNarrowBand, ":encoder:/narrowband", "false" },
|
{ RbSettings::EncoderNarrowBand, ":encoder:/narrowband", "false" },
|
||||||
{ RbSettings::WavtrimThreshold, "wavtrimthreshold", "500"},
|
{ RbSettings::WavtrimThreshold, "wavtrimthreshold", "500"},
|
||||||
{ RbSettings::TtsSpeed, ":tts:/speed", "0" },
|
{ RbSettings::TtsSpeed, ":tts:/speed", "175" },
|
||||||
{ RbSettings::EncoderComplexity, ":encoder:/complexity", "10" },
|
{ RbSettings::EncoderComplexity, ":encoder:/complexity", "10" },
|
||||||
{ RbSettings::EncoderQuality, ":encoder:/quality", "8.0" },
|
{ RbSettings::EncoderQuality, ":encoder:/quality", "8.0" },
|
||||||
{ RbSettings::EncoderVolume, ":encoder:/volume", "1.0" },
|
{ RbSettings::EncoderVolume, ":encoder:/volume", "1.0" },
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include "rbsettings.h"
|
#include "rbsettings.h"
|
||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
@ -81,6 +82,10 @@ bool TTSCarbon::start(QString *errStr)
|
||||||
|
|
||||||
error = NewSpeechChannel(vspecref, &m_channel);
|
error = NewSpeechChannel(vspecref, &m_channel);
|
||||||
//SetSpeechInfo(channel, soSpeechDoneCallBack, speechDone);
|
//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;
|
return (error == 0) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,6 +130,12 @@ void TTSCarbon::generateSettings(void)
|
||||||
tr("Voice:"), voice, voiceNames, EncTtsSetting::eNOBTN);
|
tr("Voice:"), voice, voiceNames, EncTtsSetting::eNOBTN);
|
||||||
insertSetting(ConfigVoice, setting);
|
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
|
// save settings in user config
|
||||||
RbSettings::setSubValue("carbon", RbSettings::TtsVoice,
|
RbSettings::setSubValue("carbon", RbSettings::TtsVoice,
|
||||||
getSetting(ConfigVoice)->current().toString());
|
getSetting(ConfigVoice)->current().toString());
|
||||||
|
RbSettings::setSubValue("carbon", RbSettings::TtsSpeed,
|
||||||
|
getSetting(ConfigSpeed)->current().toInt());
|
||||||
RbSettings::sync();
|
RbSettings::sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@ class TTSCarbon : public TTSBase
|
||||||
//! Enum to identify the settings
|
//! Enum to identify the settings
|
||||||
enum ConfigValuesCarbon
|
enum ConfigValuesCarbon
|
||||||
{
|
{
|
||||||
ConfigVoice
|
ConfigVoice,
|
||||||
|
ConfigSpeed
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
TTSCarbon(QObject *parent = NULL);
|
TTSCarbon(QObject *parent = NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue