forked from len0rd/rockbox
rbutil: added creation of voice files with rbutil.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16059 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5be332938d
commit
9f686700d4
12 changed files with 870 additions and 88 deletions
191
rbutil/rbutilqt/createvoicefrm.ui
Normal file
191
rbutil/rbutilqt/createvoicefrm.ui
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
<ui version="4.0" >
|
||||
<class>CreateVoiceFrm</class>
|
||||
<widget class="QDialog" name="CreateVoiceFrm" >
|
||||
<property name="windowModality" >
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>637</width>
|
||||
<height>421</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Create Voice File</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item rowspan="5" row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap" >
|
||||
<pixmap resource="rbutilqt.qrc" >:/icons/icons/wizard.xpm</pixmap>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Select the Language you want to generate a voicefile for:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2" >
|
||||
<widget class="QComboBox" name="comboLanguage" />
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<string>Generation settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="labelEncProfile" >
|
||||
<property name="text" >
|
||||
<string>Encoder profile:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="labelTtsProfile" >
|
||||
<property name="text" >
|
||||
<string>TTS profile:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QPushButton" name="change" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>201</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="2" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonOk" >
|
||||
<property name="text" >
|
||||
<string>&Install</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="rbutilqt.qrc" >:/icons/icons/go-next.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonCancel" >
|
||||
<property name="text" >
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="rbutilqt.qrc" >:/icons/icons/process-stop.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>change</tabstop>
|
||||
<tabstop>buttonOk</tabstop>
|
||||
<tabstop>buttonCancel</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="rbutilqt.qrc" />
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonOk</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>CreateVoiceFrm</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>472</x>
|
||||
<y>418</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>382</x>
|
||||
<y>328</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonCancel</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>CreateVoiceFrm</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>561</x>
|
||||
<y>428</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>522</x>
|
||||
<y>332</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
113
rbutil/rbutilqt/createvoicewindow.cpp
Normal file
113
rbutil/rbutilqt/createvoicewindow.cpp
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Riebeling
|
||||
* $Id: createvoicewindow.cpp 15932 2007-12-15 13:13:57Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "createvoicewindow.h"
|
||||
#include "ui_createvoicefrm.h"
|
||||
|
||||
#include "browsedirtree.h"
|
||||
#include "configure.h"
|
||||
|
||||
CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
voicecreator = new VoiceFileCreator(this);
|
||||
|
||||
connect(ui.change,SIGNAL(clicked()),this,SLOT(change()));
|
||||
}
|
||||
|
||||
void CreateVoiceWindow::change()
|
||||
{
|
||||
Config *cw = new Config(this,4);
|
||||
cw->setUserSettings(userSettings);
|
||||
cw->setDevices(devices);
|
||||
cw->show();
|
||||
connect(cw, SIGNAL(settingsUpdated()), this, SIGNAL(settingsUpdated()));
|
||||
}
|
||||
|
||||
void CreateVoiceWindow::accept()
|
||||
{
|
||||
logger = new ProgressLoggerGui(this);
|
||||
logger->show();
|
||||
connect(logger,SIGNAL(closed()),this,SLOT(close()));
|
||||
|
||||
QString platform = userSettings->value("platform").toString();
|
||||
QString lang = ui.comboLanguage->currentText();
|
||||
|
||||
//safe selected language
|
||||
userSettings->setValue("voicelanguage",lang);
|
||||
userSettings->sync();
|
||||
|
||||
//configure voicecreator
|
||||
voicecreator->setUserSettings(userSettings);
|
||||
voicecreator->setDeviceSettings(devices);
|
||||
voicecreator->setMountPoint(userSettings->value("mountpoint").toString());
|
||||
voicecreator->setTargetId(devices->value(platform + "/targetid").toInt());
|
||||
voicecreator->setLang(lang);
|
||||
voicecreator->setProxy(m_proxy);
|
||||
|
||||
//start creating
|
||||
voicecreator->createVoiceFile(logger);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateVoiceWindow::setDeviceSettings(QSettings *dev)
|
||||
{
|
||||
devices = dev;
|
||||
qDebug() << "Install::setDeviceSettings:" << devices;
|
||||
|
||||
// fill in language combobox
|
||||
devices->beginGroup("languages");
|
||||
QStringList keys = devices->allKeys();
|
||||
QStringList languages;
|
||||
for(int i =0 ; i < keys.size();i++)
|
||||
{
|
||||
languages << devices->value(keys.at(i)).toString();
|
||||
}
|
||||
devices->endGroup();
|
||||
|
||||
ui.comboLanguage->addItems(languages);
|
||||
// set saved lang
|
||||
ui.comboLanguage->setCurrentIndex(ui.comboLanguage->findText(userSettings->value("voicelanguage").toString()));
|
||||
}
|
||||
|
||||
void CreateVoiceWindow::setUserSettings(QSettings *user)
|
||||
{
|
||||
userSettings = user;
|
||||
|
||||
QString ttsName = userSettings->value("tts", "none").toString();
|
||||
TTSBase* tts = getTTS(ttsName);
|
||||
tts->setUserCfg(userSettings);
|
||||
if(tts->configOk())
|
||||
ui.labelTtsProfile->setText(tr("Selected TTS engine : <b>%1</b>").arg(ttsName));
|
||||
else
|
||||
ui.labelTtsProfile->setText(tr("Selected TTS Engine: <b>%1</b>").arg("Invalid TTS configuration!"));
|
||||
|
||||
QString encoder = userSettings->value("encoder", "none").toString();
|
||||
EncBase* enc = getEncoder(encoder);
|
||||
enc->setUserCfg(userSettings);
|
||||
if(enc->configOk())
|
||||
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder));
|
||||
else
|
||||
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
56
rbutil/rbutilqt/createvoicewindow.h
Normal file
56
rbutil/rbutilqt/createvoicewindow.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: installtalkwindow.h 15926 2007-12-14 19:49:11Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CREATEVOICEWINDOW_H
|
||||
#define CREATEVOICEWINDOW_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include "ui_createvoicefrm.h"
|
||||
#include "progressloggergui.h"
|
||||
#include "voicefile.h"
|
||||
|
||||
class CreateVoiceWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CreateVoiceWindow(QWidget *parent = 0);
|
||||
void setUserSettings(QSettings*);
|
||||
void setDeviceSettings(QSettings*);
|
||||
void setProxy(QUrl proxy){m_proxy = proxy;}
|
||||
|
||||
signals:
|
||||
void settingsUpdated(void);
|
||||
|
||||
public slots:
|
||||
void accept(void);
|
||||
void change(void);
|
||||
|
||||
private:
|
||||
VoiceFileCreator* voicecreator;
|
||||
Ui::CreateVoiceFrm ui;
|
||||
ProgressLoggerGui* logger;
|
||||
QSettings *devices;
|
||||
QSettings *userSettings;
|
||||
QUrl m_proxy;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -13,6 +13,7 @@ themes_url=http://www.rockbox-themes.org
|
|||
manual_url=http://download.rockbox.org/manual
|
||||
doom_url=http://download.rockbox.org/useful/rockdoom.zip
|
||||
voice_url=http://www.rockbox.org/voices/
|
||||
genlang_url=http://www.rockbox.org/genlang/
|
||||
|
||||
[platforms]
|
||||
platform01=player
|
||||
|
|
@ -56,6 +57,7 @@ resolution=11x2x1
|
|||
manualname=
|
||||
brand=Archos
|
||||
voicename=player
|
||||
targetid=1
|
||||
|
||||
[recorder]
|
||||
name="Jukebox Recorder 6 / 10 / 15 / 20"
|
||||
|
|
@ -68,6 +70,7 @@ resolution=112x64x1
|
|||
manualname=
|
||||
brand=Archos
|
||||
voicename=recorder
|
||||
targetid=2
|
||||
|
||||
[recorder8mb]
|
||||
name="Jukebox Recorder 6 / 10 / 15 / 20 (with 8MiB memory)"
|
||||
|
|
@ -80,6 +83,7 @@ resolution=112x64x1
|
|||
manualname=rockbox-recorder
|
||||
brand=Archos
|
||||
voicename=recorder
|
||||
targetid=2
|
||||
|
||||
[recorderv2]
|
||||
name="Jukebox Recorder v2 (20GB)"
|
||||
|
|
@ -92,6 +96,7 @@ resolution=112x64x1
|
|||
manualname=
|
||||
brand=Archos
|
||||
voicename=recorderv2
|
||||
targetid=4
|
||||
|
||||
[fmrecorder]
|
||||
name="Jukebox Recorder FM"
|
||||
|
|
@ -104,6 +109,7 @@ resolution=112x64x1
|
|||
manualname=
|
||||
brand=Archos
|
||||
voicename=fmrecorder
|
||||
targetid=3
|
||||
|
||||
[fmrecorder8mb]
|
||||
name="Jukebox Recorder FM (with 8MiB memory)"
|
||||
|
|
@ -116,6 +122,7 @@ resolution=112x64x1
|
|||
manualname=rockbox-fmrecorder
|
||||
brand=Archos
|
||||
voicename=fmrecorder
|
||||
targetid=3
|
||||
|
||||
[ondiosp]
|
||||
name="Ondio SP"
|
||||
|
|
@ -128,6 +135,7 @@ resolution=112x64x1
|
|||
manualname=
|
||||
brand=Archos
|
||||
voicename=ondiosp
|
||||
targetid=7
|
||||
|
||||
[ondiofm]
|
||||
name="Ondio FM"
|
||||
|
|
@ -140,6 +148,7 @@ resolution=112x64x1
|
|||
manualname=
|
||||
brand=Archos
|
||||
voicename=ondiofm
|
||||
targetid=8
|
||||
|
||||
[h100]
|
||||
name="iHP100 / iHP110"
|
||||
|
|
@ -153,6 +162,7 @@ manualname=rockbox-h100
|
|||
brand=Iriver
|
||||
usbid=0x10063001
|
||||
voicename=h100
|
||||
targetid=11
|
||||
|
||||
[h120]
|
||||
name="iHP120 / iHP140 / H120 / H140"
|
||||
|
|
@ -166,6 +176,7 @@ manualname=rockbox-h100
|
|||
brand=Iriver
|
||||
usbid=0x10063002
|
||||
voicename=h120
|
||||
targetid=9
|
||||
|
||||
[h300]
|
||||
name="H320 / H340"
|
||||
|
|
@ -179,6 +190,7 @@ manualname=rockbox-h300
|
|||
brand=Iriver
|
||||
usbid=0x10063003
|
||||
voicename=h300
|
||||
targetid=10
|
||||
|
||||
[h10_5gbums]
|
||||
name="H10 (5 / 6GB) UMS"
|
||||
|
|
@ -192,6 +204,7 @@ manualname=
|
|||
brand=Iriver
|
||||
usbid=0x41022002
|
||||
voicename=h10_5gb
|
||||
targetid=24
|
||||
|
||||
[h10_5gbmtp]
|
||||
name="H10 (5 / 6GB) MTP"
|
||||
|
|
@ -205,6 +218,7 @@ manualname=
|
|||
brand=Iriver
|
||||
usbid=0x41022105
|
||||
voicename=h10_5gb
|
||||
targetid=24
|
||||
|
||||
[h10]
|
||||
name="H10 (20GB)"
|
||||
|
|
@ -219,6 +233,7 @@ brand=Iriver
|
|||
usbid=0x0b7000ba
|
||||
usberror=0x41022101
|
||||
voicename=h10
|
||||
targetid=22
|
||||
|
||||
[ipod1g2g]
|
||||
name="Ipod (1st / 2nd gen)"
|
||||
|
|
@ -231,6 +246,7 @@ resolution=160x128x2
|
|||
manualname=
|
||||
brand=Apple
|
||||
voicename=ipod1g2g
|
||||
targetid=29
|
||||
|
||||
[ipodcolor]
|
||||
name="Ipod Colour / Photo / U2 (4th gen)"
|
||||
|
|
@ -243,6 +259,7 @@ resolution=220x176x16
|
|||
manualname=
|
||||
brand=Apple
|
||||
voicename=ipodcolor
|
||||
targetid=13
|
||||
|
||||
[ipodnano]
|
||||
name="Ipod Nano (1st gen)"
|
||||
|
|
@ -256,6 +273,7 @@ manualname=
|
|||
brand=Apple
|
||||
usbid=0x05ac120a
|
||||
voicename=ipodnano
|
||||
targetid=14
|
||||
|
||||
[ipod4gray]
|
||||
name="Ipod (4th gen, greyscale)"
|
||||
|
|
@ -268,6 +286,7 @@ resolution=160x128x2
|
|||
manualname=
|
||||
brand=Apple
|
||||
voicename=ipod4gray
|
||||
targetid=17
|
||||
|
||||
[ipodvideo]
|
||||
name="Ipod Video (5th gen) 30GB"
|
||||
|
|
@ -280,6 +299,7 @@ resolution=320x240x16
|
|||
manualname=
|
||||
brand=Apple
|
||||
voicename=ipodvideo
|
||||
targetid=15
|
||||
|
||||
[ipodvideo64mb]
|
||||
name="Ipod Video (5th gen) 60/80GB"
|
||||
|
|
@ -292,6 +312,7 @@ resolution=320x240x16
|
|||
manualname=
|
||||
brand=Apple
|
||||
voicename=ipodvideo
|
||||
targetid=15
|
||||
|
||||
[ipod3g]
|
||||
name="Ipod (3rd gen)"
|
||||
|
|
@ -305,6 +326,7 @@ manualname=
|
|||
brand=Apple
|
||||
usbid=0x05ac1201
|
||||
voicename=ipod3g
|
||||
targetid=16
|
||||
|
||||
[ipodmini1g]
|
||||
name="Ipod Mini (1st gen)"
|
||||
|
|
@ -317,6 +339,7 @@ resolution=138x110x2
|
|||
manualname=rockbox-ipodmini2g
|
||||
brand=Apple
|
||||
voicename=ipodmini1g
|
||||
targetid=18
|
||||
|
||||
[ipodmini2g]
|
||||
name="Ipod Mini (2nd gen)"
|
||||
|
|
@ -329,6 +352,7 @@ resolution=138x110x2
|
|||
manualname=rockbox-ipodmini2g
|
||||
brand=Apple
|
||||
voicename=ipodmini2g
|
||||
targetid=21
|
||||
|
||||
[iaudiox5]
|
||||
name="iAudio X5 / X5L"
|
||||
|
|
@ -343,6 +367,7 @@ brand=Cowon
|
|||
usbid=0x0e210510
|
||||
usbid=0x0e210513
|
||||
voicename=iaudiox5
|
||||
targetid=12
|
||||
|
||||
[iaudiox5v]
|
||||
name="iAudio X5V"
|
||||
|
|
@ -355,6 +380,7 @@ resolution=160x128x2
|
|||
manualname=
|
||||
brand=Cowon
|
||||
voicename=iaudiox5v
|
||||
targetid=12
|
||||
|
||||
[iaudiom5]
|
||||
name="iAudio M5 / M5L"
|
||||
|
|
@ -368,6 +394,7 @@ manualname=
|
|||
brand=Cowon
|
||||
usbid=0x0e210520
|
||||
voicename=iaudiom5
|
||||
targetid=28
|
||||
|
||||
[gigabeatf]
|
||||
name="Gigabeat F / X"
|
||||
|
|
@ -380,6 +407,7 @@ manualname=
|
|||
brand=Toshiba
|
||||
usbid=0x09300009
|
||||
voicename=gigabeatf
|
||||
targetid=20
|
||||
|
||||
[sansae200]
|
||||
name="Sansa E200"
|
||||
|
|
@ -394,6 +422,7 @@ brand=Sandisk
|
|||
usbid=0x07817421
|
||||
usberror=0x07810720
|
||||
voicename=sansae200
|
||||
targetid=23
|
||||
|
||||
[sansac200]
|
||||
name="Sansa C200"
|
||||
|
|
@ -406,80 +435,44 @@ resolution=132x80x16
|
|||
manualname=
|
||||
brand=Sandisk
|
||||
voicename=sansac200
|
||||
targetid=30
|
||||
|
||||
[tts]
|
||||
ttspreset01 = "espeak (default)"
|
||||
ttspreset02 = "espeak (user-adjusted)"
|
||||
ttspreset03 = "flite (default)"
|
||||
ttspreset04 = "flite (user-adjusted)"
|
||||
ttspreset05 = "sapi (default)"
|
||||
ttspreset06 = "sapi (user-adjusted)"
|
||||
ttspreset07 = "swift (default)"
|
||||
ttspreset08 = "swift (user-adjusted)"
|
||||
[languages]
|
||||
lang1=africaans
|
||||
lang2=bulgarian
|
||||
lang3=catala
|
||||
lang4=chinese-simp
|
||||
lang5=chinese-trad
|
||||
lang6=czech
|
||||
lang7=dansk
|
||||
lang8=deutsch
|
||||
lang9=eesti
|
||||
lang10=english
|
||||
lang11=espanol
|
||||
lang12=esperanto
|
||||
lang13=finnish
|
||||
lang14=francais
|
||||
lang15=galego
|
||||
lang16=greek
|
||||
lang17=hebrew
|
||||
lang18=islenska
|
||||
lang19=italiano
|
||||
lang20=japanese
|
||||
lang21=korean
|
||||
lang22=magyar
|
||||
lang23=nederlands
|
||||
lang24=norsk
|
||||
lang25=norsk-nynorsk
|
||||
lang26=polski
|
||||
lang27=portugues
|
||||
lang28=portugues-brasileiro
|
||||
lang29=romaneste
|
||||
lang30=russian
|
||||
lang31=slovenscina
|
||||
lang32=svenska
|
||||
lang33=thai
|
||||
lang34=turkce
|
||||
lang35=wallisertitsch
|
||||
|
||||
|
||||
[ttspreset01]
|
||||
tts = "espeak"
|
||||
options = ""
|
||||
template = "\"%exe\" \"%options\" -w \"%wavfile\" \"%text\""
|
||||
edit = false
|
||||
os = all
|
||||
needslanguagecfg = false
|
||||
|
||||
[ttspreset02]
|
||||
tts = "espeak"
|
||||
options = ""
|
||||
template = "\"%exe\" \"%options\" -w \"%wavfile\" \"%text\""
|
||||
edit = true
|
||||
os = all
|
||||
needslanguagecfg = false
|
||||
|
||||
[ttspreset03]
|
||||
tts = "flite"
|
||||
options = ""
|
||||
template = "\"%exe\" \"%options\" -o \"%wavfile\" \"%text\""
|
||||
edit = false
|
||||
os = all
|
||||
needslanguagecfg = false
|
||||
|
||||
[ttspreset04]
|
||||
tts = "flite"
|
||||
options = ""
|
||||
template = "\"%exe\" \"%options\" -o \"%wavfile\" \"%text\""
|
||||
edit = true
|
||||
os = all
|
||||
needslanguagecfg = false
|
||||
|
||||
[ttspreset05]
|
||||
tts = "sapi"
|
||||
options = ""
|
||||
template = "cscript //nologo \"%exe\" /language:%lang \"%options\""
|
||||
edit = false
|
||||
os = win32
|
||||
needslanguagecfg = true
|
||||
|
||||
[ttspreset06]
|
||||
tts = "sapi"
|
||||
options = ""
|
||||
template = "cscript //nologo \"%exe\" /language:%lang \"%options\""
|
||||
edit = true
|
||||
os = win32
|
||||
needslanguagecfg = true
|
||||
|
||||
[ttspreset07]
|
||||
tts = "swift"
|
||||
options = ""
|
||||
template = "\"%exe\" \"%options\" -o \"%wavfile\" \"%text\""
|
||||
edit = false
|
||||
os = all
|
||||
needslanguagecfg = false
|
||||
|
||||
[ttspreset08]
|
||||
tts = "swift"
|
||||
options = ""
|
||||
template = "\"%exe\" \"%options\" -o \"%wavfile\" \"%text\""
|
||||
edit = true
|
||||
os = all
|
||||
needslanguagecfg = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "configure.h"
|
||||
#include "install.h"
|
||||
#include "installtalkwindow.h"
|
||||
#include "createvoicewindow.h"
|
||||
#include "httpget.h"
|
||||
#include "installbootloader.h"
|
||||
#include "installthemes.h"
|
||||
|
|
@ -89,6 +90,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
|||
connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFontsBtn()));
|
||||
connect(ui.buttonGames, SIGNAL(clicked()), this, SLOT(installDoomBtn()));
|
||||
connect(ui.buttonTalk, SIGNAL(clicked()), this, SLOT(createTalkFiles()));
|
||||
connect(ui.buttonCreateVoice, SIGNAL(clicked()), this, SLOT(createVoiceFile()));
|
||||
connect(ui.buttonVoice, SIGNAL(clicked()), this, SLOT(installVoice()));
|
||||
connect(ui.buttonThemes, SIGNAL(clicked()), this, SLOT(installThemes()));
|
||||
connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall()));
|
||||
|
|
@ -106,6 +108,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
|||
connect(ui.actionInstall_Themes, SIGNAL(triggered()), this, SLOT(installThemes()));
|
||||
connect(ui.actionInstall_Game_Files, SIGNAL(triggered()), this, SLOT(installDoomBtn()));
|
||||
connect(ui.actionInstall_Voice_File, SIGNAL(triggered()), this, SLOT(installVoice()));
|
||||
connect(ui.actionCreate_Voice_File, SIGNAL(triggered()), this, SLOT(createVoiceFile()));
|
||||
connect(ui.actionCreate_Talk_Files, SIGNAL(triggered()), this, SLOT(createTalkFiles()));
|
||||
connect(ui.actionRemove_bootloader, SIGNAL(triggered()), this, SLOT(uninstallBootloader()));
|
||||
connect(ui.actionUninstall_Rockbox, SIGNAL(triggered()), this, SLOT(uninstall()));
|
||||
|
|
@ -753,6 +756,19 @@ void RbUtilQt::createTalkFiles(void)
|
|||
|
||||
}
|
||||
|
||||
void RbUtilQt::createVoiceFile(void)
|
||||
{
|
||||
if(chkConfig(true)) return;
|
||||
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
|
||||
installWindow->setUserSettings(userSettings);
|
||||
installWindow->setDeviceSettings(devices);
|
||||
installWindow->setProxy(proxy());
|
||||
|
||||
installWindow->show();
|
||||
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
|
||||
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
||||
}
|
||||
|
||||
void RbUtilQt::uninstall(void)
|
||||
{
|
||||
if(chkConfig(true)) return;
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ class RbUtilQt : public QMainWindow
|
|||
void installDoom(void);
|
||||
|
||||
void createTalkFiles(void);
|
||||
void createVoiceFile(void);
|
||||
void downloadDone(bool);
|
||||
void downloadDone(int, bool);
|
||||
void downloadBleedingDone(bool);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,11 @@ SOURCES += rbutilqt.cpp \
|
|||
browseof.cpp \
|
||||
preview.cpp \
|
||||
encoders.cpp \
|
||||
tts.cpp
|
||||
tts.cpp \
|
||||
../../tools/wavtrim.c \
|
||||
../../tools/voicefont.c \
|
||||
voicefile.cpp \
|
||||
createvoicewindow.cpp
|
||||
|
||||
HEADERS += rbutilqt.h \
|
||||
install.h \
|
||||
|
|
@ -80,10 +84,14 @@ HEADERS += rbutilqt.h \
|
|||
browseof.h \
|
||||
preview.h \
|
||||
encoders.h \
|
||||
tts.h
|
||||
tts.h \
|
||||
../../tools/wavtrim.h \
|
||||
../../tools/voicefont.h \
|
||||
voicefile.h \
|
||||
createvoicewindow.h
|
||||
|
||||
# Needed by QT on Win
|
||||
INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex
|
||||
INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools
|
||||
|
||||
LIBS += -L../../tools/rbspeex -lrbspeex
|
||||
|
||||
|
|
@ -115,7 +123,8 @@ FORMS += rbutilqtfrm.ui \
|
|||
rbspeexcfgfrm.ui \
|
||||
encexescfgfrm.ui \
|
||||
ttsexescfgfrm.ui \
|
||||
sapicfgfrm.ui
|
||||
sapicfgfrm.ui \
|
||||
createvoicefrm.ui
|
||||
|
||||
RESOURCES += rbutilqt.qrc
|
||||
win32 {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
<qresource prefix="/docs" >
|
||||
<file>CREDITS</file>
|
||||
<file>gpl-2.0.html</file>
|
||||
</qresource>
|
||||
<qresource>
|
||||
<file alias="builtin/VOICE_PAUSE.wav">../../tools/VOICE_PAUSE.wav</file>
|
||||
</qresource>
|
||||
<qresource prefix="/icons" >
|
||||
<file>icons/audio-input-microphone.png</file>
|
||||
|
|
|
|||
|
|
@ -490,16 +490,16 @@ p, li { white-space: pre-wrap; }
|
|||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Install Voice file</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Voice files are needed to make Rockbox speak the user interface. Speaking is enabled by default, so if you installed the voice file Rockbox will speak.</p></body></html></string>
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"><span style=" font-weight:600;">Install Voice file</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">Voice files are needed to make Rockbox speak the user interface. Speaking is enabled by default, so if you installed the voice file Rockbox will speak.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<item row="2" column="0" >
|
||||
<widget class="QToolButton" name="buttonTalk" >
|
||||
<property name="text" >
|
||||
<string>Install Talk files</string>
|
||||
|
|
@ -515,7 +515,7 @@ p, li { white-space: pre-wrap; }
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLabel" name="labelTalk" >
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
|
|
@ -526,7 +526,7 @@ p, li { white-space: pre-wrap; }
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<item row="3" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
|
@ -539,7 +539,7 @@ p, li { white-space: pre-wrap; }
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<item row="3" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
|
@ -552,6 +552,34 @@ p, li { white-space: pre-wrap; }
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QToolButton" name="buttonCreateVoice" >
|
||||
<property name="text" >
|
||||
<string>Install Voice files</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="rbutilqt.qrc" >:/icons/icons/talkfile_btn.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize" >
|
||||
<size>
|
||||
<width>56</width>
|
||||
<height>46</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLabel" name="labelCreateVoice" >
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><span style=" font-size:9pt; font-weight:600;">Create Voice file</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">Voice files are needed to make Rockbox speak the user interface. Speaking is enabled by default, so</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"> if you installed the voice file Rockbox will speak.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="uninstall" >
|
||||
|
|
@ -801,7 +829,7 @@ p, li { white-space: pre-wrap; }
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>662</width>
|
||||
<height>29</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File" >
|
||||
|
|
@ -853,6 +881,7 @@ p, li { white-space: pre-wrap; }
|
|||
<string>Accessibility</string>
|
||||
</property>
|
||||
<addaction name="actionInstall_Voice_File" />
|
||||
<addaction name="actionCreate_Voice_File" />
|
||||
<addaction name="actionCreate_Talk_Files" />
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuUninstallation" >
|
||||
|
|
@ -1024,6 +1053,18 @@ p, li { white-space: pre-wrap; }
|
|||
<string>Download HTML manual (zip)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreate_Voice_File" >
|
||||
<property name="icon" >
|
||||
<iconset resource="rbutilqt.qrc" >:/icons/icons/talkfile_btn.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Create Voice File</string>
|
||||
</property>
|
||||
<property name="iconText" >
|
||||
<string>Create Voic<resource type="image" qrc="C:/cygwin/home/Domonoky/rockbox-svn/rockbox-rbspeex/rbutil/rbutilqt/rbutilqt.qrc" file=":/icons/icons/talkfile_btn.png" />
|
||||
e File</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ bool TTSSapi::voice(QString text,QString wavfile)
|
|||
{
|
||||
QString query = "SPEAK\t"+wavfile+"\t"+text+"\r\n";
|
||||
qDebug() << "voicing" << query;
|
||||
voicescript->write(query.toLocal8Bit());
|
||||
voicescript->write(query.toUtf8());
|
||||
voicescript->write("SYNC\tbla\r\n");
|
||||
voicescript->waitForReadyRead();
|
||||
return true;
|
||||
|
|
@ -293,7 +293,7 @@ bool TTSSapi::voice(QString text,QString wavfile)
|
|||
bool TTSSapi::stop()
|
||||
{
|
||||
QString query = "QUIT\r\n";
|
||||
voicescript->write(query.toLocal8Bit());
|
||||
voicescript->write(query.toUtf8());
|
||||
voicescript->waitForFinished();
|
||||
delete voicescript;
|
||||
return true;
|
||||
|
|
|
|||
275
rbutil/rbutilqt/voicefile.cpp
Normal file
275
rbutil/rbutilqt/voicefile.cpp
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: voicefile.h 15932 2007-12-15 13:13:57Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "voicefile.h"
|
||||
|
||||
#define STATE_INVALID 0
|
||||
#define STATE_PHRASE 1
|
||||
#define STATE_VOICE 2
|
||||
|
||||
|
||||
VoiceFileCreator::VoiceFileCreator(QObject* parent) :QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void VoiceFileCreator::abort()
|
||||
{
|
||||
m_abort = true;
|
||||
}
|
||||
|
||||
bool VoiceFileCreator::createVoiceFile(ProgressloggerInterface* logger)
|
||||
{
|
||||
m_abort = false;
|
||||
m_logger = logger;
|
||||
m_logger->addItem("Starting Voicefile generation",LOGINFO);
|
||||
|
||||
// test if tempdir exists
|
||||
if(!QDir(QDir::tempPath()+"/rbvoice/").exists())
|
||||
{
|
||||
QDir(QDir::tempPath()).mkdir("rbvoice");
|
||||
}
|
||||
|
||||
m_path = QDir::tempPath() + "/rbvoice/";
|
||||
|
||||
// read rockbox-info.txt
|
||||
QFile info(m_mountpoint+"/.rockbox/rockbox-info.txt");
|
||||
if(!info.open(QIODevice::ReadOnly))
|
||||
{
|
||||
m_logger->addItem("failed to open rockbox-info.txt",LOGERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
QString target, features,version;
|
||||
while (!info.atEnd()) {
|
||||
QString line = info.readLine();
|
||||
|
||||
if(line.contains("Target:"))
|
||||
{
|
||||
target = line.remove("Target:").trimmed();
|
||||
}
|
||||
else if(line.contains("Features:"))
|
||||
{
|
||||
features = line.remove("Features:").trimmed();
|
||||
}
|
||||
else if(line.contains("Version:"))
|
||||
{
|
||||
version = line.remove("Version:").trimmed();
|
||||
version = version.left(version.indexOf("-")).remove(0,1);
|
||||
}
|
||||
}
|
||||
info.close();
|
||||
|
||||
//prepare download url
|
||||
QUrl genlangUrl = deviceSettings->value("genlang_url").toString() +"?lang=" +m_lang+"&t="+target+"&rev="+version+"&f="+features;
|
||||
|
||||
qDebug() << "downloading " << genlangUrl;
|
||||
|
||||
//download the correct genlang output
|
||||
QTemporaryFile *downloadFile = new QTemporaryFile(this);
|
||||
downloadFile->open();
|
||||
filename = downloadFile->fileName();
|
||||
downloadFile->close();
|
||||
// get the real file.
|
||||
getter = new HttpGet(this);
|
||||
getter->setProxy(m_proxy);
|
||||
getter->setFile(downloadFile);
|
||||
getter->getFile(genlangUrl);
|
||||
|
||||
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
||||
connect(getter, SIGNAL(downloadDone(int, bool)), this, SLOT(downloadRequestFinished(int, bool)));
|
||||
connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
|
||||
connect(m_logger, SIGNAL(aborted()), getter, SLOT(abort()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void VoiceFileCreator::downloadRequestFinished(int id, bool error)
|
||||
{
|
||||
qDebug() << "Install::downloadRequestFinished" << id << error;
|
||||
qDebug() << "error:" << getter->errorString();
|
||||
|
||||
downloadDone(error);
|
||||
}
|
||||
|
||||
|
||||
void VoiceFileCreator::downloadDone(bool error)
|
||||
{
|
||||
qDebug() << "Voice creator::downloadDone, error:" << error;
|
||||
|
||||
// update progress bar
|
||||
int max = m_logger->getProgressMax();
|
||||
if(max == 0) {
|
||||
max = 100;
|
||||
m_logger->setProgressMax(max);
|
||||
}
|
||||
m_logger->setProgressValue(max);
|
||||
if(getter->httpResponse() != 200 && !getter->isCached()) {
|
||||
m_logger->addItem(tr("Download error: received HTTP error %1.").arg(getter->httpResponse()),LOGERROR);
|
||||
m_logger->abort();
|
||||
return;
|
||||
}
|
||||
if(getter->isCached()) m_logger->addItem(tr("Cached file used."), LOGINFO);
|
||||
if(error) {
|
||||
m_logger->addItem(tr("Download error: %1").arg(getter->errorString()),LOGERROR);
|
||||
m_logger->abort();
|
||||
return;
|
||||
}
|
||||
else m_logger->addItem(tr("Download finished."),LOGOK);
|
||||
QApplication::processEvents();
|
||||
|
||||
|
||||
m_logger->setProgressMax(0);
|
||||
//open downloaded file
|
||||
QFile genlang(filename);
|
||||
if(!genlang.open(QIODevice::ReadOnly))
|
||||
{
|
||||
m_logger->addItem("failed to open downloaded file",LOGERROR);
|
||||
m_logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
//tts
|
||||
m_tts = getTTS(userSettings->value("tts").toString());
|
||||
m_tts->setUserCfg(userSettings);
|
||||
|
||||
if(!m_tts->start())
|
||||
{
|
||||
m_logger->addItem("Init of TTS engine failed",LOGERROR);
|
||||
m_logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
// Encoder
|
||||
m_enc = getEncoder(userSettings->value("encoder").toString());
|
||||
m_enc->setUserCfg(userSettings);
|
||||
|
||||
if(!m_enc->start())
|
||||
{
|
||||
m_logger->addItem("Init of Encoder engine failed",LOGERROR);
|
||||
m_tts->stop();
|
||||
m_logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
QApplication::processEvents();
|
||||
|
||||
connect(m_logger,SIGNAL(aborted()),this,SLOT(abort()));
|
||||
QStringList mp3files;
|
||||
|
||||
QTextStream in(&genlang);
|
||||
in.setCodec("UTF-8");
|
||||
|
||||
bool emptyfile = true;
|
||||
while (!in.atEnd())
|
||||
{
|
||||
if(m_abort)
|
||||
{
|
||||
m_logger->addItem("aborted.",LOGERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
QString comment = in.readLine();
|
||||
QString id = in.readLine();
|
||||
QString voice = in.readLine();
|
||||
|
||||
id = id.remove("id:").remove('"').trimmed();
|
||||
voice = voice.remove("voice:").remove('"').trimmed();
|
||||
|
||||
QString wavname = m_path + "/" + id + ".wav";
|
||||
QString toSpeak = voice;
|
||||
QString encodedname = m_path + "/" + id +".mp3";
|
||||
|
||||
// todo PAUSE
|
||||
if(id == "VOICE_PAUSE")
|
||||
{
|
||||
QFile::copy(":/builtin/builtin/VOICE_PAUSE.wav",m_path + "/VOICE_PAUSE.wav");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(voice == "") continue;
|
||||
|
||||
m_logger->addItem(tr("creating ")+toSpeak,LOGINFO);
|
||||
QApplication::processEvents();
|
||||
m_tts->voice(toSpeak,wavname); // generate wav
|
||||
}
|
||||
|
||||
// todo strip
|
||||
char buffer[255];
|
||||
|
||||
wavtrim((char*)qPrintable(wavname),500,buffer,255);
|
||||
|
||||
// encode wav
|
||||
m_enc->encode(wavname,encodedname);
|
||||
// remove the wav file
|
||||
QFile::remove(wavname);
|
||||
// remember the mp3 file for later removing
|
||||
mp3files << encodedname;
|
||||
// remember that we have done something
|
||||
emptyfile = false;
|
||||
|
||||
}
|
||||
genlang.close();
|
||||
|
||||
if(emptyfile)
|
||||
{
|
||||
m_logger->addItem(tr("The downloaded file was empty!"),LOGERROR);
|
||||
m_logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
//make voicefile
|
||||
FILE* ids2 = fopen(filename.toUtf8(), "r");
|
||||
if (ids2 == NULL)
|
||||
{
|
||||
m_logger->addItem("Error opening downloaded file",LOGERROR);
|
||||
m_logger->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
FILE* output = fopen(QString(m_mountpoint + "/.rockbox/langs/" + m_lang + ".voice").toUtf8(), "wb");
|
||||
if (output == NULL)
|
||||
{
|
||||
m_logger->addItem("Error opening output file",LOGERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
voicefont(ids2,m_targetid,(char*)(const char*)m_path.toUtf8(), output);
|
||||
|
||||
//remove .mp3 files
|
||||
for(int i=0;i< mp3files.size(); i++)
|
||||
{
|
||||
QFile::remove(mp3files.at(i));
|
||||
}
|
||||
|
||||
m_logger->setProgressMax(100);
|
||||
m_logger->setProgressValue(100);
|
||||
m_logger->addItem("successfully created.",LOGOK);
|
||||
m_logger->abort();
|
||||
}
|
||||
|
||||
void VoiceFileCreator::updateDataReadProgress(int read, int total)
|
||||
{
|
||||
m_logger->setProgressMax(total);
|
||||
m_logger->setProgressValue(read);
|
||||
//qDebug() << "progress:" << read << "/" << total;
|
||||
|
||||
}
|
||||
|
||||
84
rbutil/rbutilqt/voicefile.h
Normal file
84
rbutil/rbutilqt/voicefile.h
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
* $Id: voicefile.h 15932 2007-12-15 13:13:57Z domonoky $
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef VOICEFILE_H
|
||||
#define VOICEFILE_H
|
||||
|
||||
#include <QtGui>
|
||||
#include "progressloggerinterface.h"
|
||||
|
||||
#include "encoders.h"
|
||||
#include "tts.h"
|
||||
#include "httpget.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "wavtrim.h"
|
||||
#include "voicefont.h"
|
||||
}
|
||||
|
||||
class VoiceFileCreator :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VoiceFileCreator(QObject* parent=0);
|
||||
|
||||
//start creation
|
||||
bool createVoiceFile(ProgressloggerInterface* logger);
|
||||
|
||||
// set infos
|
||||
void setUserSettings(QSettings* setting) { userSettings = setting;}
|
||||
void setDeviceSettings(QSettings* setting) { deviceSettings = setting;}
|
||||
|
||||
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
|
||||
void setTargetId(int id){m_targetid = id;}
|
||||
void setLang(QString name){m_lang =name;}
|
||||
void setProxy(QUrl proxy){m_proxy = proxy;}
|
||||
|
||||
private slots:
|
||||
void abort();
|
||||
void downloadRequestFinished(int id, bool error);
|
||||
void downloadDone(bool error);
|
||||
void updateDataReadProgress(int read, int total);
|
||||
|
||||
private:
|
||||
|
||||
// ptr to encoder, tts and settings
|
||||
TTSBase* m_tts;
|
||||
EncBase* m_enc;
|
||||
QSettings *userSettings;
|
||||
QSettings *deviceSettings;
|
||||
|
||||
HttpGet *getter;
|
||||
|
||||
QUrl m_proxy; //proxy
|
||||
QString filename; //the temporary file
|
||||
|
||||
QString m_mountpoint; //mountpoint of the device
|
||||
QString m_path; //path where the wav and mp3 files are stored to
|
||||
int m_targetid; //the target id
|
||||
QString m_lang; // the language which will be spoken
|
||||
|
||||
ProgressloggerInterface* m_logger;
|
||||
|
||||
bool m_abort;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue