diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/voicefont.c | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/tools/voicefont.c b/tools/voicefont.c index 82ab537b73..2c092dc00c 100644 --- a/tools/voicefont.c +++ b/tools/voicefont.c | |||
@@ -18,14 +18,14 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | * A tool to generate the Rockbox "voicefont", a collection of all the UI | 20 | * A tool to generate the Rockbox "voicefont", a collection of all the UI |
21 | * strings. | 21 | * strings. |
22 | * | 22 | * |
23 | * Details at http://www.rockbox.org/wiki/VoiceBuilding | 23 | * Details at http://www.rockbox.org/wiki/VoiceBuilding |
24 | * | 24 | * |
25 | ****************************************************************************/ | 25 | ****************************************************************************/ |
26 | 26 | ||
27 | #include "voicefont.h" | 27 | #include "voicefont.h" |
28 | 28 | ||
29 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | #include <string.h> | 30 | #include <string.h> |
31 | 31 | ||
@@ -59,10 +59,10 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi | |||
59 | static unsigned char buffer[65535]; /* clip buffer, allow only 64K */ | 59 | static unsigned char buffer[65535]; /* clip buffer, allow only 64K */ |
60 | int fields; | 60 | int fields; |
61 | char line[255]; /* one line from the .lang file */ | 61 | char line[255]; /* one line from the .lang file */ |
62 | char mp3filename1[1024]; | 62 | char encfilename1[1024]; |
63 | char mp3filename2[1024]; | 63 | char encfilename2[1024]; |
64 | char* mp3filename; | 64 | char* encfilename; |
65 | FILE* pMp3File; | 65 | FILE* pEncFile; |
66 | 66 | ||
67 | memset(voiceonly, 0, sizeof(voiceonly)); | 67 | memset(voiceonly, 0, sizeof(voiceonly)); |
68 | while (!feof(voicefontids)) | 68 | while (!feof(voicefontids)) |
@@ -97,25 +97,25 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi | |||
97 | for (i=0; i<count; i++) | 97 | for (i=0; i<count; i++) |
98 | { | 98 | { |
99 | pos[i] = ftell(output); | 99 | pos[i] = ftell(output); |
100 | sprintf(mp3filename1, "%s%s.mp3", filedir, names[i]); | 100 | sprintf(encfilename1, "%s%s.enc", filedir, names[i]); |
101 | sprintf(mp3filename2, "%s%s.wav.mp3", filedir, names[i]); | 101 | sprintf(encfilename2, "%s%s.wav.enc", filedir, names[i]); |
102 | mp3filename = mp3filename1; | 102 | encfilename = encfilename1; |
103 | pMp3File = fopen(mp3filename, "rb"); | 103 | pEncFile = fopen(encfilename, "rb"); |
104 | if (pMp3File == NULL) | 104 | if (pEncFile == NULL) |
105 | { /* alternatively, try the lame default filename */ | 105 | { /* alternatively, try the lame default filename */ |
106 | mp3filename = mp3filename2; | 106 | encfilename = encfilename2; |
107 | pMp3File = fopen(mp3filename, "rb"); | 107 | pEncFile = fopen(encfilename, "rb"); |
108 | if (pMp3File == NULL) | 108 | if (pEncFile == NULL) |
109 | { | 109 | { |
110 | printf("mp3 file %s not found!\n", mp3filename1); | 110 | printf("enc file %s not found!\n", encfilename1); |
111 | size[i] = 0; | 111 | size[i] = 0; |
112 | continue; | 112 | continue; |
113 | } | 113 | } |
114 | } | 114 | } |
115 | printf("processing %s", mp3filename); | 115 | printf("processing %s", encfilename); |
116 | 116 | ||
117 | size[i] = fread(buffer, 1, sizeof(buffer), pMp3File); | 117 | size[i] = fread(buffer, 1, sizeof(buffer), pEncFile); |
118 | fclose(pMp3File); | 118 | fclose(pEncFile); |
119 | fwrite(buffer, 1, size[i], output); | 119 | fwrite(buffer, 1, size[i], output); |
120 | 120 | ||
121 | printf(": %d %s %d\n", i, names[i], size[i]); /* debug */ | 121 | printf(": %d %s %d\n", i, names[i], size[i]); /* debug */ |
@@ -177,7 +177,7 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi | |||
177 | 177 | ||
178 | return 0; | 178 | return 0; |
179 | 179 | ||
180 | 180 | ||
181 | } | 181 | } |
182 | #ifndef RBUTIL | 182 | #ifndef RBUTIL |
183 | int main (int argc, char** argv) | 183 | int main (int argc, char** argv) |
@@ -186,14 +186,14 @@ int main (int argc, char** argv) | |||
186 | 186 | ||
187 | if (argc < 2) | 187 | if (argc < 2) |
188 | { | 188 | { |
189 | printf("Makes a Rockbox voicefont from a collection of mp3 clips.\n"); | 189 | printf("Makes a Rockbox voicefont from a collection of encoded clips.\n"); |
190 | printf("Usage: voicefont <string id list file> <target id> <mp3 path> <output file>\n"); | 190 | printf("Usage: voicefont <string id list file> <target id> <enc path> <output file>\n"); |
191 | printf("\n"); | 191 | printf("\n"); |
192 | printf("Example: \n"); | 192 | printf("Example: \n"); |
193 | printf("voicefont voicefontids.txt 2 voice\\ voicefont.bin\n"); | 193 | printf("voicefont voicefontids.txt 2 voice/ voicefont.bin\n"); |
194 | return -1; | 194 | return -1; |
195 | } | 195 | } |
196 | 196 | ||
197 | ids = fopen(argv[1], "r"); | 197 | ids = fopen(argv[1], "r"); |
198 | if (ids == NULL) | 198 | if (ids == NULL) |
199 | { | 199 | { |
@@ -207,7 +207,7 @@ int main (int argc, char** argv) | |||
207 | printf("Error opening output file %s\n", argv[4]); | 207 | printf("Error opening output file %s\n", argv[4]); |
208 | return -2; | 208 | return -2; |
209 | } | 209 | } |
210 | 210 | ||
211 | if (voicefont(ids, atoi(argv[2]),argv[3],output, 400) < 0) | 211 | if (voicefont(ids, atoi(argv[2]),argv[3],output, 400) < 0) |
212 | { | 212 | { |
213 | printf("Error too many voicefont entries!\n"); | 213 | printf("Error too many voicefont entries!\n"); |
@@ -216,4 +216,3 @@ int main (int argc, char** argv) | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | #endif | 218 | #endif |
219 | |||