2 * Copyright 2007, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
16 result
= result
+ (n
% 10);
24 // #pragma mark - exported functions
28 Computes the CD Disc ID as specified in the FreeDB how-to (code taken from there).
31 compute_cddb_disc_id(scsi_toc_toc
&toc
)
33 int32 numTracks
= toc
.last_track
+ 1 - toc
.first_track
;
36 for (int32 i
= 0; i
< numTracks
; i
++) {
37 n
= n
+ cddb_sum((toc
.tracks
[i
].start
.time
.minute
* 60)
38 + toc
.tracks
[i
].start
.time
.second
);
41 int32 t
= ((toc
.tracks
[numTracks
].start
.time
.minute
* 60)
42 + toc
.tracks
[numTracks
].start
.time
.second
)
43 - ((toc
.tracks
[0].start
.time
.minute
* 60)
44 + toc
.tracks
[0].start
.time
.second
);
46 return (n
% 0xff) << 24 | t
<< 8 | numTracks
;