A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

voice: Fix voicefile generation

I updated the scripts to use a generic '.enc' as the filename as we
haven't used true '.mp3' files for some time (and even then, only on the
Archos devices) but I missed the voicefont generation tool.

Change-Id: I450de9215664b6559058b175afc25aa874d11dcc

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