Fix too-soon frequency unboost when pcm buffer crosses watermark from the low side...
[kugel-rb.git] / rbutil / rbutilqt / tts.h
blob7c21fd0d65c18adead4326a9b71183bbc79cab46
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #ifndef TTS_H
24 #define TTS_H
27 #include "rbsettings.h"
28 #include <QtCore>
30 #ifndef CONSOLE
31 #include "ttsgui.h"
32 #else
33 #include "ttsguicli.h"
34 #endif
37 class TTSBase : public QObject
39 Q_OBJECT
40 public:
41 TTSBase();
42 virtual bool voice(QString text,QString wavfile)
43 { (void)text; (void)wavfile; return false; }
44 virtual bool start(QString *errStr) { (void)errStr; return false; }
45 virtual bool stop() { return false; }
46 virtual void showCfg(){}
47 virtual bool configOk() { return false; }
49 virtual void setCfg(RbSettings* sett) { settings = sett; }
51 static TTSBase* getTTS(QString ttsname);
52 static QStringList getTTSList();
53 static QString getTTSName(QString tts);
55 public slots:
56 virtual void accept(void){}
57 virtual void reject(void){}
58 virtual void reset(void){}
60 private:
61 //inits the tts List
62 static void initTTSList();
64 protected:
65 RbSettings* settings;
66 static QMap<QString,QString> ttsList;
67 static QMap<QString,TTSBase*> ttsCache;
70 class TTSSapi : public TTSBase
72 Q_OBJECT
73 public:
74 TTSSapi();
75 virtual bool voice(QString text,QString wavfile);
76 virtual bool start(QString *errStr);
77 virtual bool stop();
78 virtual void showCfg();
79 virtual bool configOk();
81 QStringList getVoiceList(QString language);
82 private:
83 QProcess* voicescript;
84 QTextStream* voicestream;
85 QString defaultLanguage;
87 QString m_TTSexec;
88 QString m_TTSOpts;
89 QString m_TTSTemplate;
90 QString m_TTSLanguage;
91 QString m_TTSVoice;
92 QString m_TTSSpeed;
93 bool m_sapi4;
97 class TTSExes : public TTSBase
99 Q_OBJECT
100 public:
101 TTSExes(QString name);
102 virtual bool voice(QString text,QString wavfile);
103 virtual bool start(QString *errStr);
104 virtual bool stop() {return true;}
105 virtual void showCfg();
106 virtual bool configOk();
108 virtual void setCfg(RbSettings* sett);
110 private:
111 QString m_name;
112 QString m_TTSexec;
113 QString m_TTSOpts;
114 QString m_TTSTemplate;
115 QMap<QString,QString> m_TemplateMap;
118 #endif