summaryrefslogtreecommitdiff
path: root/tools/voicefont.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/voicefont.c')
-rw-r--r--tools/voicefont.c27
1 files changed, 16 insertions, 11 deletions
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