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
This commit is contained in:
Solomon Peachy 2024-04-17 08:57:19 -04:00
parent c8dd31aab7
commit 39c9c350ae

View file

@ -59,10 +59,10 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi
static unsigned char buffer[65535]; /* clip buffer, allow only 64K */ static unsigned char buffer[65535]; /* clip buffer, allow only 64K */
int fields; int fields;
char line[255]; /* one line from the .lang file */ char line[255]; /* one line from the .lang file */
char mp3filename1[1024]; char encfilename1[1024];
char mp3filename2[1024]; char encfilename2[1024];
char* mp3filename; char* encfilename;
FILE* pMp3File; FILE* pEncFile;
memset(voiceonly, 0, sizeof(voiceonly)); memset(voiceonly, 0, sizeof(voiceonly));
while (!feof(voicefontids)) while (!feof(voicefontids))
@ -97,25 +97,25 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi
for (i=0; i<count; i++) for (i=0; i<count; i++)
{ {
pos[i] = ftell(output); pos[i] = ftell(output);
sprintf(mp3filename1, "%s%s.mp3", filedir, names[i]); sprintf(encfilename1, "%s%s.enc", filedir, names[i]);
sprintf(mp3filename2, "%s%s.wav.mp3", filedir, names[i]); sprintf(encfilename2, "%s%s.wav.enc", filedir, names[i]);
mp3filename = mp3filename1; encfilename = encfilename1;
pMp3File = fopen(mp3filename, "rb"); pEncFile = fopen(encfilename, "rb");
if (pMp3File == NULL) if (pEncFile == NULL)
{ /* alternatively, try the lame default filename */ { /* alternatively, try the lame default filename */
mp3filename = mp3filename2; encfilename = encfilename2;
pMp3File = fopen(mp3filename, "rb"); pEncFile = fopen(encfilename, "rb");
if (pMp3File == NULL) if (pEncFile == NULL)
{ {
printf("mp3 file %s not found!\n", mp3filename1); printf("enc file %s not found!\n", encfilename1);
size[i] = 0; size[i] = 0;
continue; continue;
} }
} }
printf("processing %s", mp3filename); printf("processing %s", encfilename);
size[i] = fread(buffer, 1, sizeof(buffer), pMp3File); size[i] = fread(buffer, 1, sizeof(buffer), pEncFile);
fclose(pMp3File); fclose(pEncFile);
fwrite(buffer, 1, size[i], output); fwrite(buffer, 1, size[i], output);
printf(": %d %s %d\n", i, names[i], size[i]); /* debug */ printf(": %d %s %d\n", i, names[i], size[i]); /* debug */
@ -186,11 +186,11 @@ int main (int argc, char** argv)
if (argc < 2) if (argc < 2)
{ {
printf("Makes a Rockbox voicefont from a collection of mp3 clips.\n"); printf("Makes a Rockbox voicefont from a collection of encoded clips.\n");
printf("Usage: voicefont <string id list file> <target id> <mp3 path> <output file>\n"); printf("Usage: voicefont <string id list file> <target id> <enc path> <output file>\n");
printf("\n"); printf("\n");
printf("Example: \n"); printf("Example: \n");
printf("voicefont voicefontids.txt 2 voice\\ voicefont.bin\n"); printf("voicefont voicefontids.txt 2 voice/ voicefont.bin\n");
return -1; return -1;
} }
@ -216,4 +216,3 @@ int main (int argc, char** argv)
return 0; return 0;
} }
#endif #endif