Add derived SAPI4 class.
[maemo-rb.git] / rbutil / rbutilqt / base / ttsbase.cpp
blob5955f825b4cd3545bffbb51c9f6bed3e7692c8c7
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
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.
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
17 ****************************************************************************/
19 #include "ttsbase.h"
21 #include "ttsfestival.h"
22 #include "ttssapi.h"
23 #include "ttssapi4.h"
24 #include "ttsexes.h"
25 #if defined(Q_OS_MACX)
26 #include "ttscarbon.h"
27 #endif
29 // list of tts names and identifiers
30 QMap<QString,QString> TTSBase::ttsList;
32 TTSBase::TTSBase(QObject* parent): EncTtsSettingInterface(parent)
37 // static functions
38 void TTSBase::initTTSList()
40 #if !defined(Q_OS_WIN)
41 ttsList["espeak"] = tr("Espeak TTS Engine");
42 #endif
43 ttsList["flite"] = tr("Flite TTS Engine");
44 ttsList["swift"] = tr("Swift TTS Engine");
45 #if defined(Q_OS_WIN)
46 #if 0 /* SAPI4 has been disabled since long. Keep support for now. */
47 ttsList["sapi4"] = tr("SAPI4 TTS Engine");
48 #endif
49 ttsList["sapi"] = tr("SAPI5 TTS Engine");
50 #endif
51 #if defined(Q_OS_LINUX)
52 ttsList["festival"] = tr("Festival TTS Engine");
53 #endif
54 #if defined(Q_OS_MACX)
55 ttsList["carbon"] = tr("OS X System Engine");
56 #endif
59 // function to get a specific encoder
60 TTSBase* TTSBase::getTTS(QObject* parent,QString ttsName)
63 TTSBase* tts = 0;
64 #if defined(Q_OS_WIN)
65 if(ttsName == "sapi")
66 tts = new TTSSapi(parent);
67 else if (ttsName == "sapi4")
68 tts = new TTSSapi4(parent);
69 else
70 #elif defined(Q_OS_LINUX)
71 if (ttsName == "festival")
72 tts = new TTSFestival(parent);
73 else
74 #elif defined(Q_OS_MACX)
75 if(ttsName == "carbon")
76 tts = new TTSCarbon(parent);
77 else
78 #endif
79 // fix for OS other than WIN or LINUX
80 if (true)
81 tts = new TTSExes(ttsName, parent);
82 return tts;
85 // get the list of encoders, nice names
86 QStringList TTSBase::getTTSList()
88 // init list if its empty
89 if(ttsList.count() == 0)
90 initTTSList();
92 return ttsList.keys();
95 // get nice name of a specific tts
96 QString TTSBase::getTTSName(QString tts)
98 if(ttsList.isEmpty())
99 initTTSList();
100 return ttsList.value(tts);