diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-06-03 16:13:04 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-06-05 23:24:54 +0200 |
commit | b2380b535e99b4bc49d91bb228598f85362446ca (patch) | |
tree | 5144a4e0e9ef8b19e43ec9f71312a5b85901e1fe | |
parent | 7c78963bbb09603e8ceb986b478ae4762a6f427b (diff) | |
download | rockbox-b2380b535e99b4bc49d91bb228598f85362446ca.tar.gz rockbox-b2380b535e99b4bc49d91bb228598f85362446ca.zip |
voicefont: make format version a parameter.
Make hardcoded format version a parameter to allow adjusting depending on the
installed Rockbox version. Rockbox Utility will read the version from the
installed version. Since the command line voicefont tool is only intended for
use in the current tree it uses a fixed version.
Change-Id: I1ec935d47c71961e93b3c6bc6c5d816cd9fc83ff
-rw-r--r-- | rbutil/rbutilqt/base/rockboxinfo.cpp | 5 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/rockboxinfo.h | 2 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/voicefile.cpp | 4 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/voicefile.h | 1 | ||||
-rw-r--r-- | tools/voicefont.c | 6 | ||||
-rw-r--r-- | tools/voicefont.h | 2 |
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) | |||
26 | qDebug() << "[RockboxInfo] Getting version info from rockbox-info.txt"; | 26 | qDebug() << "[RockboxInfo] Getting version info from rockbox-info.txt"; |
27 | QFile file(mountpoint + "/" + fname); | 27 | QFile file(mountpoint + "/" + fname); |
28 | m_success = false; | 28 | m_success = false; |
29 | m_voicefmt = 400; // default value for compatibility | ||
29 | if(!file.exists()) | 30 | if(!file.exists()) |
30 | return; | 31 | return; |
31 | 32 | ||
@@ -40,6 +41,7 @@ RockboxInfo::RockboxInfo(QString mountpoint, QString fname) | |||
40 | QRegExp features("^Features:\\s+(\\S.*)"); | 41 | QRegExp features("^Features:\\s+(\\S.*)"); |
41 | QRegExp targetid("^Target id:\\s+(\\S.*)"); | 42 | QRegExp targetid("^Target id:\\s+(\\S.*)"); |
42 | QRegExp memory("^Memory:\\s+(\\S.*)"); | 43 | QRegExp memory("^Memory:\\s+(\\S.*)"); |
44 | QRegExp voicefmt("^Voice format:\\s+(\\S.*)"); | ||
43 | while (!file.atEnd()) | 45 | while (!file.atEnd()) |
44 | { | 46 | { |
45 | QString line = file.readLine().trimmed(); | 47 | QString line = file.readLine().trimmed(); |
@@ -68,6 +70,9 @@ RockboxInfo::RockboxInfo(QString mountpoint, QString fname) | |||
68 | else if(memory.indexIn(line) >= 0) { | 70 | else if(memory.indexIn(line) >= 0) { |
69 | m_ram = memory.cap(1).toInt(); | 71 | m_ram = memory.cap(1).toInt(); |
70 | } | 72 | } |
73 | else if(voicefmt.indexIn(line) >= 0) { | ||
74 | m_voicefmt = voicefmt.cap(1).toInt(); | ||
75 | } | ||
71 | } | 76 | } |
72 | 77 | ||
73 | file.close(); | 78 | 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: | |||
34 | QString targetID() {return m_targetid;} | 34 | QString targetID() {return m_targetid;} |
35 | QString target() {return m_target;} | 35 | QString target() {return m_target;} |
36 | int ram() { return m_ram; } | 36 | int ram() { return m_ram; } |
37 | int voicefmt() { return m_voicefmt; } | ||
37 | bool success() { return m_success; } | 38 | bool success() { return m_success; } |
38 | QString revision(void) { return m_revision; } | 39 | QString revision(void) { return m_revision; } |
39 | QString release(void) { return m_release; } | 40 | QString release(void) { return m_release; } |
@@ -45,6 +46,7 @@ private: | |||
45 | QString m_targetid; | 46 | QString m_targetid; |
46 | QString m_target; | 47 | QString m_target; |
47 | int m_ram; | 48 | int m_ram; |
49 | int m_voicefmt; | ||
48 | bool m_success; | 50 | bool m_success; |
49 | }; | 51 | }; |
50 | 52 | ||
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() | |||
59 | QString features = info.features(); | 59 | QString features = info.features(); |
60 | m_targetid = info.targetID().toInt(); | 60 | m_targetid = info.targetID().toInt(); |
61 | m_versionstring = info.version(); | 61 | m_versionstring = info.version(); |
62 | m_voiceformat = info.voicefmt(); | ||
62 | QString version = m_versionstring.left(m_versionstring.indexOf("-")).remove("r"); | 63 | QString version = m_versionstring.left(m_versionstring.indexOf("-")).remove("r"); |
63 | 64 | ||
64 | //prepare download url | 65 | //prepare download url |
@@ -231,7 +232,8 @@ void VoiceFileCreator::create(void) | |||
231 | return; | 232 | return; |
232 | } | 233 | } |
233 | 234 | ||
234 | voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output); | 235 | qDebug() << "[VoiceFile] Running voicefont, format" << m_voiceformat; |
236 | voicefont(ids2,m_targetid,m_path.toLocal8Bit().data(), output, m_voiceformat); | ||
235 | // ids2 and output are closed by voicefont(). | 237 | // ids2 and output are closed by voicefont(). |
236 | 238 | ||
237 | //cleanup | 239 | //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: | |||
67 | QString m_lang; // the language which will be spoken | 67 | QString m_lang; // the language which will be spoken |
68 | QString m_versionstring; // version string to be used for logging | 68 | QString m_versionstring; // version string to be used for logging |
69 | int m_wavtrimThreshold; | 69 | int m_wavtrimThreshold; |
70 | int m_voiceformat; | ||
70 | 71 | ||
71 | bool m_abort; | 72 | bool m_abort; |
72 | QList<TalkGenerator::TalkEntry> m_talkList; | 73 | 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) | |||
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output) | 73 | int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsigned int version) |
74 | { | 74 | { |
75 | 75 | ||
76 | int i,j; | 76 | int i,j; |
@@ -159,7 +159,7 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output) | |||
159 | /* Create the file format: */ | 159 | /* Create the file format: */ |
160 | 160 | ||
161 | /* 1st 32 bit value in the file is the version number */ | 161 | /* 1st 32 bit value in the file is the version number */ |
162 | value = UINT_TO_BE(400); /* 4.00 */ | 162 | value = UINT_TO_BE(version); |
163 | fwrite(&value, sizeof(value), 1, output); | 163 | fwrite(&value, sizeof(value), 1, output); |
164 | 164 | ||
165 | /* 2nd 32 bit value in the file is the id number for the target | 165 | /* 2nd 32 bit value in the file is the id number for the target |
@@ -243,7 +243,7 @@ int main (int argc, char** argv) | |||
243 | return -2; | 243 | return -2; |
244 | } | 244 | } |
245 | 245 | ||
246 | voicefont(ids, atoi(argv[2]),argv[3],output); | 246 | voicefont(ids, atoi(argv[2]),argv[3],output, 400); |
247 | return 0; | 247 | return 0; |
248 | } | 248 | } |
249 | #endif | 249 | #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 @@ | |||
34 | extern "C" { | 34 | extern "C" { |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output); | 37 | int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsigned int version); |
38 | 38 | ||
39 | #ifdef __cplusplus | 39 | #ifdef __cplusplus |
40 | } | 40 | } |