Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorvald Natvig <slicer@users.sourceforge.net>2008-03-11 18:40:23 +0300
committerThorvald Natvig <slicer@users.sourceforge.net>2008-03-11 18:40:23 +0300
commit361d01ff7cd297c2d0264f918500196af3b0e6e2 (patch)
treeee8216e21836ba7ead8fa10d987c97e41f40ac58 /src/mumble/TextToSpeech_unix.cpp
parent9f58eb295893f2938931fdb55f8671d38f3b3001 (diff)
Use speech-dispatcher for TTS on *nix
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@975 05730e5d-ab1b-0410-a4ac-84af385074fa
Diffstat (limited to 'src/mumble/TextToSpeech_unix.cpp')
-rw-r--r--src/mumble/TextToSpeech_unix.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/mumble/TextToSpeech_unix.cpp b/src/mumble/TextToSpeech_unix.cpp
index 822a436b3..a26513083 100644
--- a/src/mumble/TextToSpeech_unix.cpp
+++ b/src/mumble/TextToSpeech_unix.cpp
@@ -30,10 +30,11 @@
#include "TextToSpeech.h"
#include "Global.h"
+#include <libspeechd.h>
class TextToSpeechPrivate {
protected:
- QProcess qpFestival;
+ SPDConnection *spd;
public:
TextToSpeechPrivate();
~TextToSpeechPrivate();
@@ -42,23 +43,32 @@ class TextToSpeechPrivate {
};
TextToSpeechPrivate::TextToSpeechPrivate() {
- qpFestival.start(g.s.qsFestival,QIODevice::ReadWrite);
- qpFestival.waitForStarted(5000);
+ spd = spd_open("Mumble", NULL, NULL, SPD_MODE_THREADED);
+ if (! spd) {
+ qWarning("TextToSpeech: Failed to contact speech dispatcher.");
+ } else {
+ if (spd_set_punctuation(spd, SPD_PUNCT_NONE) != 0)
+ qWarning("TextToSpech: Failed to set punctuation mode.");
+ if (spd_set_spelling(spd, SPD_SPELL_ON) != 0)
+ qWarning("TextToSpeech: Failed to set spelling mode.");
+ }
}
TextToSpeechPrivate::~TextToSpeechPrivate() {
- qpFestival.closeWriteChannel();
- qpFestival.close();
+ if (spd) {
+ spd_close(spd);
+ spd = NULL;
+ }
}
void TextToSpeechPrivate::say(const QString &txt) {
- QString text = txt;
- if (! g.s.qsFestivalSearch.isEmpty())
- text.replace(QRegExp(g.s.qsFestivalSearch),g.s.qsFestivalReplace);
- qpFestival.write(g.s.qsFestivalPattern.arg(text).toUtf8());
+ if (spd)
+ spd_say(spd, SPD_MESSAGE, txt.toUtf8());
}
-void TextToSpeechPrivate::setVolume(int) {
+void TextToSpeechPrivate::setVolume(int vol) {
+ if (spd)
+ spd_set_volume(spd, vol * 2 - 100);
}
TextToSpeech::TextToSpeech(QObject *p) : QObject(p) {