Add cuesheet models from MPF

This commit is contained in:
Matt Nadareski
2023-09-13 11:34:58 -04:00
parent 43ff569ae3
commit 793a4e2fdd
7 changed files with 399 additions and 0 deletions

38
CueSheets/CueFile.cs Normal file
View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.IO;
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single FILE in a cuesheet
/// </summary>
public class CueFile
{
/// <summary>
/// filename
/// </summary>
#if NET48
public string FileName { get; set; }
#else
public string? FileName { get; set; }
#endif
/// <summary>
/// filetype
/// </summary>
public CueFileType FileType { get; set; }
/// <summary>
/// List of TRACK in FILE
/// </summary>
#if NET48
public CueTrack[] Tracks { get; set; }
#else
public CueTrack?[]? Tracks { get; set; }
#endif
}
}

33
CueSheets/CueIndex.cs Normal file
View File

@@ -0,0 +1,33 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single INDEX in a TRACK
/// </summary>
public class CueIndex
{
/// <summary>
/// INDEX number, between 0 and 99
/// </summary>
public int Index { get; set; }
/// <summary>
/// Starting time of INDEX in minutes
/// </summary>
public int Minutes { get; set; }
/// <summary>
/// Starting time of INDEX in seconds
/// </summary>
/// <remarks>There are 60 seconds in a minute</remarks>
public int Seconds { get; set; }
/// <summary>
/// Starting time of INDEX in frames.
/// </summary>
/// <remarks>There are 75 frames per second</remarks>
public int Frames { get; set; }
}
}

65
CueSheets/CueSheet.cs Normal file
View File

@@ -0,0 +1,65 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single cuesheet
/// </summary>
public class CueSheet
{
/// <summary>
/// CATALOG
/// </summary>
#if NET48
public string Catalog { get; set; }
#else
public string? Catalog { get; set; }
#endif
/// <summary>
/// CDTEXTFILE
/// </summary>
#if NET48
public string CdTextFile { get; set; }
#else
public string? CdTextFile { get; set; }
#endif
/// <summary>
/// PERFORMER
/// </summary>
#if NET48
public string Performer { get; set; }
#else
public string? Performer { get; set; }
#endif
/// <summary>
/// SONGWRITER
/// </summary>
#if NET48
public string Songwriter { get; set; }
#else
public string? Songwriter { get; set; }
#endif
/// <summary>
/// TITLE
/// </summary>
#if NET48
public string Title { get; set; }
#else
public string? Title { get; set; }
#endif
/// <summary>
/// List of FILE in cuesheet
/// </summary>
#if NET48
public CueFile[] Files { get; set; }
#else
public CueFile?[]? Files { get; set; }
#endif
}
}

91
CueSheets/CueTrack.cs Normal file
View File

@@ -0,0 +1,91 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single TRACK in a FILE
/// </summary>
public class CueTrack
{
/// <summary>
/// Track number. The range is 1 to 99.
/// </summary>
public int Number { get; set; }
/// <summary>
/// Track datatype
/// </summary>
public CueTrackDataType DataType { get; set; }
/// <summary>
/// FLAGS
/// </summary>
public CueTrackFlag Flags { get; set; }
/// <summary>
/// ISRC
/// </summary>
/// <remarks>12 characters in length</remarks>
#if NET48
public string ISRC { get; set; }
#else
public string? ISRC { get; set; }
#endif
/// <summary>
/// PERFORMER
/// </summary>
#if NET48
public string Performer { get; set; }
#else
public string? Performer { get; set; }
#endif
/// <summary>
/// SONGWRITER
/// </summary>
#if NET48
public string Songwriter { get; set; }
#else
public string? Songwriter { get; set; }
#endif
/// <summary>
/// TITLE
/// </summary>
#if NET48
public string Title { get; set; }
#else
public string? Title { get; set; }
#endif
/// <summary>
/// PREGAP
/// </summary>
#if NET48
public PreGap PreGap { get; set; }
#else
public PreGap? PreGap { get; set; }
#endif
/// <summary>
/// List of INDEX in TRACK
/// </summary>
/// <remarks>Must start with 0 or 1 and then sequential</remarks>
#if NET48
public CueIndex[] Indices { get; set; }
#else
public CueIndex?[]? Indices { get; set; }
#endif
/// <summary>
/// POSTGAP
/// </summary>
#if NET48
public PostGap PostGap { get; set; }
#else
public PostGap? PostGap { get; set; }
#endif
}
}

