summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/ttsbase.cpp
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2009-10-13 19:54:27 +0000
committerDominik Wenger <domonoky@googlemail.com>2009-10-13 19:54:27 +0000
commit3215c09462fe90c35dc6d9e1979e970280b052b1 (patch)
tree1fc7be334470d6d21b746a40bc7dbe440a722d35 /rbutil/rbutilqt/base/ttsbase.cpp
parent31c18116de2105deed8aa8dab84bf08a930f2112 (diff)
downloadrockbox-3215c09462fe90c35dc6d9e1979e970280b052b1.tar.gz
rockbox-3215c09462fe90c35dc6d9e1979e970280b052b1.tar.bz2
rockbox-3215c09462fe90c35dc6d9e1979e970280b052b1.zip
rbutil: split tts.cpp/h into individual files.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23158 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/ttsbase.cpp')
-rw-r--r--rbutil/rbutilqt/base/ttsbase.cpp92
1 files changed, 92 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/ttsbase.cpp b/rbutil/rbutilqt/base/ttsbase.cpp
new file mode 100644
index 0000000000..1f4060fc72
--- /dev/null
+++ b/rbutil/rbutilqt/base/ttsbase.cpp
@@ -0,0 +1,92 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2007 by Dominik Wenger
+ * $Id$
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "ttsbase.h"
+
+#include "ttsfestival.h"
+#include "ttssapi.h"
+#include "ttsexes.h"
+
+// list of tts names and identifiers
+QMap<QString,QString> TTSBase::ttsList;
+
+TTSBase::TTSBase(QObject* parent): EncTtsSettingInterface(parent)
+{
+
+}
+
+// static functions
+void TTSBase::initTTSList()
+{
+ ttsList["espeak"] = "Espeak TTS Engine";
+ ttsList["flite"] = "Flite TTS Engine";
+ ttsList["swift"] = "Swift TTS Engine";
+#if defined(Q_OS_WIN)
+ ttsList["sapi"] = "Sapi TTS Engine";
+#endif
+#if defined(Q_OS_LINUX)
+ ttsList["festival"] = "Festival TTS Engine";
+#endif
+}
+
+// function to get a specific encoder
+TTSBase* TTSBase::getTTS(QObject* parent,QString ttsName)
+{
+
+ TTSBase* tts;
+#if defined(Q_OS_WIN)
+ if(ttsName == "sapi")
+ {
+ tts = new TTSSapi(parent);
+ return tts;
+ }
+ else
+#endif
+#if defined(Q_OS_LINUX)
+ if (ttsName == "festival")
+ {
+ tts = new TTSFestival(parent);
+ return tts;
+ }
+ else
+#endif
+ if (true) // fix for OS other than WIN or LINUX
+ {
+ tts = new TTSExes(ttsName,parent);
+ return tts;
+ }
+}
+
+// get the list of encoders, nice names
+QStringList TTSBase::getTTSList()
+{
+ // init list if its empty
+ if(ttsList.count() == 0)
+ initTTSList();
+
+ return ttsList.keys();
+}
+
+// get nice name of a specific tts
+QString TTSBase::getTTSName(QString tts)
+{
+ if(ttsList.isEmpty())
+ initTTSList();
+ return ttsList.value(tts);
+}