forked from len0rd/rockbox
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
This commit is contained in:
parent
7c78963bbb
commit
b2380b535e
6 changed files with 15 additions and 5 deletions
|
@ -26,6 +26,7 @@ RockboxInfo::RockboxInfo(QString mountpoint, QString fname)
|
||||||
qDebug() << "[RockboxInfo] Getting version info from rockbox-info.txt";
|
qDebug() << "[RockboxInfo] Getting version info from rockbox-info.txt";
|
||||||
QFile file(mountpoint + "/" + fname);
|
QFile file(mountpoint + "/" + fname);
|
||||||
m_success = false;
|
m_success = false;
|
||||||
|
m_voicefmt = 400; // default value for compatibility
|
||||||
if(!file.exists())
|
if(!file.exists())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -40,6 +41,7 @@ RockboxInfo::RockboxInfo(QString mountpoint, QString fname)
|
||||||
QRegExp features("^Features:\\s+(\\S.*)");
|
QRegExp features("^Features:\\s+(\\S.*)");
|
||||||
QRegExp targetid("^Target id:\\s+(\\S.*)");
|
QRegExp targetid("^Target id:\\s+(\\S.*)");
|
||||||
QRegExp memory("^Memory:\\s+(\\S.*)");
|
QRegExp memory("^Memory:\\s+(\\S.*)");
|
||||||
|
QRegExp voicefmt("^Voice format:\\s+(\\S.*)");
|
||||||
while (!file.atEnd())
|
while (!file.atEnd())
|
||||||
{
|
{
|
||||||
QString line = file.readLine().trimmed();
|
QString line = file.readLine().trimmed();
|
||||||
|
@ -68,6 +70,9 @@ RockboxInfo::RockboxInfo(QString mountpoint, QString fname)
|
||||||
else if(memory.indexIn(line) >= 0) {
|
else if(memory.indexIn(line) >= 0) {
|
||||||
m_ram = memory.cap(1).toInt();
|
m_ram = memory.cap(1).toInt();
|
||||||
}
|
}
|
||||||
|
else if(voicefmt.indexIn(line) >= 0) {
|
||||||
|
m_voicefmt = voicefmt.cap(1).toInt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
|
@ -34,6 +34,7 @@ public:
|
||||||
QString targetID() {return m_targetid;}
|
QString targetID() {return m_targetid;}
|
||||||
QString target() {return m_target;}
|
QString target() {return m_target;}
|
||||||
int ram() { return m_ram; }
|
int ram() { return m_ram; }
|
||||||
|
int voicefmt() { return m_voicefmt; }
|
||||||
bool success() { return m_success; }
|
bool success() { return m_success; }
|
||||||
QString revision(void) { return m_revision; }
|
QString revision(void) { return m_revision; }
|
||||||
QString release(void) { return m_release; }
|
QString release(void) { return m_release; }
|
||||||
|
@ -45,6 +46,7 @@ private:
|
||||||
QString m_targetid;
|
QString m_targetid;
|
||||||
QString m_target;
|
QString m_target;
|
||||||
int m_ram;
|
int m_ram;
|
||||||
|
int m_voicefmt;
|
||||||
bool m_success;
|
bool m_success;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ bool VoiceFileCreator::createVoiceFile()
|
||||||
QString features = info.features();
|
QString features = info.features();
|
||||||
m_targetid = info.targetID().toInt();
|
m_targetid = info.targetID().toInt();
|
||||||
m_versionstring = info.version();
|
m_versionstring = info.version();
|
||||||
|
m_voiceformat = info.voicefmt();
|
||||||
QString version = m_versionstring.left(m_versionstring.indexOf("-")).remove("r");
|
QString version = m_versionstring.left(m_versionstring.indexOf("-")).remove("r");
|
||||||
|
|
||||||
//prepare download url
|
//prepare download url
|
||||||
|
@ -231,7 +232,8 @@ void VoiceFileCreator::create(void)
|
||||||
return;
|
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().
|
// ids2 and output are closed by voicefont().
|
||||||
|
|
||||||
//cleanup
|
//cleanup
|
||||||
|
|
|
@ -67,6 +67,7 @@ private:
|
||||||
QString m_lang; // the language which will be spoken
|
QString m_lang; // the language which will be spoken
|
||||||
QString m_versionstring; // version string to be used for logging
|
QString m_versionstring; // version string to be used for logging
|
||||||
int m_wavtrimThreshold;
|
int m_wavtrimThreshold;
|
||||||
|
int m_voiceformat;
|
||||||
|
|
||||||
bool m_abort;
|
bool m_abort;
|
||||||
QList<TalkGenerator::TalkEntry> m_talkList;
|
QList<TalkGenerator::TalkEntry> m_talkList;
|
||||||
|
|
|
@ -70,7 +70,7 @@ int BitswapAudio (unsigned char* pDest, unsigned char* pSrc, size_t len)
|
||||||
return 0;
|
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;
|
int i,j;
|
||||||
|
@ -159,7 +159,7 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output)
|
||||||
/* Create the file format: */
|
/* Create the file format: */
|
||||||
|
|
||||||
/* 1st 32 bit value in the file is the version number */
|
/* 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);
|
fwrite(&value, sizeof(value), 1, output);
|
||||||
|
|
||||||
/* 2nd 32 bit value in the file is the id number for the target
|
/* 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;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
voicefont(ids, atoi(argv[2]),argv[3],output);
|
voicefont(ids, atoi(argv[2]),argv[3],output, 400);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue