/// <summary> /// Generates the Points list from the current TOC /// </summary> public void GeneratePoints() { int num = 0; Points.Clear(); foreach (var ses in Sessions) { foreach (var track in ses.Tracks) { foreach (var index in track.Indexes) { var tp = new TOCPoint { Num = num++, ABA = index.aba, TrackNum = track.num, IndexNum = index.num, Track = track }; Points.Add(tp); } } var tpLeadout = new TOCPoint(); var lastTrack = ses.Tracks[ses.Tracks.Count - 1]; tpLeadout.Num = num++; tpLeadout.ABA = lastTrack.Indexes[1].aba + lastTrack.length_aba; tpLeadout.IndexNum = 0; tpLeadout.TrackNum = 100; tpLeadout.Track = null; //no leadout track.. now... or ever? Points.Add(tpLeadout); } }
/// <summary> /// seeks the point immediately before (or equal to) this LBA /// </summary> public TOCPoint SeekPoint(int lba) { int aba = lba + 150; for (int i = 0; i < Points.Count; i++) { TOCPoint tp = Points[i]; if (tp.ABA > aba) { return(Points[i - 1]); } } return(Points[Points.Count - 1]); }
/// <summary> /// Generates the Points list from the current logical TOC /// </summary> public void Synthesize_TOCPointsFromSessions() { Points = new List <TOCPoint>(); int num = 0; foreach (var ses in Sessions) { for (int t = 0; t < ses.Tracks.Count; t++) { int tnum = t + 1; var track = ses.Tracks[t]; for (int i = 0; i < track.Indexes.Count; i++) { var index = track.Indexes[i]; bool repeat = false; int aba = index.aba; REPEAT: var tp = new TOCPoint { Num = num++, ABA = aba, TrackNum = track.Number, IndexNum = index.Number, Track = track, ADR = track.ADR, Control = track.Control }; //special case! //yellow-book says: //pre-gap for "first part of a digital data track not containing user data and encoded as a pause" //first interval: at least 75 sectors coded as preceding track //second interval: at least 150 sectors coded as user data track. //TODO - add pause flag tracking to TOCPoint //see mednafen's "TODO: Look into how we're supposed to handle subq control field in the four combinations of track types(data/audio)." if (tnum != 1 && i == 0 && track.TrackType != ETrackType.Audio && !repeat) { //NOTE: we dont implement this exactly the same as mednafen, I think my logic is closer to the docs, but who knows, its complicated int distance = track.Indexes[i + 1].aba - track.Indexes[i].aba; //well, how do we know to apply this logic? //we assume the 150 sector pregap is more important. so if thats all there is, theres no 75 sector pregap like the old track //if theres a longer pregap, then we generate weird old track pregap to contain the rest. if (distance > 150) { int weirdPregapSize = distance - 150; //need a new point. fix the old one tp.ADR = Points[Points.Count - 1].ADR; tp.Control = Points[Points.Count - 1].Control; Points.Add(tp); aba += weirdPregapSize; repeat = true; goto REPEAT; } } Points.Add(tp); } } var tpLeadout = new TOCPoint(); var lastTrack = ses.Tracks[ses.Tracks.Count - 1]; tpLeadout.Num = num++; tpLeadout.ABA = lastTrack.Indexes[1].aba + lastTrack.LengthInSectors; tpLeadout.IndexNum = 0; tpLeadout.TrackNum = 100; tpLeadout.Track = null; //no leadout track.. now... or ever? Points.Add(tpLeadout); } }
/// <summary> /// Generates the Points list from the current logical TOC /// </summary> public void SynthesizeTOCPointsFromSessions() { int num = 0; Points.Clear(); foreach (var ses in Sessions) { foreach (var track in ses.Tracks) foreach (var index in track.Indexes) { var tp = new TOCPoint { Num = num++, ABA = index.aba, TrackNum = track.num, IndexNum = index.num, Track = track }; Points.Add(tp); } var tpLeadout = new TOCPoint(); var lastTrack = ses.Tracks[ses.Tracks.Count - 1]; tpLeadout.Num = num++; tpLeadout.ABA = lastTrack.Indexes[1].aba + lastTrack.length_aba; tpLeadout.IndexNum = 0; tpLeadout.TrackNum = 100; tpLeadout.Track = null; //no leadout track.. now... or ever? Points.Add(tpLeadout); } }
/// <summary> /// Generates the Points list from the current logical TOC /// </summary> public void Synthesize_TOCPointsFromSessions() { Points = new List<TOCPoint>(); int num = 0; foreach (var ses in Sessions) { for(int t=0;t<ses.Tracks.Count;t++) { int tnum = t + 1; var track = ses.Tracks[t]; for(int i=0;i<track.Indexes.Count;i++) { var index = track.Indexes[i]; bool repeat = false; int aba = index.aba; REPEAT: var tp = new TOCPoint { Num = num++, ABA = aba, TrackNum = track.Number, IndexNum = index.Number, Track = track, ADR = track.ADR, Control = track.Control }; //special case! //yellow-book says: //pre-gap for "first part of a digital data track not containing user data and encoded as a pause" //first interval: at least 75 sectors coded as preceding track //second interval: at least 150 sectors coded as user data track. //TODO - add pause flag tracking to TOCPoint //see mednafen's "TODO: Look into how we're supposed to handle subq control field in the four combinations of track types(data/audio)." if (tnum != 1 && i == 0 && track.TrackType != ETrackType.Audio && !repeat) { //NOTE: we dont implement this exactly the same as mednafen, I think my logic is closer to the docs, but who knows, its complicated int distance = track.Indexes[i + 1].aba - track.Indexes[i].aba; //well, how do we know to apply this logic? //we assume the 150 sector pregap is more important. so if thats all there is, theres no 75 sector pregap like the old track //if theres a longer pregap, then we generate weird old track pregap to contain the rest. if (distance > 150) { int weirdPregapSize = distance - 150; //need a new point. fix the old one tp.ADR = Points[Points.Count - 1].ADR; tp.Control = Points[Points.Count - 1].Control; Points.Add(tp); aba += weirdPregapSize; repeat = true; goto REPEAT; } } Points.Add(tp); } } var tpLeadout = new TOCPoint(); var lastTrack = ses.Tracks[ses.Tracks.Count - 1]; tpLeadout.Num = num++; tpLeadout.ABA = lastTrack.Indexes[1].aba + lastTrack.LengthInSectors; tpLeadout.IndexNum = 0; tpLeadout.TrackNum = 100; tpLeadout.Track = null; //no leadout track.. now... or ever? Points.Add(tpLeadout); } }