We only need to have bit-swapped voice files for the SH based archos targets

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14220 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nils Wallménius 2007-08-06 18:39:04 +00:00
parent d96bc50623
commit 97bafd66db
2 changed files with 12 additions and 21 deletions

View file

@ -220,25 +220,6 @@ static void load_voicefile(void)
structec_convert(&p_voicefile->index[i], "ll", 1, true);
#endif
/* Do a bitswap as necessary. */
#if CONFIG_CODEC == SWCODEC
logf("Bitswapping voice file.");
cpu_boost(true);
buf = (unsigned char *)(&p_voicefile->index) +
(p_voicefile->id1_max + p_voicefile->id2_max) * sizeof(struct clip_entry);
length = file_size - (buf - (unsigned char *) p_voicefile);
for (i = 0; i < length; i++)
{
temp = buf[i];
temp = ((temp >> 4) & 0x0f) | ((temp & 0x0f) << 4);
temp = ((temp >> 2) & 0x33) | ((temp & 0x33) << 2);
buf[i] = ((temp >> 1) & 0x55) | ((temp & 0x55) << 1);
}
cpu_boost(false);
#endif
#ifdef HAVE_MMC
/* load the index table, now that we know its size from the header */
load_size = (p_voicefile->id1_max + p_voicefile->id2_max)

View file

@ -85,6 +85,8 @@ int main (int argc, char** argv)
char mp3filename2[1024];
char* mp3filename;
FILE* pMp3File;
int target_id;
int do_bitswap_audio = 0;
if (argc < 2)
@ -103,7 +105,14 @@ int main (int argc, char** argv)
printf("Error opening language file %s\n", argv[1]);
return -2;
}
/* We bitswap the voice file only SH based archos players, target IDs
equal to or lower than 8. See the target_id line for each target in
configure */
target_id = atoi(argv[2]);
if (target_id <= 8)
do_bitswap_audio = 1;
memset(voiceonly, 0, sizeof(voiceonly));
while (!feof(pFile))
{
@ -156,7 +165,8 @@ int main (int argc, char** argv)
size[i] = fread(buffer, 1, sizeof(buffer), pMp3File);
fclose(pMp3File);
BitswapAudio(buffer, buffer, size[i]);
if (do_bitswap_audio)
BitswapAudio(buffer, buffer, size[i]);
fwrite(buffer, 1, size[i], pFile);
printf("%d %s %d\n", i, names[i], size[i]); /* debug */