Пример #1
0
        void OpenTrack(CUE_File.Command.TRACK trackCommand)
        {
            //assert that a file is open
            if (curr_file == null)
            {
                Error("Track command encountered with no active file");
                throw new DiscJobAbortException();
            }

            curr_track = new CompiledCueTrack();

            //spill cdtext data into this track
            curr_cdtext = curr_track.CDTextData;

            curr_track.BlobIndex = curr_blobIndex;
            curr_track.Number    = trackCommand.Number;
            curr_track.TrackType = trackCommand.Type;

            //default flags
            if (curr_track.TrackType != CueTrackType.Audio)
            {
                curr_track.Flags = CueTrackFlags.DATA;
            }

            if (!curr_fileHasTrack)
            {
                curr_fileHasTrack = curr_track.IsFirstInFile = true;
            }

            UpdateDiscInfo(trackCommand);
        }
Пример #2
0
		void OpenTrack(CUE_File.Command.TRACK trackCommand)
		{
			curr_track = new CompiledCueTrack();

			//spill cdtext data into this track
			curr_cdtext = curr_track.CDTextData;
		
			curr_track.BlobIndex = curr_blobIndex;
			curr_track.Number = trackCommand.Number;
			curr_track.TrackType = trackCommand.Type;

			//default flags
			if (curr_track.TrackType != CueTrackType.Audio)
				curr_track.Flags = CueTrackFlags.DATA;

			if (!curr_fileHasTrack)
			{
				curr_fileHasTrack = curr_track.IsFirstInFile = true;
			}

			UpdateDiscInfo(trackCommand);
		}
Пример #3
0
        public void Run()
        {
            //in params
            var cue = IN_CueFile;

            //output state
            OUT_GlobalCDText      = new CompiledCDText();
            OUT_CompiledDiscInfo  = new CompiledDiscInfo();
            OUT_CompiledCueFiles  = new List <CompiledCueFile>();
            OUT_CompiledCueTracks = new List <CompiledCueTrack>();

            //add a track 0, for addressing convenience.
            //note: for future work, track 0 may need emulation (accessible by very negative LBA--the TOC is stored there)
            var track0 = new CompiledCueTrack()
            {
                Number = 0,
            };

            OUT_CompiledCueTracks.Add(track0);

            //global cd text will acquire the cdtext commands set before track commands
            curr_cdtext = OUT_GlobalCDText;

            for (int i = 0; i < cue.Commands.Count; i++)
            {
                var cmd = cue.Commands[i];

                //these commands get dealt with globally. nothing to be done here
                //(but in the future we need to accumulate them into the compile pass output)
                if (cmd is CUE_File.Command.CATALOG || cmd is CUE_File.Command.CDTEXTFILE)
                {
                    continue;
                }

                //nothing to be done for comments
                if (cmd is CUE_File.Command.REM)
                {
                    continue;
                }
                if (cmd is CUE_File.Command.COMMENT)
                {
                    continue;
                }

                //CD-text and related
                if (cmd is CUE_File.Command.PERFORMER)
                {
                    curr_cdtext.Performer = (cmd as CUE_File.Command.PERFORMER).Value;
                }
                if (cmd is CUE_File.Command.SONGWRITER)
                {
                    curr_cdtext.Songwriter = (cmd as CUE_File.Command.SONGWRITER).Value;
                }
                if (cmd is CUE_File.Command.TITLE)
                {
                    curr_cdtext.Title = (cmd as CUE_File.Command.TITLE).Value;
                }
                if (cmd is CUE_File.Command.ISRC)
                {
                    curr_cdtext.ISRC = (cmd as CUE_File.Command.ISRC).Value;
                }

                //flags can only be set when a track command is running
                if (cmd is CUE_File.Command.FLAGS)
                {
                    if (curr_track == null)
                    {
                        Warn("Ignoring invalid flag commands outside of a track command");
                    }
                    else
                    {
                        //take care to |= it here, so the data flag doesn't get cleared
                        curr_track.Flags |= (cmd as CUE_File.Command.FLAGS).Flags;
                    }
                }

                if (cmd is CUE_File.Command.TRACK)
                {
                    CloseTrack();
                    OpenTrack(cmd as CUE_File.Command.TRACK);
                }

                if (cmd is CUE_File.Command.FILE)
                {
                    CloseFile();
                    OpenFile(cmd as CUE_File.Command.FILE);
                }

                if (cmd is CUE_File.Command.INDEX)
                {
                    //todo - validate no postgap specified
                    AddIndex(cmd as CUE_File.Command.INDEX);
                }

                if (cmd is CUE_File.Command.PREGAP)
                {
                    //validate track open
                    //validate no indexes
                    curr_track.PregapLength = (cmd as CUE_File.Command.PREGAP).Length;
                }

                if (cmd is CUE_File.Command.POSTGAP)
                {
                    curr_track.PostgapLength = (cmd as CUE_File.Command.POSTGAP).Length;
                }
            }

            //it's a bit odd to close the file before closing the track, but...
            //we need to be sure to CloseFile first to make sure the track is marked as the final one in the file
            CloseFile();
            CloseTrack();

            CreateTrack1Pregap();
            FinalAnalysis();

            FinishLog();
        } //Run()
