Make encoder name conversion functions static to the base class.
[Rockbox.git] / rbutil / rbutilqt / tts.h
blob251b9b4c6aeee1f1d436e36ff81b0e0fe4fb8038
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: tts.h 15212 2007-10-19 21:49:07Z domonoky $
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
21 #ifndef TTS_H
22 #define TTS_H
25 #include "rbsettings.h"
26 #include <QtCore>
28 #ifndef CONSOLE
29 #include "ttsgui.h"
30 #else
31 #include "ttsguicli.h"
32 #endif
35 class TTSBase : public QObject
37 Q_OBJECT
38 public:
39 TTSBase();
40 virtual bool voice(QString text,QString wavfile)
41 { (void)text; (void)wavfile; return false; }
42 virtual bool start(QString *errStr) { (void)errStr; return false; }
43 virtual bool stop() { return false; }
44 virtual void showCfg(){}
45 virtual bool configOk() { return false; }
47 void setCfg(RbSettings* sett) { settings = sett; }
49 static TTSBase* getTTS(QString ttsname);
50 static QStringList getTTSList();
51 static QString getTTSName(QString tts);
53 public slots:
54 virtual void accept(void){}
55 virtual void reject(void){}
56 virtual void reset(void){}
58 private:
59 //inits the tts List
60 static void initTTSList();
62 protected:
63 RbSettings* settings;
64 static QMap<QString,QString> ttsList;
65 static QMap<QString,TTSBase*> ttsCache;
68 class TTSSapi : public TTSBase
70 Q_OBJECT
71 public:
72 TTSSapi();
73 virtual bool voice(QString text,QString wavfile);
74 virtual bool start(QString *errStr);
75 virtual bool stop();
76 virtual void showCfg();
77 virtual bool configOk();
79 QStringList getVoiceList(QString language);
80 private:
81 QProcess* voicescript;
83 QString defaultLanguage;
85 QString m_TTSexec;
86 QString m_TTSOpts;
87 QString m_TTSTemplate;
88 QString m_TTSLanguage;
89 QString m_TTSVoice;
90 QString m_TTSSpeed;
91 bool m_sapi4;
95 class TTSExes : public TTSBase
97 Q_OBJECT
98 public:
99 TTSExes(QString name);
100 virtual bool voice(QString text,QString wavfile);
101 virtual bool start(QString *errStr);
102 virtual bool stop() {return true;}
103 virtual void showCfg();
104 virtual bool configOk();
106 private:
107 QString m_name;
108 QString m_TTSexec;
109 QString m_TTSOpts;
110 QString m_TTSTemplate;
111 QMap<QString,QString> m_TemplateMap;
114 #endif