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>2007-06-23 15:02:24 +0400
committerThorvald Natvig <slicer@users.sourceforge.net>2007-06-23 15:02:24 +0400
commitdd39467b2b187b75cb0159a587bff82269d34bdb (patch)
tree8a98ac1a74ff4f30cb6ea98148bfd45535443c22 /src/mumble/TextToSpeech_unix.cpp
parentbe21e2871ab7906bdac674c813e7f871b5d62aec (diff)
Festival under Linux
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@489 05730e5d-ab1b-0410-a4ac-84af385074fa
Diffstat (limited to 'src/mumble/TextToSpeech_unix.cpp')
-rw-r--r--src/mumble/TextToSpeech_unix.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/mumble/TextToSpeech_unix.cpp b/src/mumble/TextToSpeech_unix.cpp
index 680ed2355..a4e40e710 100644
--- a/src/mumble/TextToSpeech_unix.cpp
+++ b/src/mumble/TextToSpeech_unix.cpp
@@ -29,21 +29,57 @@
*/
#include "TextToSpeech.h"
+#include "Global.h"
+
+class TextToSpeechPrivate {
+ protected:
+ QProcess qpFestival;
+ public:
+ TextToSpeechPrivate();
+ ~TextToSpeechPrivate();
+ void say(QString text);
+ void setVolume(int v);
+};
+
+TextToSpeechPrivate::TextToSpeechPrivate() {
+ qpFestival.start(g.s.qsFestival,QIODevice::ReadWrite);
+ qpFestival.waitForStarted(5000);
+}
+
+TextToSpeechPrivate::~TextToSpeechPrivate() {
+ qpFestival.closeWriteChannel();
+ qpFestival.close();
+}
+
+void TextToSpeechPrivate::say(QString text) {
+ QTextDocument td;
+ td.setHtml(text);
+ qpFestival.write(QString::fromLatin1("(SayText \"%1\")").arg(td.toPlainText().replace(QLatin1String("\""),QLatin1String("\\\""))).toUtf8());
+}
+
+void TextToSpeechPrivate::setVolume(int) {
+}
TextToSpeech::TextToSpeech(QObject *p) : QObject(p) {
+ enabled = true;
+ d = new TextToSpeechPrivate();
}
TextToSpeech::~TextToSpeech() {
+ delete d;
}
void TextToSpeech::say(QString text) {
+ if (enabled)
+ d->say(text);
}
void TextToSpeech::setEnabled(bool e) {
enabled = e;
}
-void TextToSpeech::setVolume(int) {
+void TextToSpeech::setVolume(int volume) {
+ d->setVolume(volume);
}