2008-01-11 23:59:12 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Wenger
|
2008-06-30 22:09:45 +00:00
|
|
|
* $Id$
|
2008-01-11 23:59:12 +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.
|
2008-01-11 23:59:12 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
2009-06-26 20:40:51 +00:00
|
|
|
#ifndef TALKGENERATOR_H
|
|
|
|
#define TALKGENERATOR_H
|
2008-01-11 23:59:12 +00:00
|
|
|
|
2008-02-10 18:25:49 +00:00
|
|
|
#include <QtCore>
|
2008-01-11 23:59:12 +00:00
|
|
|
#include "progressloggerinterface.h"
|
|
|
|
|
|
|
|
#include "encoders.h"
|
2009-10-13 19:54:27 +00:00
|
|
|
#include "ttsbase.h"
|
2008-01-11 23:59:12 +00:00
|
|
|
|
2009-06-26 20:40:51 +00:00
|
|
|
//! \brief Talk generator, generates .wav and .talk files out of a list.
|
|
|
|
class TalkGenerator :public QObject
|
2008-01-11 23:59:12 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2009-06-26 20:40:51 +00:00
|
|
|
enum Status
|
|
|
|
{
|
|
|
|
eOK,
|
|
|
|
eWARNING,
|
|
|
|
eERROR
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TalkEntry
|
|
|
|
{
|
|
|
|
QString toSpeak;
|
|
|
|
QString wavfilename;
|
|
|
|
QString talkfilename;
|
|
|
|
QString target;
|
|
|
|
bool voiced;
|
|
|
|
bool encoded;
|
2010-06-04 21:22:25 +00:00
|
|
|
|
|
|
|
/* We need the following members because
|
|
|
|
* 1) the QtConcurrent entry points are all static methods (and we
|
|
|
|
* need to communicate with the TalkGenerator)
|
|
|
|
* 2) we are not guaranteed to go through the list in any
|
|
|
|
* particular order, so we can't use the progress slot
|
|
|
|
* for error checking */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
EncBase* encoder;
|
|
|
|
TTSBase* tts;
|
|
|
|
TalkGenerator* generator;
|
|
|
|
int wavtrim;
|
|
|
|
} refs;
|
2009-06-26 20:40:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
TalkGenerator(QObject* parent);
|
|
|
|
Status process(QList<TalkEntry>* list,int wavtrimth = -1);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void abort();
|
2010-06-04 21:22:25 +00:00
|
|
|
void encProgress(int value);
|
|
|
|
void ttsProgress(int value);
|
2009-04-05 12:46:41 +00:00
|
|
|
|
2008-02-09 18:58:14 +00:00
|
|
|
signals:
|
2009-06-26 20:40:51 +00:00
|
|
|
void done(bool);
|
|
|
|
void logItem(QString, int); //! set logger item
|
|
|
|
void logProgress(int, int); //! set progress bar.
|
2009-04-05 12:46:41 +00:00
|
|
|
|
2008-01-11 23:59:12 +00:00
|
|
|
private:
|
2010-06-04 21:22:25 +00:00
|
|
|
QFutureWatcher<void> encFutureWatcher;
|
|
|
|
QFutureWatcher<void> ttsFutureWatcher;
|
|
|
|
void encFailEntry(const TalkEntry& entry);
|
|
|
|
void ttsFailEntry(const TalkEntry& entry, TTSStatus status, QString error);
|
|
|
|
|
2009-06-26 20:40:51 +00:00
|
|
|
Status voiceList(QList<TalkEntry>* list,int wavetrimth);
|
|
|
|
Status encodeList(QList<TalkEntry>* list);
|
2009-04-05 12:46:41 +00:00
|
|
|
|
2010-06-04 21:22:25 +00:00
|
|
|
static void encEntryPoint(TalkEntry& entry);
|
|
|
|
static void ttsEntryPoint(TalkEntry& entry);
|
|
|
|
|
2008-01-11 23:59:12 +00:00
|
|
|
TTSBase* m_tts;
|
|
|
|
EncBase* m_enc;
|
|
|
|
|
2010-06-04 21:22:25 +00:00
|
|
|
bool m_ttsWarnings;
|
2008-01-11 23:59:12 +00:00
|
|
|
};
|
2009-04-05 12:46:41 +00:00
|
|
|
|
2009-06-26 20:40:51 +00:00
|
|
|
|
2008-01-11 23:59:12 +00:00
|
|
|
#endif
|
2009-04-05 12:46:41 +00:00
|
|
|
|