|
lz的意思是不是WAV文件中的数据保存的H文件里?
你可以自己写个简单的程序实现。
给个linux下的简单流程,好久写的,参考一下吧
int main(int argc, char **argv)
{
int ch = 0;
int count = 0;
int maxcnt = 0;
FILE *sf, *df;
if (argc < 3)
{
printf("Too less param!\n\nUsage: gendata [sf] [df]\n");
exit(0);
}
sf = fopen(argv[1], "r");
if (sf == NULL)
{
printf("Open source file [%s] fail!\n", argv[1]);
exit(0);
}
df = fopen(argv[2], "w");
if (df == NULL)
{
printf("Open dist file [%s] fail!\n", argv[2]);
exit(0);
}
if( 4 == argc )
maxcnt = str2int(argv[3]);
maxcnt *= 1024*10;
fprintf(df, "/* %s: Data generated from '%s'*/\n\n", argv[2], argv[1]);
fprintf(df, "#include \n");
fprintf(df, "#if defined(CONFIG_xxxxx)\n");
fprintf(df, "#ifndef CONFIG_ROMFS_FROM_ROM\n");
if( maxcnt > 0 )
fprintf(df, "#define xxxxx_ROMFS_RW\n");
else
fprintf(df, "#undef xxxxx_ROMFS_RW\n");
fprintf(df, " unsigned char romfs_data[] =\n");
fprintf(df, " {\n");
while ((ch = fgetc(sf)) != EOF)
{
fprintf(df, " 0x%02X,", ch);
count++;
if ((count%8) == 0) fprintf(df, "\n");
}
if( maxcnt > 0 )
{
while(maxcnt)
{
fprintf(df, " 0x00,");
count++;
maxcnt--;
if ((count%8) == 0) fprintf(df, "\n");
}
}
printf("data len %ld transfered\n", count);
fprintf(df, " };");
fprintf(df, "\n");
fprintf(df, "#endif /* #ifndef CONFIG_ROMFS_FROM_ROM */\n");
fprintf(df, "#endif /* #if defined(CONFIG_xxxxx) */\n");
fprintf(df, "/* end this file */\n");
fprintf(df, "\n");
fclose(sf);
fclose(df);
exit(0);
}
|
|