summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/ttsbase.cpp
diff options
context:
space:
mode:
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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "ttsbase.h"
21
22#include "ttsfestival.h"
23#include "ttssapi.h"
24#include "ttsexes.h"
25
26// list of tts names and identifiers
27QMap<QString,QString> TTSBase::ttsList;
28
29TTSBase::TTSBase(QObject* parent): EncTtsSettingInterface(parent)
30{
31
32}
33
34// static functions
35void TTSBase::initTTSList()
36{
37 ttsList["espeak"] = "Espeak TTS Engine";
38 ttsList["flite"] = "Flite TTS Engine";
39 ttsList["swift"] = "Swift TTS Engine";
40#if defined(Q_OS_WIN)
41 ttsList["sapi"] = "Sapi TTS Engine";
42#endif
43#if defined(Q_OS_LINUX)
44 ttsList["festival"] = "Festival TTS Engine";
45#endif
46}
47
48// function to get a specific encoder
49TTSBase* TTSBase::getTTS(QObject* parent,QString ttsName)
50{
51
52 TTSBase* tts;
53#if defined(Q_OS_WIN)
54 if(ttsName == "sapi")
55 {
56 tts = new TTSSapi(parent);
57 return tts;
58 }
59 else
60#endif
61#if defined(Q_OS_LINUX)
62 if (ttsName == "festival")
63 {
64 tts = new TTSFestival(parent);
65 return tts;
66 }
67 else
68#endif
69 if (true) // fix for OS other than WIN or LINUX
70 {
71 tts = new TTSExes(ttsName,parent);
72 return tts;
73 }
74}
75
76// get the list of encoders, nice names
77QStringList TTSBase::getTTSList()
78{
79 // init list if its empty
80 if(ttsList.count() == 0)
81 initTTSList();
82
83 return ttsList.keys();
84}
85
86// get nice name of a specific tts
87QString TTSBase::getTTSName(QString tts)
88{
89 if(ttsList.isEmpty())
90 initTTSList();
91 return ttsList.value(tts);
92}