rbutil: completely rework how tts and encoders are configured. (FS#10070)
[kugel-rb.git] / rbutil / rbutilqt / encoders.h
blobd5d1723a46b0b567c28f26f8fa1ab79a0ec30582
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 ****************************************************************************/
22 #ifndef ENCODERS_H
23 #define ENCODERS_H
25 #include <QtCore>
27 #include "rbsettings.h"
28 #include "encttssettings.h"
29 #include "rbspeex.h"
32 class EncBase : public EncTtsSettingInterface
34 Q_OBJECT
35 public:
36 EncBase(QObject *parent );
38 //! Child class should encode a wav file
39 virtual bool encode(QString input,QString output) =0;
40 //! Child class should do startup
41 virtual bool start()=0;
42 //! Child class should stop
43 virtual bool stop()=0;
45 // settings
46 //! Child class should return true when configuration is ok
47 virtual bool configOk()=0;
48 //! Child class should fill in the setttingsList
49 virtual void generateSettings() = 0;
50 //! Chlid class should commit the from SettingsList to permanent storage
51 virtual void saveSettings() = 0;
53 // static functions
54 static QString getEncoderName(QString name);
55 static EncBase* getEncoder(QObject* parent,QString name);
56 static QStringList getEncoderList(void);
58 //set the config. users of Encoder classes, always have to call this first
59 void setCfg(RbSettings *sett){settings = sett;}
60 private:
61 static void initEncodernamesList(void);
63 protected:
64 RbSettings* settings;
66 static QMap<QString,QString> encoderList;
70 class EncExes : public EncBase
72 enum ESettings
74 eEXEPATH,
75 eEXEOPTIONS
78 Q_OBJECT
79 public:
80 EncExes(QString name,QObject *parent = NULL);
81 bool encode(QString input,QString output);
82 bool start();
83 bool stop() {return true;}
85 // setting
86 bool configOk();
87 void generateSettings();
88 void saveSettings();
90 private:
91 QString m_name;
92 QString m_EncExec;
93 QString m_EncOpts;
94 QMap<QString,QString> m_TemplateMap;
95 QString m_EncTemplate;
98 class EncRbSpeex : public EncBase
100 enum ESettings
102 eVOLUME,
103 eQUALITY,
104 eCOMPLEXITY,
105 eNARROWBAND
108 Q_OBJECT
109 public:
110 EncRbSpeex(QObject *parent = NULL);
111 bool encode(QString input,QString output);
112 bool start();
113 bool stop() {return true;}
115 // for settings view
116 bool configOk();
117 void generateSettings();
118 void saveSettings();
120 private:
121 float quality;
122 float volume;
123 int complexity;
124 bool narrowband;
126 float defaultQuality;
127 float defaultVolume;
128 int defaultComplexity;
129 bool defaultBand;
133 #endif