Пример #4
0
		public void Run()
		{
			//in params
			var cue = IN_CueFile;

			//output state
			OUT_GlobalCDText = new CompiledCDText();
			OUT_CompiledDiscInfo = new CompiledDiscInfo();
			OUT_CompiledCueFiles = new List<CompiledCueFile>();
			OUT_CompiledCueTracks = new List<CompiledCueTrack>();

			//add a track 0, for addressing convenience. 
			//note: for future work, track 0 may need emulation (accessible by very negative LBA--the TOC is stored there)
			var track0 = new CompiledCueTrack() {
				Number = 0,
			};
			OUT_CompiledCueTracks.Add(track0); 

			//global cd text will acquire the cdtext commands set before track commands
			curr_cdtext  = OUT_GlobalCDText;

			for (int i = 0; i < cue.Commands.Count; i++)
			{
				var cmd = cue.Commands[i];

				//these commands get dealt with globally. nothing to be done here
				//(but in the future we need to accumulate them into the compile pass output)
				if (cmd is CUE_File.Command.CATALOG || cmd is CUE_File.Command.CDTEXTFILE) continue;

				//nothing to be done for comments
				if (cmd is CUE_File.Command.REM) continue;
				if (cmd is CUE_File.Command.COMMENT) continue;

				//CD-text and related
				if (cmd is CUE_File.Command.PERFORMER) curr_cdtext.Performer = (cmd as CUE_File.Command.PERFORMER).Value;
				if (cmd is CUE_File.Command.SONGWRITER) curr_cdtext.Songwriter = (cmd as CUE_File.Command.SONGWRITER).Value;
				if (cmd is CUE_File.Command.TITLE) curr_cdtext.Title = (cmd as CUE_File.Command.TITLE).Value;
				if (cmd is CUE_File.Command.ISRC) curr_cdtext.ISRC = (cmd as CUE_File.Command.ISRC).Value;

				//flags can only be set when a track command is running
				if (cmd is CUE_File.Command.FLAGS)
				{
					if (curr_track == null)
						Warn("Ignoring invalid flag commands outside of a track command");
					else
						//take care to |= it here, so the data flag doesn't get cleared
						curr_track.Flags |= (cmd as CUE_File.Command.FLAGS).Flags;
				}

				if (cmd is CUE_File.Command.TRACK)
				{
					CloseTrack();
					OpenTrack(cmd as CUE_File.Command.TRACK);
				}

				if (cmd is CUE_File.Command.FILE)
				{
					CloseFile();
					OpenFile(cmd as CUE_File.Command.FILE);
				}

				if (cmd is CUE_File.Command.INDEX)
				{
					//todo - validate no postgap specified
					AddIndex(cmd as CUE_File.Command.INDEX);
				}

				if (cmd is CUE_File.Command.PREGAP)
				{
					//validate track open
					//validate no indexes
					curr_track.PregapLength = (cmd as CUE_File.Command.PREGAP).Length;
				}

				if (cmd is CUE_File.Command.POSTGAP)
				{
					curr_track.PostgapLength = (cmd as CUE_File.Command.POSTGAP).Length;
				}

			}

			//it's a bit odd to close the file before closing the track, but...
			//we need to be sure to CloseFile first to make sure the track is marked as the final one in the file
			CloseFile();
			CloseTrack();

			CreateTrack1Pregap();
			FinalAnalysis();

			FinishLog();
			
		} //Run()
