summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/base/rockboxinfo.cpp5
-rw-r--r--rbutil/rbutilqt/base/rockboxinfo.h2
-rw-r--r--rbutil/rbutilqt/base/voicefile.cpp4
-rw-r--r--rbutil/rbutilqt/base/voicefile.h1
-rw-r--r--tools/voicefont.c6
-rw-r--r--tools/voicefont.h2
6 files changed, 15 insertions, 5 deletions
diff --git a/rbutil/rbutilqt/base/rockboxinfo.cpp b/rbutil/rbutilqt/base/rockboxinfo.cpp
index f9c0ea5b23..e5bce09d2c 100644
--- a/rbutil/rbutilqt/base/rockboxinfo.cpp
+++ b/rbutil/rbutilqt/base/rockboxinfo.cpp
@@ -26,6 +26,7 @@ RockboxInfo::RockboxInfo(QString mountpoint, QString fname)
qDebug() << "[RockboxInfo] Getting version info from rockbox-info.txt";
QFile file(mountpoint + "/" + fname);
m_success = false;
+ m_voicefmt = 400; // default value for compatibility
if(!file.exists())
return;
@@ -40,6 +41,7 @@ RockboxInfo::RockboxInfo(QString mountpoint, QString fname)
QRegExp features("^Features:\\s+(\\S.*)");
QRegExp targetid("^Target id:\\s+(\\S.*)");
QRegExp memory("^Memory:\\s+(\\S.*)");
+ QRegExp voicefmt("^Voice format:\\s+(\\S.*)");
while (!file.atEnd())
{
QString line = file.readLine().trimmed();
@@ -68,6 +70,9 @@ RockboxInfo::RockboxInfo(QString mountpoint, QString fname)
else if(memory.indexIn(line) >= 0) {
m_ram = memory.cap(1).toInt();
}
+ else if(voicefmt.indexIn(line) >= 0) {
+ m_voicefmt = voicefmt.cap(1).toInt();
+ }
}
file.close();
diff --git a/rbutil/rbutilqt/base/rockboxinfo.h b/rbutil/rbutilqt/base/rockboxinfo.h
index 9ea6e2011f..af5cf227f7 100644
--- a/rbutil/rbutilqt/base/rockboxinfo.h
+++ b/rbutil/rbutilqt/base/rockboxinfo.h
@@ -34,6 +34,7 @@ public:
QString targetID() {return m_targetid;}
QString target() {return m_target;}
int ram() { return m_ram; }
+ int voicefmt() { return m_voicefmt; }
bool success() { return m_success; }
QString revision(void) { return m_revision; }
QString release(void) { return m_release; }
@@ -45,6 +46,7 @@ private:
QString m_targetid;
QString m_target;
int m_ram;
+ int m_voicefmt;
bool m_success;
};
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp
index bbb703bc3d..b7a5f8f760 100644
--- a/rbutil/rbutilqt/base/voicefile.cpp
+++ b/rbutil/rbutilqt/base/voicefile.cpp
@@ -59,6 +59,7 @@ bool VoiceFileCreator::createVoiceFile()
QString features = info.features();
m_targetid = info.targetID().toInt();
m_versionstring = info.version();
+ m_voiceformat = info.voicefmt();
QString version = m_versionstring.left(m_versionstring.indexOf("-")).remove("r");
//prepare download url
@@ -231,7 +232,8 @@ void VoiceFileCreator::create(void)
return;
}
- voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output);
+ qDebug() << "[VoiceFile] Running voicefont, format" << m_voiceformat;
+ voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output, m_voiceformat);
// ids2 and output are closed by voicefont().
//cleanup
diff --git a/rbutil/rbutilqt/base/voicefile.h b/rbutil/rbutilqt/base/voicefile.h
index f3f6c7a930..d34535e700 100644
--- a/rbutil/rbutilqt/base/voicefile.h
+++ b/rbutil/rbutilqt/base/voicefile.h
@@ -67,6 +67,7 @@ private:
QString m_lang; // the language which will be spoken
QString m_versionstring; // version string to be used for logging
int m_wavtrimThreshold;
+ int m_voiceformat;
bool m_abort;
QList<TalkGenerator::TalkEntry> m_talkList;
diff --git a/tools/voicefont.c b/tools/voicefont.c
index 3b67e97436..4d1363b1bc 100644
--- a/tools/voicefont.c
+++ b/tools/voicefont.c
@@ -70,7 +70,7 @@ int BitswapAudio (unsigned char* pDest, unsigned char* pSrc, size_t len)
return 0;
}
-int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output)
+int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsigned int version)
{
int i,j;
@@ -159,7 +159,7 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output)
/* Create the file format: */
/* 1st 32 bit value in the file is the version number */
- value = UINT_TO_BE(400); /* 4.00 */
+ value = UINT_TO_BE(version);
fwrite(&value, sizeof(value), 1, output);
/* 2nd 32 bit value in the file is the id number for the target
@@ -243,7 +243,7 @@ int main (int argc, char** argv)
return -2;
}
- voicefont(ids, atoi(argv[2]),argv[3],output);
+ voicefont(ids, atoi(argv[2]),argv[3],output, 400);
return 0;
}
#endif
diff --git a/tools/voicefont.h b/tools/voicefont.h
index 6b603ef9be..dad7589c26 100644
--- a/tools/voicefont.h
+++ b/tools/voicefont.h
@@ -34,7 +34,7 @@
extern "C" {
#endif
-int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output);
+int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsigned int version);
#ifdef __cplusplus
}