- // make corrections for multi-track .cue, fill track lengths
- total = 2 * 75;
- file_len = 0;
- for (i = 1; i <= numtracks; i++) {
- if (ti[i].handle != NULL) {
- sec2msf(total, ti[i].start);
- fseek(ti[i].handle, 0, SEEK_END);
- file_len = ftell(ti[i].handle) / 2352;
- sec2msf(file_len, ti[i].length);
- total += file_len;
- }
- else {
- // this track uses the same file as the last,
- // start of this track is last track's end
- if (i > 1) {
- t = msf2sec(ti[i].start) - msf2sec(ti[i - 1].start);
- sec2msf(t, ti[i - 1].length);
- }
- t = file_len - msf2sec(ti[i].start) + 2 * 75;
- sec2msf(t, ti[i].length);
- }
- }
-