/* Version: 0.1 Usage: rgsc.exe iTunesDB Gives a list of all the tracks in an iTunesDB file together with their Sound Check value. Thanks to Otto42, Mike Giacomelli, Aero and anyone I forgot at Hydrogenaudio for clearing out the converion formula. Comments: johan.debock@gmail.com Copyright (c) 2006 Johan De Bock */ #include #include #include #include #include int main(int argc, char* argv[]){ if ( argc!=2) { printf("Wrong command line\n\n"); exit(1); } FILE* in; if ( ( in=fopen(argv[1],"rb") )==NULL ) { printf("ERROR: Could not open input file!\n"); exit(1); } unsigned char buf[4]; fseek(in,0,SEEK_END); long filesize=ftell(in); rewind(in); int count=0; while( fread(&buf[3],1,1,in) ) { if (buf[0]=='m' && buf[1]=='h' && buf[2]=='i' && buf[3]=='t') { count++; fseek(in,72,SEEK_CUR); unsigned int soundcheck; fread(&soundcheck,4,1,in); printf("%4X %6.2f",soundcheck,log10(soundcheck/1000.0)*-10); while( fread(&buf[3],1,1,in) ) { if (buf[0]=='m' && buf[1]=='h' && buf[2]=='o' && buf[3]=='d') { fseek(in,4,SEEK_CUR); unsigned int offset; fread(&offset,4,1,in); fseek(in,28,SEEK_CUR); unsigned char string[1024]; int i; for (i=0;i