2007-12-15 13:13:57 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Wenger
|
2008-06-30 22:09:45 +00:00
|
|
|
* $Id$
|
2007-12-15 13:13:57 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2007-12-15 13:13:57 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TTS_H
|
|
|
|
#define TTS_H
|
|
|
|
|
2008-01-29 21:54:43 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
#include "rbsettings.h"
|
2008-02-10 18:25:49 +00:00
|
|
|
#include <QtCore>
|
2007-12-15 13:13:57 +00:00
|
|
|
|
2008-01-29 21:54:43 +00:00
|
|
|
#ifndef CONSOLE
|
|
|
|
#include "ttsgui.h"
|
2008-02-09 18:58:14 +00:00
|
|
|
#else
|
|
|
|
#include "ttsguicli.h"
|
2008-01-29 21:54:43 +00:00
|
|
|
#endif
|
2007-12-15 13:13:57 +00:00
|
|
|
|
|
|
|
|
2008-01-29 21:54:43 +00:00
|
|
|
class TTSBase : public QObject
|
2007-12-15 13:13:57 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2008-02-12 21:45:50 +00:00
|
|
|
public:
|
|
|
|
TTSBase();
|
|
|
|
virtual bool voice(QString text,QString wavfile)
|
|
|
|
{ (void)text; (void)wavfile; return false; }
|
|
|
|
virtual bool start(QString *errStr) { (void)errStr; return false; }
|
|
|
|
virtual bool stop() { return false; }
|
|
|
|
virtual void showCfg(){}
|
|
|
|
virtual bool configOk() { return false; }
|
2007-12-15 13:13:57 +00:00
|
|
|
|
2008-08-02 16:40:16 +00:00
|
|
|
virtual void setCfg(RbSettings* sett) { settings = sett; }
|
2008-02-12 21:45:50 +00:00
|
|
|
|
|
|
|
static TTSBase* getTTS(QString ttsname);
|
|
|
|
static QStringList getTTSList();
|
|
|
|
static QString getTTSName(QString tts);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
virtual void accept(void){}
|
|
|
|
virtual void reject(void){}
|
|
|
|
virtual void reset(void){}
|
|
|
|
|
|
|
|
private:
|
|
|
|
//inits the tts List
|
|
|
|
static void initTTSList();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
RbSettings* settings;
|
|
|
|
static QMap<QString,QString> ttsList;
|
|
|
|
static QMap<QString,TTSBase*> ttsCache;
|
2007-12-15 13:13:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TTSSapi : public TTSBase
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2008-02-12 21:45:50 +00:00
|
|
|
public:
|
|
|
|
TTSSapi();
|
|
|
|
virtual bool voice(QString text,QString wavfile);
|
|
|
|
virtual bool start(QString *errStr);
|
|
|
|
virtual bool stop();
|
|
|
|
virtual void showCfg();
|
|
|
|
virtual bool configOk();
|
2007-12-15 13:13:57 +00:00
|
|
|
|
2008-02-12 21:45:50 +00:00
|
|
|
QStringList getVoiceList(QString language);
|
|
|
|
private:
|
|
|
|
QProcess* voicescript;
|
2008-09-27 00:05:54 +00:00
|
|
|
QTextStream* voicestream;
|
2008-02-12 21:45:50 +00:00
|
|
|
QString defaultLanguage;
|
|
|
|
|
|
|
|
QString m_TTSexec;
|
|
|
|
QString m_TTSOpts;
|
|
|
|
QString m_TTSTemplate;
|
|
|
|
QString m_TTSLanguage;
|
|
|
|
QString m_TTSVoice;
|
|
|
|
QString m_TTSSpeed;
|
|
|
|
bool m_sapi4;
|
2007-12-15 13:13:57 +00:00
|
|
|
};
|
|
|
|
|
2008-02-12 21:45:50 +00:00
|
|
|
|
2007-12-15 13:13:57 +00:00
|
|
|
class TTSExes : public TTSBase
|
|
|
|
{
|
2008-02-12 21:45:50 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
TTSExes(QString name);
|
|
|
|
virtual bool voice(QString text,QString wavfile);
|
|
|
|
virtual bool start(QString *errStr);
|
|
|
|
virtual bool stop() {return true;}
|
|
|
|
virtual void showCfg();
|
|
|
|
virtual bool configOk();
|
2008-01-29 21:54:43 +00:00
|
|
|
|
2008-08-02 16:40:16 +00:00
|
|
|
virtual void setCfg(RbSettings* sett);
|
|
|
|
|
2008-02-12 21:45:50 +00:00
|
|
|
private:
|
|
|
|
QString m_name;
|
|
|
|
QString m_TTSexec;
|
|
|
|
QString m_TTSOpts;
|
|
|
|
QString m_TTSTemplate;
|
|
|
|
QMap<QString,QString> m_TemplateMap;
|
2007-12-15 13:13:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|