Пример #5
0
		void OpenTrack(CUE_File.Command.TRACK trackCommand)
		{
			//assert that a file is open
			if(curr_file == null)
			{
				Error("Track command encountered with no active file");
				throw new DiscJobAbortException();
			}

			curr_track = new CompiledCueTrack();

			//spill cdtext data into this track
			curr_cdtext = curr_track.CDTextData;
		
			curr_track.BlobIndex = curr_blobIndex;
			curr_track.Number = trackCommand.Number;
			curr_track.TrackType = trackCommand.Type;

			//default flags
			if (curr_track.TrackType != CueTrackType.Audio)
				curr_track.Flags = CueTrackFlags.DATA;

			if (!curr_fileHasTrack)
			{
				curr_fileHasTrack = curr_track.IsFirstInFile = true;
			}

			UpdateDiscInfo(trackCommand);
		}
Пример #6
0
        public override void Run()
        {
            //in params
            var cue = IN_CueFile;

            //output state
            OUT_GlobalCDText      = new CompiledCDText();
            OUT_CompiledDiscInfo  = new CompiledDiscInfo();
            OUT_CompiledCueFiles  = new List <CompiledCueFile>();
            OUT_CompiledCueTracks = new List <CompiledCueTrack>();

            //add a track 0, for addressing convenience.
            //note: for future work, track 0 may need emulation (accessible by very negative LBA--the TOC is stored there)
            var track0 = new CompiledCueTrack()
            {
                Number = 0,
            };

            OUT_CompiledCueTracks.Add(track0);

            //global cd text will acquire the cdtext commands set before track commands
            curr_cdtext = OUT_GlobalCDText;

            foreach (var cmd in cue.Commands)
            {
                switch (cmd)
                {
                case CUE_File.Command.CATALOG:
                case CUE_File.Command.CDTEXTFILE:
                    // these commands get dealt with globally. nothing to be done here
                    // (but in the future we need to accumulate them into the compile pass output)
                    continue;

                case CUE_File.Command.REM:
                case CUE_File.Command.COMMENT:
                    // nothing to be done for comments
                    continue;

                case CUE_File.Command.PERFORMER performerCmd:
                    curr_cdtext.Performer = performerCmd.Value;
                    break;

                case CUE_File.Command.SONGWRITER songwriterCmd:
                    curr_cdtext.Songwriter = songwriterCmd.Value;
                    break;

                case CUE_File.Command.TITLE titleCmd:
                    curr_cdtext.Title = titleCmd.Value;
                    break;

                case CUE_File.Command.ISRC isrcCmd:
                    curr_cdtext.ISRC = isrcCmd.Value;
                    break;

                case CUE_File.Command.FLAGS flagsCmd:
                    // flags can only be set when a track command is running
                    if (curr_track == null)
                    {
                        Warn("Ignoring invalid flag commands outside of a track command");
                    }
                    else
                    {
                        curr_track.Flags |= flagsCmd.Flags;                      // take care to |= it here, so the data flag doesn't get cleared
                    }
                    break;

                case CUE_File.Command.TRACK trackCmd:
                    CloseTrack();
                    OpenTrack(trackCmd);
                    break;

                case CUE_File.Command.FILE fileCmd:
                    CloseFile();
                    OpenFile(fileCmd);
                    break;

                case CUE_File.Command.INDEX indexCmd:
                    //TODO validate no postgap specified
                    AddIndex(indexCmd);
                    break;

                case CUE_File.Command.PREGAP pregapCmd:
                    //TODO validate track open
                    //TODO validate no indexes
                    curr_track.PregapLength = pregapCmd.Length;
                    break;

                case CUE_File.Command.POSTGAP postgapCmd:
                    curr_track.PostgapLength = postgapCmd.Length;
                    break;
                }
            }

            //it's a bit odd to close the file before closing the track, but...
            //we need to be sure to CloseFile first to make sure the track is marked as the final one in the file
            CloseFile();
            CloseTrack();

            CreateTrack1Pregap();
            FinalAnalysis();

            FinishLog();
        } //Run()