diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/buildzip.pl | 10 | ||||
-rwxr-xr-x | tools/configure | 19 | ||||
-rwxr-xr-x | tools/genlang | 18 | ||||
-rwxr-xr-x | tools/genvoice.sh | 16 | ||||
-rw-r--r-- | tools/voicefont.c | 27 |
5 files changed, 61 insertions, 29 deletions
diff --git a/tools/buildzip.pl b/tools/buildzip.pl index 8c78b82170..c3f6ccc3d4 100755 --- a/tools/buildzip.pl +++ b/tools/buildzip.pl | |||
@@ -37,6 +37,12 @@ while(1) { | |||
37 | shift @ARGV; | 37 | shift @ARGV; |
38 | shift @ARGV; | 38 | shift @ARGV; |
39 | } | 39 | } |
40 | elsif($ARGV[0] eq "-i") { | ||
41 | # The target id name as used in TARGET_ID in the root makefile | ||
42 | $target_id=$ARGV[1]; | ||
43 | shift @ARGV; | ||
44 | shift @ARGV; | ||
45 | } | ||
40 | elsif($ARGV[0] eq "-o") { | 46 | elsif($ARGV[0] eq "-o") { |
41 | $output=$ARGV[1]; | 47 | $output=$ARGV[1]; |
42 | shift @ARGV; | 48 | shift @ARGV; |
@@ -158,8 +164,8 @@ sub buildlangs { | |||
158 | for(@files) { | 164 | for(@files) { |
159 | my $output = $_; | 165 | my $output = $_; |
160 | $output =~ s/(.*)\.lang/$1.lng/; | 166 | $output =~ s/(.*)\.lang/$1.lng/; |
161 | print "$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_\n" if($verbose); | 167 | print "$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -i=$target_id -b=$outputlang/$output $dir/$_\n" if($verbose); |
162 | system ("$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_ >/dev/null 2>&1"); | 168 | system ("$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -i=$target_id -b=$outputlang/$output $dir/$_ >/dev/null 2>&1"); |
163 | } | 169 | } |
164 | } | 170 | } |
165 | 171 | ||
diff --git a/tools/configure b/tools/configure index 14cf697891..f162b66842 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -1717,10 +1717,13 @@ clean: | |||
1717 | \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\ | 1717 | \$(SILENT)rm -rf rockbox.zip TAGS @APPS@ firmware comsim sim lang.[ch]\ |
1718 | manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \ | 1718 | manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \ |
1719 | @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \ | 1719 | @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \ |
1720 | html txt rockbox-manual*.zip sysfont.h rockbox-info.txt | 1720 | html txt rockbox-manual*.zip sysfont.h rockbox-info.txt \ |
1721 | voicefontids | ||
1721 | 1722 | ||
1722 | voice: tools | 1723 | voice: tools |
1723 | \$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$(LANGUAGE) \$(ARCHOS) voicesettings.sh | 1724 | \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ features |
1725 | \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\ | ||
1726 | \$(TOOLSDIR)/genvoice.sh \$(ROOTDIR) \$(LANGUAGE) \$(ARCHOS)\$\$feat \$(TARGET_ID) voicesettings.sh | ||
1724 | 1727 | ||
1725 | tools: | 1728 | tools: |
1726 | \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@ | 1729 | \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) @TOOLSET@ |
@@ -1736,20 +1739,24 @@ fontzip: | |||
1736 | \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY) | 1739 | \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY) |
1737 | 1740 | ||
1738 | zip: | 1741 | zip: |
1739 | \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY) | 1742 | \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\ |
1743 | \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY) | ||
1740 | 1744 | ||
1741 | mapzip: | 1745 | mapzip: |
1742 | \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip | 1746 | \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip |
1743 | 1747 | ||
1744 | fullzip: | 1748 | fullzip: |
1745 | \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY) | 1749 | \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\ |
1750 | \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY) | ||
1746 | 1751 | ||
1747 | 7zip: | 1752 | 7zip: |
1748 | \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY) | 1753 | \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\ |
1754 | \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.7z" -z "7za a" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY) | ||
1749 | 1755 | ||
1750 | tar: | 1756 | tar: |
1751 | \$(SILENT)rm -f rockbox.tar | 1757 | \$(SILENT)rm -f rockbox.tar |
1752 | \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY) | 1758 | \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\ |
1759 | \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(ARCHOS)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.tar" -z "tar --no-recursion -uf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY) | ||
1753 | 1760 | ||
1754 | bzip2: tar | 1761 | bzip2: tar |
1755 | \$(SILENT)bzip2 -f9 rockbox.tar | 1762 | \$(SILENT)bzip2 -f9 rockbox.tar |
diff --git a/tools/genlang b/tools/genlang index 621ec37a58..aa7e090c35 100755 --- a/tools/genlang +++ b/tools/genlang | |||
@@ -11,7 +11,7 @@ | |||
11 | # | 11 | # |
12 | 12 | ||
13 | # binary version for the binary lang file | 13 | # binary version for the binary lang file |
14 | my $langversion = 3; # 3 was the latest one used in the v1 format | 14 | my $langversion = 4; # 3 was the latest one used in the v1 format |
15 | 15 | ||
16 | # A note for future users and readers: The original v1 language system allowed | 16 | # A note for future users and readers: The original v1 language system allowed |
17 | # the build to create and use a different language than english built-in. We | 17 | # the build to create and use a different language than english built-in. We |
@@ -28,8 +28,8 @@ Usage: genlang [options] <langv2 file> | |||
28 | Make the tool create a [prefix].c and [prefix].h file. | 28 | Make the tool create a [prefix].c and [prefix].h file. |
29 | 29 | ||
30 | -b=<outfile> | 30 | -b=<outfile> |
31 | Make the tool create a binary language (.lng) file namaed [outfile]. | 31 | Make the tool create a binary language (.lng) file named [outfile]. |
32 | The use of this option requires that you also use -e. | 32 | The use of this option requires that you also use -e, -t and -i. |
33 | 33 | ||
34 | -u | 34 | -u |
35 | Update language file. Given the translated file and the most recent english | 35 | Update language file. Given the translated file and the most recent english |
@@ -48,6 +48,9 @@ Usage: genlang [options] <langv2 file> | |||
48 | separated with colons. This will make genlang to use all the specified | 48 | separated with colons. This will make genlang to use all the specified |
49 | strings when searching for a matching phrase. | 49 | strings when searching for a matching phrase. |
50 | 50 | ||
51 | -i=<target id> | ||
52 | The target id number, needed for -b. | ||
53 | |||
51 | -o | 54 | -o |
52 | Voice mode output. Outputs all id: and voice: lines for the given target! | 55 | Voice mode output. Outputs all id: and voice: lines for the given target! |
53 | 56 | ||
@@ -88,11 +91,18 @@ if(!$check) { | |||
88 | print "Please use at least one of -p, -u, -o and -b\n"; | 91 | print "Please use at least one of -p, -u, -o and -b\n"; |
89 | exit; | 92 | exit; |
90 | } | 93 | } |
94 | |||
91 | if(($binary || $update || $voiceout) && !$english) { | 95 | if(($binary || $update || $voiceout) && !$english) { |
92 | print "Please use -e too when you use -b, -o or -u\n"; | 96 | print "Please use -e too when you use -b, -o or -u\n"; |
93 | exit; | 97 | exit; |
94 | } | 98 | } |
95 | 99 | ||
100 | my $target_id = $i; | ||
101 | if($binary && !$target_id) { | ||
102 | print "Please specify a target id number (with -i)!\n"; | ||
103 | exit; | ||
104 | } | ||
105 | |||
96 | my $target = $t; | 106 | my $target = $t; |
97 | if(!$target && !$update) { | 107 | if(!$target && !$update) { |
98 | print "Please specify a target (with -t)!\n"; | 108 | print "Please specify a target (with -t)!\n"; |
@@ -586,7 +596,7 @@ elsif($binary) { | |||
586 | 596 | ||
587 | open(OUTF, ">$binary") or die "Can't create $binary"; | 597 | open(OUTF, ">$binary") or die "Can't create $binary"; |
588 | binmode OUTF; | 598 | binmode OUTF; |
589 | printf OUTF ("\x1a%c", $langversion); # magic lang file header | 599 | printf OUTF ("\x1a%c%c", $langversion, $target_id); # magic lang file header |
590 | 600 | ||
591 | # loop over the target phrases | 601 | # loop over the target phrases |
592 | for $i (1 .. $idcount) { | 602 | for $i (1 .. $idcount) { |
diff --git a/tools/genvoice.sh b/tools/genvoice.sh index f32ab9476a..15028e3bd1 100755 --- a/tools/genvoice.sh +++ b/tools/genvoice.sh | |||
@@ -34,13 +34,17 @@ TTS_ENGINE=festival | |||
34 | ENCODER=lame | 34 | ENCODER=lame |
35 | # Where to save temporary files | 35 | # Where to save temporary files |
36 | TEMPDIR=/tmp | 36 | TEMPDIR=/tmp |
37 | # List of IDs to send to voicefont | ||
38 | VOICEFONTIDS=voicefontids | ||
37 | 39 | ||
38 | ################### | 40 | ################### |
39 | # End of settings # | 41 | # End of settings # |
40 | ################### | 42 | ################### |
41 | 43 | ||
44 | TARGET_ID="$4" | ||
42 | createvoicefile() { | 45 | createvoicefile() { |
43 | $VOICEFONT "$LANG_FILE" "$TEMPDIR/" "./$RLANG.voice" | 46 | $GENLANG -e=$ENGLISH -o -t=$TARGET $LANG_FILE > $VOICEFONTIDS |
47 | $VOICEFONT "$VOICEFONTIDS" "$TARGET_ID" "$TEMPDIR/" "./$RLANG.voice" | ||
44 | } | 48 | } |
45 | 49 | ||
46 | deletefiles() { | 50 | deletefiles() { |
@@ -106,7 +110,7 @@ generateclips() { | |||
106 | } | 110 | } |
107 | 111 | ||
108 | if [ -z "$3" ]; then | 112 | if [ -z "$3" ]; then |
109 | echo "Usage: $0 rockboxdirectory language target [settingsfile]"; | 113 | echo "Usage: $0 rockboxdirectory language target targetid [settingsfile]"; |
110 | exit 32 | 114 | exit 32 |
111 | else | 115 | else |
112 | if [ ! -d "$1" ] || [ ! -f "$1/tools/genlang" ]; then | 116 | if [ ! -d "$1" ] || [ ! -f "$1/tools/genlang" ]; then |
@@ -117,12 +121,12 @@ else | |||
117 | echo "Error: $2 is not a valid language" | 121 | echo "Error: $2 is not a valid language" |
118 | exit 34 | 122 | exit 34 |
119 | fi | 123 | fi |
120 | if [ ! -z "$4" ]; then | 124 | if [ ! -z "$5" ]; then |
121 | if [ -f "$4" ]; then | 125 | if [ -f "$5" ]; then |
122 | # Read settings from file | 126 | # Read settings from file |
123 | source "$4" | 127 | source "$5" |
124 | else | 128 | else |
125 | echo "Error: $4 does not exist" | 129 | echo "Error: $5 does not exist" |
126 | exit 36 | 130 | exit 36 |
127 | fi | 131 | fi |
128 | fi | 132 | fi |
diff --git a/tools/voicefont.c b/tools/voicefont.c index 0a6d0a2121..a5e72af567 100644 --- a/tools/voicefont.c +++ b/tools/voicefont.c | |||
@@ -90,10 +90,10 @@ int main (int argc, char** argv) | |||
90 | if (argc < 2) | 90 | if (argc < 2) |
91 | { | 91 | { |
92 | printf("Makes a Rockbox voicefont from a collection of mp3 clips.\n"); | 92 | printf("Makes a Rockbox voicefont from a collection of mp3 clips.\n"); |
93 | printf("Usage: voicefont <language file> <mp3 path> <output file>\n"); | 93 | printf("Usage: voicefont <string id list file> <target id> <mp3 path> <output file>\n"); |
94 | printf("\n"); | 94 | printf("\n"); |
95 | printf("Example: \n"); | 95 | printf("Example: \n"); |
96 | printf("voicefont english.lang voice\\ voicefont.bin\n"); | 96 | printf("voicefont voicefontids.txt 2 voice\\ voicefont.bin\n"); |
97 | return -1; | 97 | return -1; |
98 | } | 98 | } |
99 | 99 | ||
@@ -123,10 +123,10 @@ int main (int argc, char** argv) | |||
123 | } | 123 | } |
124 | fclose(pFile); | 124 | fclose(pFile); |
125 | 125 | ||
126 | pFile = fopen(argv[3], "wb"); | 126 | pFile = fopen(argv[4], "wb"); |
127 | if (pFile == NULL) | 127 | if (pFile == NULL) |
128 | { | 128 | { |
129 | printf("Error opening output file %s\n", argv[3]); | 129 | printf("Error opening output file %s\n", argv[4]); |
130 | return -2; | 130 | return -2; |
131 | } | 131 | } |
132 | fseek(pFile, 16 + count*8, SEEK_SET); /* space for header */ | 132 | fseek(pFile, 16 + count*8, SEEK_SET); /* space for header */ |
@@ -137,8 +137,8 @@ int main (int argc, char** argv) | |||
137 | count_voiceonly++; | 137 | count_voiceonly++; |
138 | 138 | ||
139 | pos[i] = ftell(pFile); | 139 | pos[i] = ftell(pFile); |
140 | sprintf(mp3filename1, "%s%s.mp3", argv[2], names[i]); | 140 | sprintf(mp3filename1, "%s%s.mp3", argv[3], names[i]); |
141 | sprintf(mp3filename2, "%s%s.wav.mp3", argv[2], names[i]); | 141 | sprintf(mp3filename2, "%s%s.wav.mp3", argv[3], names[i]); |
142 | mp3filename = mp3filename1; | 142 | mp3filename = mp3filename1; |
143 | pMp3File = fopen(mp3filename, "rb"); | 143 | pMp3File = fopen(mp3filename, "rb"); |
144 | if (pMp3File == NULL) | 144 | if (pMp3File == NULL) |
@@ -168,18 +168,23 @@ int main (int argc, char** argv) | |||
168 | /* Create the file format: */ | 168 | /* Create the file format: */ |
169 | 169 | ||
170 | /* 1st 32 bit value in the file is the version number */ | 170 | /* 1st 32 bit value in the file is the version number */ |
171 | value = SWAP4(200); /* 2.00 */ | 171 | value = SWAP4(300); /* 3.00 */ |
172 | fwrite(&value, sizeof(value), 1, pFile); | 172 | fwrite(&value, sizeof(value), 1, pFile); |
173 | 173 | ||
174 | /* 2nd 32 bit value in the file is the header size (= 1st table position) */ | 174 | /* 2nd 32 bit value in the file is the id number for the target |
175 | value = SWAP4(16); /* 16 bytes: for version, header size, number1, number2 */ | 175 | we made the voce file for */ |
176 | value = SWAP4(atoi(argv[2])); | ||
176 | fwrite(&value, sizeof(value), 1, pFile); | 177 | fwrite(&value, sizeof(value), 1, pFile); |
177 | 178 | ||
178 | /* 3rd 32 bit value in the file is the number of clips in 1st table */ | 179 | /* 3rd 32 bit value in the file is the header size (= 1st table position) */ |
180 | value = SWAP4(20); /* 20 bytes: for version, target id, header size, number1, number2 */ | ||
181 | fwrite(&value, sizeof(value), 1, pFile); | ||
182 | |||
183 | /* 4th 32 bit value in the file is the number of clips in 1st table */ | ||
179 | value = SWAP4(count-count_voiceonly); | 184 | value = SWAP4(count-count_voiceonly); |
180 | fwrite(&value, sizeof(value), 1, pFile); | 185 | fwrite(&value, sizeof(value), 1, pFile); |
181 | 186 | ||
182 | /* 4th bit value in the file is the number of clips in 2nd table */ | 187 | /* 5th bit value in the file is the number of clips in 2nd table */ |
183 | value = SWAP4(count_voiceonly); | 188 | value = SWAP4(count_voiceonly); |
184 | fwrite(&value, sizeof(value), 1, pFile); | 189 | fwrite(&value, sizeof(value), 1, pFile); |
185 | 190 | ||