From 9481fada231fb7625b7225ed6c503eb63fb19244 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 16 Sep 2020 17:13:15 -0700 Subject: [PATCH] Fix writing of valid indexes for Aaru cuesheet --- DICUI.Library/Aaru/Parameters.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/DICUI.Library/Aaru/Parameters.cs b/DICUI.Library/Aaru/Parameters.cs index 05b603a7..9a575f3b 100644 --- a/DICUI.Library/Aaru/Parameters.cs +++ b/DICUI.Library/Aaru/Parameters.cs @@ -2280,8 +2280,20 @@ namespace DICUI.Aaru // Loop through each index foreach (TrackIndexType trackIndex in track.Indexes) { - // TODO: Convert Value to timecode - cueTrack.Indices.Add(new CueIndex(trackIndex.index.ToString(), trackIndex.Value.ToString())); + // Get timestamp from frame count + int absoluteLength = Math.Abs(trackIndex.Value); + int frames = absoluteLength % 75; + int seconds = (absoluteLength / 75) % 60; + int minutes = (absoluteLength / 75 / 60); + string timeString = $"{minutes:D2}:{seconds:D2}:{frames:D2}"; + + // Pregap information + if (trackIndex.Value < 0) + cueTrack.PreGap = new PreGap(timeString); + + // Individual indexes + else + cueTrack.Indices.Add(new CueIndex(trackIndex.index.ToString(), timeString)); } } else