diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2009-10-13 19:54:27 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2009-10-13 19:54:27 +0000 |
commit | 3215c09462fe90c35dc6d9e1979e970280b052b1 (patch) | |
tree | 1fc7be334470d6d21b746a40bc7dbe440a722d35 /rbutil/rbutilqt/base/ttsbase.cpp | |
parent | 31c18116de2105deed8aa8dab84bf08a930f2112 (diff) | |
download | rockbox-3215c09462fe90c35dc6d9e1979e970280b052b1.tar.gz 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.cpp | 92 |
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 | ||
27 | QMap<QString,QString> TTSBase::ttsList; | ||
28 | |||
29 | TTSBase::TTSBase(QObject* parent): EncTtsSettingInterface(parent) | ||
30 | { | ||
31 | |||
32 | } | ||
33 | |||
34 | // static functions | ||
35 | void 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 | ||
49 | TTSBase* 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 | ||
77 | QStringList 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 | ||
87 | QString TTSBase::getTTSName(QString tts) | ||
88 | { | ||
89 | if(ttsList.isEmpty()) | ||
90 | initTTSList(); | ||
91 | return ttsList.value(tts); | ||
92 | } | ||