Esempio n. 1
0
 public static string TrackTypeStringForTrackType(ETrackType type)
 {
     switch (type)
     {
         case ETrackType.Mode1_2352: return "MODE1/2352";
         case ETrackType.Mode2_2352: return "MODE2/2352";
         case ETrackType.Audio: return "AUDIO";
         case ETrackType.Mode1_2048: return "MODE1/2048";
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Esempio n. 2
0
 public static string RedumpTypeStringForTrackType(ETrackType type)
 {
     switch (type)
     {
         case ETrackType.Mode1_2352: return "Data/Mode 1";
         case ETrackType.Mode1_2048: throw new InvalidOperationException("guh dunno what to put here");
         case ETrackType.Mode2_2352: return "Data/Mode 2";
         case ETrackType.Audio: return "Audio";
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Esempio n. 3
0
 public static int BINSectorSizeForTrackType(ETrackType type)
 {
     switch (type)
     {
         case ETrackType.Mode1_2352:
         case ETrackType.Mode2_2352:
         case ETrackType.Audio:
             return 2352;
         case ETrackType.Mode1_2048:
             return 2048;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Esempio n. 4
0
        public static string RedumpTypeStringForTrackType(ETrackType type)
        {
            switch (type)
            {
            case ETrackType.Mode1_2352: return("Data/Mode 1");

            case ETrackType.Mode1_2048: throw new InvalidOperationException("guh dunno what to put here");

            case ETrackType.Mode2_2352: return("Data/Mode 2");

            case ETrackType.Audio: return("Audio");

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 5
0
        public static string TrackTypeStringForTrackType(ETrackType type)
        {
            switch (type)
            {
            case ETrackType.Mode1_2352: return("MODE1/2352");

            case ETrackType.Mode2_2352: return("MODE2/2352");

            case ETrackType.Audio: return("AUDIO");

            case ETrackType.Mode1_2048: return("MODE1/2048");

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 6
0
        public static int BINSectorSizeForTrackType(ETrackType type)
        {
            switch (type)
            {
            case ETrackType.Mode1_2352:
            case ETrackType.Mode2_2352:
            case ETrackType.Audio:
                return(2352);

            case ETrackType.Mode1_2048:
                return(2048);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Generates the CUE file for the provided DiscStructure
        /// </summary>
        public string GenerateCUE_OneBin(DiscStructure structure, CueBinPrefs prefs)
        {
            if (prefs.OneBlobPerTrack)
            {
                throw new InvalidOperationException("OneBinPerTrack passed to GenerateCUE_OneBin");
            }

            //this generates a single-file cue!!!!!!! dont expect it to generate bin-per-track!
            StringBuilder sb = new StringBuilder();

            foreach (var session in structure.Sessions)
            {
                if (!prefs.SingleSession)
                {
                    //dont want to screw around with sessions for now
                    sb.AppendFormat("SESSION {0:D2}\n", session.num);
                    if (prefs.AnnotateCue)
                    {
                        sb.AppendFormat("REM ; session (length={0})\n", session.length_aba);
                    }
                }

                foreach (var track in session.Tracks)
                {
                    ETrackType trackType = track.TrackType;

                    //mutate track type according to our principle of canonicalization
                    if (trackType == ETrackType.Mode1_2048 && prefs.DumpECM)
                    {
                        trackType = ETrackType.Mode1_2352;
                    }

                    sb.AppendFormat("  TRACK {0:D2} {1}\n", track.Number, Cue.TrackTypeStringForTrackType(trackType));
                    if (prefs.AnnotateCue)
                    {
                        sb.AppendFormat("  REM ; track (length={0})\n", track.LengthInSectors);
                    }

                    foreach (var index in track.Indexes)
                    {
                        //cue+bin has an implicit 150 sector pregap which neither the cue nor the bin has any awareness of
                        //except for the baked-in sector addressing.
                        //but, if there is an extra-long pregap, we want to reflect it this way
                        int lba = index.aba - 150;
                        if (lba <= 0 && index.Number == 0 && track.Number == 1)
                        {
                        }
                        //dont emit index 0 when it is the same as index 1, it is illegal for some reason
                        else if (index.Number == 0 && index.aba == track.Indexes[1].aba)
                        {
                            //dont emit index 0 when it is the same as index 1, it confuses some cue parsers
                        }
                        else
                        {
                            sb.AppendFormat("    INDEX {0:D2} {1}\n", index.Number, new Timestamp(lba).Value);
                        }
                    }
                }
            }

            return(sb.ToString());
        }