2009-10-13 19:54:27 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Wenger
|
|
|
|
*
|
|
|
|
* 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"
|
2012-09-09 09:26:11 +00:00
|
|
|
#include "ttssapi4.h"
|
2012-09-09 09:31:05 +00:00
|
|
|
#include "ttsmssp.h"
|
2009-10-13 19:54:27 +00:00
|
|
|
#include "ttsexes.h"
|
2010-02-28 20:19:54 +00:00
|
|
|
#if defined(Q_OS_MACX)
|
|
|
|
#include "ttscarbon.h"
|
|
|
|
#endif
|
2009-10-13 19:54:27 +00:00
|
|
|
|
|
|
|
// list of tts names and identifiers
|
|
|
|
QMap<QString,QString> TTSBase::ttsList;
|
|
|
|
|
|
|
|
TTSBase::TTSBase(QObject* parent): EncTtsSettingInterface(parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// static functions
|
|
|
|
void TTSBase::initTTSList()
|
|
|
|
{
|
2012-04-02 18:07:59 +00:00
|
|
|
#if !defined(Q_OS_WIN)
|
2011-04-22 13:32:13 +00:00
|
|
|
ttsList["espeak"] = tr("Espeak TTS Engine");
|
2012-04-02 18:07:59 +00:00
|
|
|
#endif
|
2011-04-22 13:32:13 +00:00
|
|
|
ttsList["flite"] = tr("Flite TTS Engine");
|
|
|
|
ttsList["swift"] = tr("Swift TTS Engine");
|
2009-10-13 19:54:27 +00:00
|
|
|
#if defined(Q_OS_WIN)
|
2012-09-09 09:26:11 +00:00
|
|
|
#if 0 /* SAPI4 has been disabled since long. Keep support for now. */
|
|
|
|
ttsList["sapi4"] = tr("SAPI4 TTS Engine");
|
|
|
|
#endif
|
|
|
|
ttsList["sapi"] = tr("SAPI5 TTS Engine");
|
2012-09-09 09:31:05 +00:00
|
|
|
ttsList["mssp"] = tr("MS Speech Platform");
|
2009-10-13 19:54:27 +00:00
|
|
|
#endif
|
|
|
|
#if defined(Q_OS_LINUX)
|
2011-04-22 13:32:13 +00:00
|
|
|
ttsList["festival"] = tr("Festival TTS Engine");
|
2009-10-13 19:54:27 +00:00
|
|
|
#endif
|
2010-02-28 20:19:54 +00:00
|
|
|
#if defined(Q_OS_MACX)
|
2011-04-22 13:32:13 +00:00
|
|
|
ttsList["carbon"] = tr("OS X System Engine");
|
2010-02-28 20:19:54 +00:00
|
|
|
#endif
|
2009-10-13 19:54:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// function to get a specific encoder
|
|
|
|
TTSBase* TTSBase::getTTS(QObject* parent,QString ttsName)
|
|
|
|
{
|
|
|
|
|
2012-09-09 09:26:11 +00:00
|
|
|
TTSBase* tts = 0;
|
2009-10-13 19:54:27 +00:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
if(ttsName == "sapi")
|
|
|
|
tts = new TTSSapi(parent);
|
2012-09-09 09:26:11 +00:00
|
|
|
else if (ttsName == "sapi4")
|
|
|
|
tts = new TTSSapi4(parent);
|
2012-09-09 09:31:05 +00:00
|
|
|
else if (ttsName == "mssp")
|
|
|
|
tts = new TTSMssp(parent);
|
2009-10-13 19:54:27 +00:00
|
|
|
else
|
2012-09-09 09:26:11 +00:00
|
|
|
#elif defined(Q_OS_LINUX)
|
2009-10-13 19:54:27 +00:00
|
|
|
if (ttsName == "festival")
|
|
|
|
tts = new TTSFestival(parent);
|
|
|
|
else
|
2012-09-09 09:26:11 +00:00
|
|
|
#elif defined(Q_OS_MACX)
|
2010-02-28 20:19:54 +00:00
|
|
|
if(ttsName == "carbon")
|
|
|
|
tts = new TTSCarbon(parent);
|
|
|
|
else
|
2009-10-13 19:54:27 +00:00
|
|
|
#endif
|
2012-09-09 09:26:11 +00:00
|
|
|
// fix for OS other than WIN or LINUX
|
|
|
|
if (true)
|
|
|
|
tts = new TTSExes(ttsName, parent);
|
|
|
|
return tts;
|
2009-10-13 19:54:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
}
|