116
CueSheets/Enums.cs Normal file
View File

@@ -0,0 +1,116 @@
using System;
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// The audio or data files filetype
/// </summary>
public enum CueFileType
{
/// <summary>
/// Intel binary file (least significant byte first). Use for data files.
/// </summary>
BINARY,
/// <summary>
/// Motorola binary file (most significant byte first). Use for data files.
/// </summary>
MOTOROLA,
/// <summary>
/// Audio AIFF file (44.1KHz 16-bit stereo)
/// </summary>
AIFF,
/// <summary>
/// Audio WAVE file (44.1KHz 16-bit stereo)
/// </summary>
WAVE,
/// <summary>
/// Audio MP3 file (44.1KHz 16-bit stereo)
/// </summary>
MP3,
}
/// <summary>
/// Track datatype
/// </summary>
public enum CueTrackDataType
{
/// <summary>
/// AUDIO, Audio/Music (2352)
/// </summary>
AUDIO,
/// <summary>
/// CDG, Karaoke CD+G (2448)
/// </summary>
CDG,
/// <summary>
/// MODE1/2048, CD-ROM Mode1 Data (cooked)
/// </summary>
MODE1_2048,
/// <summary>
/// MODE1/2352 CD-ROM Mode1 Data (raw)
/// </summary>
MODE1_2352,
/// <summary>
/// MODE2/2336, CD-ROM XA Mode2 Data
/// </summary>
MODE2_2336,
/// <summary>
/// MODE2/2352, CD-ROM XA Mode2 Data
/// </summary>
MODE2_2352,
/// <summary>
/// CDI/2336, CD-I Mode2 Data
/// </summary>
CDI_2336,
/// <summary>
/// CDI/2352, CD-I Mode2 Data
/// </summary>
CDI_2352,
}
/// <summary>
/// Special subcode flags within a track
/// </summary>
[Flags]
public enum CueTrackFlag
{
/// <summary>
/// DCP, Digital copy permitted
/// </summary>
DCP = 1 << 0,
/// <summary>
/// 4CH, Four channel audio
/// </summary>
FourCH = 1 << 1,
/// <summary>
/// PRE, Pre-emphasis enabled (audio tracks only)
/// </summary>
PRE = 1 << 2,
/// <summary>
/// SCMS, Serial Copy Management System (not supported by all recorders)
/// </summary>
SCMS = 1 << 3,
/// <summary>
/// DATA, set for data files. This flag is set automatically based on the tracks filetype
/// </summary>
DATA = 1 << 4,
}
}

28
CueSheets/PostGap.cs Normal file
View File

@@ -0,0 +1,28 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents POSTGAP information of a track
/// </summary>
public class PostGap
{
/// <summary>
/// Length of POSTGAP in minutes
/// </summary>
public int Minutes { get; set; }
/// <summary>
/// Length of POSTGAP in seconds
/// </summary>
/// <remarks>There are 60 seconds in a minute</remarks>
public int Seconds { get; set; }
/// <summary>
/// Length of POSTGAP in frames.
/// </summary>
/// <remarks>There are 75 frames per second</remarks>
public int Frames { get; set; }
}
}

28
CueSheets/PreGap.cs Normal file
View File

@@ -0,0 +1,28 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents PREGAP information of a track
/// </summary>
public class PreGap
{
/// <summary>
/// Length of PREGAP in minutes
/// </summary>
public int Minutes { get; set; }
/// <summary>
/// Length of PREGAP in seconds
/// </summary>
/// <remarks>There are 60 seconds in a minute</remarks>
public int Seconds { get; set; }
/// <summary>
/// Length of PREGAP in frames.
/// </summary>
/// <remarks>There are 75 frames per second</remarks>
public int Frames { get; set; }
}
}