forked from len0rd/rockbox
genlang: More voice-related fixes.
* Use consistent ID numbering * Use consistent logic for voicelist and voicebin files * Fix situations where English <-> English would fail in strange ways * Delete leftover tmpfile. * Off-by-one error in voice validation code * Off-by-one error in voicelist generation Change-Id: Ib3cea2c6612138b1cbe614dacbe51000199cc9ad
This commit is contained in:
parent
25f9601d7b
commit
688c89cfe1
3 changed files with 22 additions and 50 deletions
|
@ -51,7 +51,7 @@ $(BUILDDIR)/%.lng $(BUILDDIR)/%.vstrings: $(ROOTDIR)/%.lang $(BUILDDIR)/apps/gen
|
||||||
$(SILENT)mkdir -p $(dir $@)
|
$(SILENT)mkdir -p $(dir $@)
|
||||||
$(SILENT)$(TOOLSDIR)/genlang -u -e=$(APPSDIR)/lang/english.lang $< > $@.tmp
|
$(SILENT)$(TOOLSDIR)/genlang -u -e=$(APPSDIR)/lang/english.lang $< > $@.tmp
|
||||||
$(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/english.lang -t=$(MODELNAME):`cat $(BUILDDIR)/apps/genlang-features` -i=$(TARGET_ID) -b=$*.lng -c=$*.vstrings $@.tmp
|
$(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/english.lang -t=$(MODELNAME):`cat $(BUILDDIR)/apps/genlang-features` -i=$(TARGET_ID) -b=$*.lng -c=$*.vstrings $@.tmp
|
||||||
$(SILENT)rm -f $<.tmp
|
$(SILENT)rm -f $@.tmp
|
||||||
|
|
||||||
$(BUILDDIR)/apps/lang/voicestrings.zip: $(VOICEOBJ)
|
$(BUILDDIR)/apps/lang/voicestrings.zip: $(VOICEOBJ)
|
||||||
$(call PRINTS,ZIP $(subst $(BUILDDIR)/,,$@))
|
$(call PRINTS,ZIP $(subst $(BUILDDIR)/,,$@))
|
||||||
|
|
|
@ -624,7 +624,7 @@ static bool load_voicefile_index(int fd)
|
||||||
if (voicefile.version == VOICE_VERSION &&
|
if (voicefile.version == VOICE_VERSION &&
|
||||||
voicefile.target_id == TARGET_ID &&
|
voicefile.target_id == TARGET_ID &&
|
||||||
voicefile.id1_max == TALK_FINAL_ID &&
|
voicefile.id1_max == TALK_FINAL_ID &&
|
||||||
voicefile.id2_max == TALK_FINAL_ID_VOICEONLY - VOICEONLY_DELIMITER)
|
voicefile.id2_max == TALK_FINAL_ID_VOICEONLY - VOICEONLY_DELIMITER - 1)
|
||||||
{
|
{
|
||||||
if (load_index_table(fd, &voicefile))
|
if (load_index_table(fd, &voicefile))
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -794,7 +794,7 @@ elsif($binary || $binvoice) {
|
||||||
# loop over the target phrases
|
# loop over the target phrases
|
||||||
# This loops over the strings in the translated language file order
|
# This loops over the strings in the translated language file order
|
||||||
my @ids = ((0 .. ($idcount[$_]-1)));
|
my @ids = ((0 .. ($idcount[$_]-1)));
|
||||||
push @ids, (0x8000 .. ($voiceid[$_]-1));
|
push @ids, (0x8001 .. ($voiceid[$_]-1));
|
||||||
for $n (@ids) {
|
for $n (@ids) {
|
||||||
my $name=$idnum[$_][$n]; # get the ID
|
my $name=$idnum[$_][$n]; # get the ID
|
||||||
my $dest = $dest{$name}; # get the destination phrase
|
my $dest = $dest{$name}; # get the destination phrase
|
||||||
|
@ -829,56 +829,28 @@ elsif($voiceout) {
|
||||||
|
|
||||||
my @engl;
|
my @engl;
|
||||||
|
|
||||||
|
for (keys %users) {
|
||||||
|
# loop over the target phrases
|
||||||
# This loops over the strings in the translated language file order
|
# This loops over the strings in the translated language file order
|
||||||
my @ids = ((0 .. ($idcount[$users{"core"}]-1)));
|
my @ids = ((0 .. ($idcount[$_]-1)));
|
||||||
push @ids, (0x8000 .. ($voiceid[$users{"core"}]-1));
|
push @ids, (0x8001 .. ($voiceid[$_]-1));
|
||||||
|
for $n (@ids) {
|
||||||
#for my $id (@ids) {
|
my $name=$idnum[$_][$n]; # get the ID
|
||||||
# print "$id\n";
|
my $dest = $dest{$name}; # get the destination phrase
|
||||||
#}
|
my $voice = $voice{$name}; # get the destination voice string
|
||||||
|
|
||||||
for $i (@ids) {
|
|
||||||
my $name=$idnum[$users{"core"}][$i]; # get the ID
|
|
||||||
my $dest = $voice{$name}; # get the destination voice string
|
|
||||||
|
|
||||||
if($dest) {
|
|
||||||
$dest =~ s/^\"(.*)\"\s*$/$1/g; # cut off quotes
|
|
||||||
|
|
||||||
|
if($voice) {
|
||||||
|
$voice =~ s/^\"(.*)\"\s*$/$1/g; # cut off quotes
|
||||||
# Now, make sure we get the number from the english sort order:
|
# Now, make sure we get the number from the english sort order:
|
||||||
$idnum = $idmap[$users{"core"}]{$name};
|
$idnum = $idmap[$_]{$name};
|
||||||
|
$engl[$idnum] = "#$idnum ($n)\nid: $name\nvoice: \"$voice\"\n";
|
||||||
if(length($idnum)) {
|
|
||||||
$engl[$idnum] = $i;
|
|
||||||
|
|
||||||
#print "Input index $i output index $idnum\n";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
# not used, mark it so
|
|
||||||
$engl[$i] = -1
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for my $i (@ids) {
|
|
||||||
|
|
||||||
my $o = $engl[$i];
|
|
||||||
|
|
||||||
if(($o < 0) || !length($o)) {
|
|
||||||
if($i < 0x8000) {
|
|
||||||
print "#$i\nid: NOT_USED_$i\nvoice: \"\"\n";
|
|
||||||
}
|
}
|
||||||
else {
|
# Print the list in the the English sort order
|
||||||
print "#$i\nid: VOICE_NOT_USED_$i\nvoice: \"\"\n";
|
for (@engl) {
|
||||||
|
print $_;
|
||||||
}
|
}
|
||||||
next;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $name=$idnum[$users{"core"}][$o]; # get the ID
|
|
||||||
my $dest = $voice{$name}; # get the destination voice string
|
|
||||||
|
|
||||||
print "#$i ($o)\nid: $name\nvoice: $dest\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue