示例#1
0
        /// <summary>
        /// Create a new cuesheet from scratch
        /// </summary>
        static void NewCueSheet()
        {
            CueSheet cue = new CueSheet();

            //Album performer
            cue.Performer = "Rotterdam Philharmonic Orchestra";
            //Album title
            cue.Title = "Edo de Waart / Rachmaninoff: The 3 Symphonies, The Rock - Disc 1";

            //Create 1st track, with a filename that future tracks will inherit
            cue.AddTrack("Symphony No. 2 in E minor, Op. 27: I. Largo - Allegro moderato", "", "CDImage.ape", FileType.WAVE);
            cue.AddIndex(0, 0, 0, 0, 0);
            cue.AddIndex(0, 1, 0, 0, 33);

            //Create 2nd track, with optional 'Performance' field used
            cue.AddTrack("II. Allegro molto", "Fake G. Uy: Timpani");
            cue.AddIndex(1, 0, 18, 39, 33);
            cue.AddIndex(1, 2, 22, 14, 10); //add another index we'll delete later
            cue.AddIndex(1, 1, 18, 44, 25);

            //Create 3rd track
            cue.AddTrack("III. Adagio", "");
            cue.AddIndex(2, 0, 27, 56, 33);
            cue.AddIndex(2, 1, 27, 59, 40);

            //Create 4th track using a method that gives us more control over the data
            Track tempTrack = new Track(4, DataType.AUDIO);
            tempTrack.Title = "IV. Allegro vivace";
            tempTrack.ISRC = "0000078652395";
            tempTrack.AddFlag(Flags.CH4);
            tempTrack.AddIndex(0, 41, 57, 33);
            tempTrack.AddIndex(1, 42, 00, 60);
            cue.AddTrack(tempTrack);

            //Create 5th track we'll delete later
            cue.AddTrack("Symphony No. Infinity", "Rachmaninoff's Dog");

            //Remove the bad index from the 2nd track
            cue.RemoveIndex(1, 1);//(trackIndex, indexIndex)
            //Notice the index (array-wise) of the Index (cuesheet min/sec/frame) is '1'
            //but the Index Number is 2. This is to show that index and the Index Number are
            //not the same thing and may or may not be equal.

            //Remove the 5th track
            cue.RemoveTrack(4);

            Console.WriteLine(cue.ToString());
            cue.SaveCue("newCDImage.cue");
        }
示例#2
0
        private void openCue_Click(object sender, EventArgs e)
        {
            StartTimer();

            OpenFileDialog dialog = new OpenFileDialog();

            dialog.InitialDirectory = folderTree.ActiveNode.FullPath.Replace(folderTree.ActiveNode.RootNode.FullPath + "\\", "");

            dialog.Filter = "CUE'sheet lists (*.cue)|*.cue|Text sheet Files (*.txt)|*.txt";
            dialog.Title  = "Select CUE'sheet to open";

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    CueSheet sheet  = new CueSheet(dialog.FileName);
                    string   artist = sheet.Performer;
                    string   album  = sheet.Title;

                    CueSharp.Track[] tracks = sheet.Tracks;

                    //TagLib.File tagFile = TagLib.File.Create(dialog.FileName);
                    //TimeSpan totalTime = new TimeSpan(tagFile.Length);

                    TimeSpan totalTime      = new TimeSpan();
                    TimeSpan totalTrackTime = new TimeSpan();
                    int      totalTracks    = tracks.Length;

                    bool readFile = false;

                    try
                    {
                        TagLib.File tagFile = TagLib.File.Create(Path.GetDirectoryName(dialog.FileName) + "\\" + tracks[0].DataFile.Filename);
                        totalTime = tagFile.Properties.Duration;
                        readFile  = true;
                    }
                    catch
                    {
                    }

                    foreach (object item in tracks)
                    {
                        try
                        {
                            CueSharp.Track track = (CueSharp.Track)item;

                            ArrayList subItemValues = new ArrayList();

                            subItemValues.Add(track.Title);
                            subItemValues.Add(track.Performer);
                            subItemValues.Add(album);

                            TimeSpan trackTime = new TimeSpan();

                            if (track.TrackNumber != totalTracks)
                            {
                                trackTime = new TimeSpan(0, tracks[track.TrackNumber].Indices[0].Minutes - track.Indices[0].Minutes, tracks[track.TrackNumber].Indices[0].Seconds - track.Indices[0].Seconds);
                            }
                            else if (readFile)
                            {
                                trackTime = new TimeSpan(0, totalTime.Minutes - totalTrackTime.Minutes, totalTime.Seconds - totalTrackTime.Seconds);
                            }
                            else
                            {
                                trackTime = new TimeSpan(0, totalTrackTime.Minutes / totalTracks, totalTrackTime.Seconds / totalTracks);
                            }

                            totalTrackTime = totalTrackTime.Add(trackTime);

                            subItemValues.Add(trackTime.ToString());
                            subItemValues.Add(1);

                            UltraListViewItem listTrack = new UltraListViewItem("CUE'sheet item", subItemValues.ToArray());
                            trackList.Items.Add(listTrack);
                        }
                        catch (Exception exp)
                        {
                            //errors.Add(((UltraListViewItem)file).Value.ToString() + " : " + exp.Message.ToString());
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("Ook!");
                }
            }

            UpdateStats();

            StopTimer();
        }
示例#3
0
 private Index lastTrackIndex(Track track)
 {
     return track.Indices[track.Indices.Length - 1];
 }
示例#4
0
 /// <summary>
 /// Add a track to the current cuesheet
 /// </summary>
 /// <param name="track">Track object to add to the cuesheet.</param>
 public void AddTrack(Track track)
 {
     m_Tracks = (Track[])ResizeArray(m_Tracks, m_Tracks.Length + 1);
     m_Tracks[m_Tracks.Length - 1] = track;
 }