diff options
Diffstat (limited to 'utils/rbutilqt/base/ttsbase.cpp')
-rw-r--r-- | utils/rbutilqt/base/ttsbase.cpp | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/utils/rbutilqt/base/ttsbase.cpp b/utils/rbutilqt/base/ttsbase.cpp new file mode 100644 index 0000000000..0102d215a6 --- /dev/null +++ b/utils/rbutilqt/base/ttsbase.cpp | |||
@@ -0,0 +1,122 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2007 by Dominik Wenger | ||
10 | * | ||
11 | * All files in this archive are subject to the GNU General Public License. | ||
12 | * See the file COPYING in the source tree root for full license agreement. | ||
13 | * | ||
14 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
15 | * KIND, either express or implied. | ||
16 | * | ||
17 | ****************************************************************************/ | ||
18 | |||
19 | #include <QtCore> | ||
20 | #include "ttsbase.h" | ||
21 | |||
22 | #include "ttsfestival.h" | ||
23 | #include "ttssapi.h" | ||
24 | #include "ttssapi4.h" | ||
25 | #include "ttsmssp.h" | ||
26 | #include "ttsexes.h" | ||
27 | #include "ttsespeak.h" | ||
28 | #include "ttsespeakng.h" | ||
29 | #include "ttsflite.h" | ||
30 | #include "ttsmimic.h" | ||
31 | #include "ttsswift.h" | ||
32 | #if defined(Q_OS_MACX) | ||
33 | #include "ttscarbon.h" | ||
34 | #endif | ||
35 | |||
36 | // list of tts names and identifiers | ||
37 | QMap<QString,QString> TTSBase::ttsList; | ||
38 | |||
39 | TTSBase::TTSBase(QObject* parent): EncTtsSettingInterface(parent) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | // static functions | ||
44 | void TTSBase::initTTSList() | ||
45 | { | ||
46 | #if !defined(Q_OS_WIN) | ||
47 | ttsList["espeak"] = tr("Espeak TTS Engine"); | ||
48 | ttsList["espeakng"] = tr("Espeak-ng TTS Engine"); | ||
49 | ttsList["mimic"] = tr("Mimic TTS Engine"); | ||
50 | #endif | ||
51 | ttsList["flite"] = tr("Flite TTS Engine"); | ||
52 | ttsList["swift"] = tr("Swift TTS Engine"); | ||
53 | #if defined(Q_OS_WIN) | ||
54 | #if 0 /* SAPI4 has been disabled since long. Keep support for now. */ | ||
55 | ttsList["sapi4"] = tr("SAPI4 TTS Engine"); | ||
56 | #endif | ||
57 | ttsList["sapi"] = tr("SAPI5 TTS Engine"); | ||
58 | ttsList["mssp"] = tr("MS Speech Platform"); | ||
59 | #endif | ||
60 | #if defined(Q_OS_LINUX) | ||
61 | ttsList["festival"] = tr("Festival TTS Engine"); | ||
62 | #endif | ||
63 | #if defined(Q_OS_MACX) | ||
64 | ttsList["carbon"] = tr("OS X System Engine"); | ||
65 | #endif | ||
66 | } | ||
67 | |||
68 | // function to get a specific encoder | ||
69 | TTSBase* TTSBase::getTTS(QObject* parent,QString ttsName) | ||
70 | { | ||
71 | |||
72 | TTSBase* tts = nullptr; | ||
73 | #if defined(Q_OS_WIN) | ||
74 | if(ttsName == "sapi") | ||
75 | tts = new TTSSapi(parent); | ||
76 | else if (ttsName == "sapi4") | ||
77 | tts = new TTSSapi4(parent); | ||
78 | else if (ttsName == "mssp") | ||
79 | tts = new TTSMssp(parent); | ||
80 | else | ||
81 | #elif defined(Q_OS_LINUX) | ||
82 | if (ttsName == "festival") | ||
83 | tts = new TTSFestival(parent); | ||
84 | else | ||
85 | #elif defined(Q_OS_MACX) | ||
86 | if(ttsName == "carbon") | ||
87 | tts = new TTSCarbon(parent); | ||
88 | else | ||
89 | #endif | ||
90 | if(ttsName == "espeak") | ||
91 | tts = new TTSEspeak(parent); | ||
92 | else if(ttsName == "espeakng") | ||
93 | tts = new TTSEspeakNG(parent); | ||
94 | else if(ttsName == "mimic") | ||
95 | tts = new TTSMimic(parent); | ||
96 | else if(ttsName == "flite") | ||
97 | tts = new TTSFlite(parent); | ||
98 | else if(ttsName == "swift") | ||
99 | tts = new TTSSwift(parent); | ||
100 | else if(ttsName == "user") | ||
101 | tts = new TTSExes(parent); | ||
102 | |||
103 | return tts; | ||
104 | } | ||
105 | |||
106 | // get the list of encoders, nice names | ||
107 | QStringList TTSBase::getTTSList() | ||
108 | { | ||
109 | // init list if its empty | ||
110 | if(ttsList.count() == 0) | ||
111 | initTTSList(); | ||
112 | |||
113 | return ttsList.keys(); | ||
114 | } | ||
115 | |||
116 | // get nice name of a specific tts | ||
117 | QString TTSBase::getTTSName(QString tts) | ||
118 | { | ||
119 | if(ttsList.isEmpty()) | ||
120 | initTTSList(); | ||
121 | return ttsList.value(tts); | ||
122 | } | ||