mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
TTS Volume adjustable
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@369 05730e5d-ab1b-0410-a4ac-84af385074fa
This commit is contained in:
parent
62b3213bee
commit
8fea9ce5c1
22
Log.cpp
22
Log.cpp
@ -82,8 +82,27 @@ LogConfig::LogConfig(QWidget *p) : ConfigWidget(p) {
|
||||
|
||||
qgbMessages->setLayout(l);
|
||||
|
||||
QGroupBox *qgbTTS = new QGroupBox(tr("Text To Speech"));
|
||||
l = new QGridLayout();
|
||||
|
||||
lab=new QLabel(tr("Volume"));
|
||||
l->addWidget(lab,0,0);
|
||||
qsVolume = new QSlider(Qt::Horizontal);
|
||||
qsVolume->setRange(0, 100);
|
||||
qsVolume->setSingleStep(5);
|
||||
qsVolume->setPageStep(20);
|
||||
qsVolume->setValue(g.s.iTTSVolume);
|
||||
qsVolume->setObjectName("Volume");
|
||||
qsVolume->setToolTip(tr("Volume of Text-To-Speech Engine"));
|
||||
qsVolume->setWhatsThis(tr("<b>This is the volume used for the speech synthesis.</b>"));
|
||||
l->addWidget(qsVolume,0,1);
|
||||
|
||||
qgbTTS->setLayout(l);
|
||||
|
||||
|
||||
QVBoxLayout *v = new QVBoxLayout;
|
||||
v->addWidget(qgbMessages);
|
||||
v->addWidget(qgbTTS);
|
||||
v->addStretch(1);
|
||||
setLayout(v);
|
||||
|
||||
@ -105,6 +124,8 @@ void LogConfig::accept() {
|
||||
ms->bConsole = (qlConsole[i]->checkState() == Qt::Checked);
|
||||
ms->bTTS = (qlTTS[i]->checkState() == Qt::Checked);
|
||||
}
|
||||
g.s.iTTSVolume=qsVolume->value();
|
||||
g.l->tts->setVolume(g.s.iTTSVolume);
|
||||
}
|
||||
|
||||
MsgSettings::MsgSettings() {
|
||||
@ -118,6 +139,7 @@ Log::Log(QObject *p) : QObject(p) {
|
||||
qhSettings[static_cast<MsgType>(i)]=new MsgSettings();
|
||||
tts=new TextToSpeech(this);
|
||||
loadSettings();
|
||||
tts->setVolume(g.s.iTTSVolume);
|
||||
}
|
||||
|
||||
const char *Log::msgNames[] = {
|
||||
|
||||
1
Log.h
1
Log.h
@ -48,6 +48,7 @@ class LogConfig : public ConfigWidget {
|
||||
protected:
|
||||
QList<QCheckBox *> qlConsole;
|
||||
QList<QCheckBox *> qlTTS;
|
||||
QSlider *qsVolume;
|
||||
public:
|
||||
LogConfig(QWidget *p = NULL);
|
||||
virtual QString title() const;
|
||||
|
||||
@ -36,6 +36,7 @@ Settings::Settings() {
|
||||
a3dModel = None;
|
||||
bMute = bDeaf = false;
|
||||
bTTS = true;
|
||||
iTTSVolume = 75;
|
||||
iQuality = 8;
|
||||
iComplexity = 4;
|
||||
iMinLoudness = 4000;
|
||||
@ -69,6 +70,7 @@ void Settings::load() {
|
||||
bMute = g.qs->value("AudioMute", false). toBool();
|
||||
bDeaf = g.qs->value("AudioDeaf", false). toBool();
|
||||
bTTS = g.qs->value("TextToSpeech", bTTS). toBool();
|
||||
iTTSVolume = g.qs->value("TTSVolume", iTTSVolume).toInt();
|
||||
atTransmit = static_cast<Settings::AudioTransmit>(g.qs->value("AudioTransmit", atTransmit).toInt());
|
||||
a3dModel = static_cast<Settings::Audio3D>(g.qs->value("Audio3D", a3dModel).toInt());
|
||||
iQuality = g.qs->value("AudioQuality", iQuality).toInt();
|
||||
@ -107,6 +109,7 @@ void Settings::save() {
|
||||
g.qs->setValue("AudioMute", g.s.bMute);
|
||||
g.qs->setValue("AudioDeaf", g.s.bDeaf);
|
||||
g.qs->setValue("TextToSpeech", g.s.bTTS);
|
||||
g.qs->setValue("TTSVolume", g.s.iTTSVolume);
|
||||
g.qs->setValue("PosTransmit", g.s.bTransmitPosition);
|
||||
g.qs->setValue("AudioTransmit", g.s.atTransmit);
|
||||
g.qs->setValue("Audio3D", g.s.a3dModel);
|
||||
|
||||
@ -46,6 +46,7 @@ struct Settings {
|
||||
Audio3D a3dModel;
|
||||
bool bMute, bDeaf;
|
||||
bool bTTS;
|
||||
int iTTSVolume;
|
||||
int iQuality, iComplexity, iMinLoudness, iVoiceHold, iJitterBufferSize;
|
||||
int iFramesPerPacket;
|
||||
bool bTCPCompat;
|
||||
|
||||
@ -46,6 +46,7 @@ class TextToSpeech : public QObject {
|
||||
public slots:
|
||||
void say(QString text);
|
||||
void setEnabled(bool ena);
|
||||
void setVolume(int volume);
|
||||
private:
|
||||
TextToSpeechPrivate *d;
|
||||
};
|
||||
|
||||
@ -42,6 +42,7 @@ class TextToSpeechPrivate {
|
||||
TextToSpeechPrivate();
|
||||
~TextToSpeechPrivate();
|
||||
void say(QString text);
|
||||
void setVolume(int v);
|
||||
};
|
||||
|
||||
TextToSpeechPrivate::TextToSpeechPrivate() {
|
||||
@ -62,6 +63,10 @@ void TextToSpeechPrivate::say(QString text) {
|
||||
pVoice->Speak((const wchar_t *) text.utf16(), SPF_ASYNC, NULL);
|
||||
}
|
||||
|
||||
void TextToSpeechPrivate::setVolume(int volume) {
|
||||
if (pVoice)
|
||||
pVoice->SetVolume(volume);
|
||||
}
|
||||
|
||||
TextToSpeech::TextToSpeech(QObject *p) : QObject(p) {
|
||||
enabled = true;
|
||||
@ -81,6 +86,10 @@ void TextToSpeech::setEnabled(bool e) {
|
||||
enabled = e;
|
||||
}
|
||||
|
||||
void TextToSpeech::setVolume(int volume) {
|
||||
d->setVolume(volume);
|
||||
}
|
||||
|
||||
bool TextToSpeech::isEnabled() const {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user