From ad057576bc236800cf9d31c4075ae27e8f64df4f Mon Sep 17 00:00:00 2001 From: chudov Date: Sat, 8 Nov 2008 14:59:50 +0000 Subject: [PATCH] fixed a bug in filename corrector, which would erroneously sort filenames alpabeticaly when it should not. added an option to automaticly detect and remove extra 4206 samples, added by some erroneous flac coders. --- CUETools/frmSettings.Designer.cs | 14 + CUETools/frmSettings.cs | 2 + CUETools/frmSettings.resx | 592 ++++++++++++++++--------------- CUETools/frmSettings.ru-RU.resx | 6 + CUEToolsLib/Main.cs | 43 ++- 5 files changed, 368 insertions(+), 289 deletions(-) diff --git a/CUETools/frmSettings.Designer.cs b/CUETools/frmSettings.Designer.cs index f0fdcb1..64e1cf1 100644 --- a/CUETools/frmSettings.Designer.cs +++ b/CUETools/frmSettings.Designer.cs @@ -27,6 +27,7 @@ namespace JDP { System.Windows.Forms.Button btnCancel; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSettings)); this.grpGeneral = new System.Windows.Forms.GroupBox(); + this.chkTruncateExtra4206Samples = new System.Windows.Forms.CheckBox(); this.chkCreateCUEFileWhenEmbedded = new System.Windows.Forms.CheckBox(); this.chkCreateM3U = new System.Windows.Forms.CheckBox(); this.chkFillUpCUE = new System.Windows.Forms.CheckBox(); @@ -132,6 +133,7 @@ namespace JDP { this.grpGeneral.AccessibleName = null; resources.ApplyResources(this.grpGeneral, "grpGeneral"); this.grpGeneral.BackgroundImage = null; + this.grpGeneral.Controls.Add(this.chkTruncateExtra4206Samples); this.grpGeneral.Controls.Add(this.chkCreateCUEFileWhenEmbedded); this.grpGeneral.Controls.Add(this.chkCreateM3U); this.grpGeneral.Controls.Add(this.chkFillUpCUE); @@ -145,6 +147,17 @@ namespace JDP { this.grpGeneral.TabStop = false; this.toolTip1.SetToolTip(this.grpGeneral, resources.GetString("grpGeneral.ToolTip")); // + // chkTruncateExtra4206Samples + // + this.chkTruncateExtra4206Samples.AccessibleDescription = null; + this.chkTruncateExtra4206Samples.AccessibleName = null; + resources.ApplyResources(this.chkTruncateExtra4206Samples, "chkTruncateExtra4206Samples"); + this.chkTruncateExtra4206Samples.BackgroundImage = null; + this.chkTruncateExtra4206Samples.Font = null; + this.chkTruncateExtra4206Samples.Name = "chkTruncateExtra4206Samples"; + this.toolTip1.SetToolTip(this.chkTruncateExtra4206Samples, resources.GetString("chkTruncateExtra4206Samples.ToolTip")); + this.chkTruncateExtra4206Samples.UseVisualStyleBackColor = true; + // // chkCreateCUEFileWhenEmbedded // this.chkCreateCUEFileWhenEmbedded.AccessibleDescription = null; @@ -1106,6 +1119,7 @@ namespace JDP { private System.Windows.Forms.CheckBox chkHDCDStopLooking; private System.Windows.Forms.CheckBox chkCreateM3U; private System.Windows.Forms.CheckBox chkCreateCUEFileWhenEmbedded; + private System.Windows.Forms.CheckBox chkTruncateExtra4206Samples; } } \ No newline at end of file diff --git a/CUETools/frmSettings.cs b/CUETools/frmSettings.cs index 61fb93c..30cb75f 100644 --- a/CUETools/frmSettings.cs +++ b/CUETools/frmSettings.cs @@ -62,6 +62,7 @@ namespace JDP { chkHDCDStopLooking.Checked = _config.wait750FramesForHDCD; chkCreateM3U.Checked = _config.createM3U; chkCreateCUEFileWhenEmbedded.Checked = _config.createCUEFileWhenEmbedded; + chkTruncateExtra4206Samples.Checked = _config.truncate4608ExtraSamples; } private void frmSettings_FormClosing(object sender, FormClosingEventArgs e) { @@ -125,6 +126,7 @@ namespace JDP { _config.decodeHDCD = chkHDCDDecode.Checked; _config.createM3U = chkCreateM3U.Checked; _config.createCUEFileWhenEmbedded = chkCreateCUEFileWhenEmbedded.Checked; + _config.truncate4608ExtraSamples = chkTruncateExtra4206Samples.Checked; } private void chkArFixOffset_CheckedChanged(object sender, EventArgs e) diff --git a/CUETools/frmSettings.resx b/CUETools/frmSettings.resx index 99c05b2..1115077 100644 --- a/CUETools/frmSettings.resx +++ b/CUETools/frmSettings.resx @@ -133,27 +133,35 @@ 73, 23 + + Add ACCURATERIPCOUNT/ACCURATERIPCOUNTALLOFFSETS/ACCURATERIPTOTAL tags to output files. You can set up foobar2000 to show those values, and see if your music was ripped correctly or how popular it is. + 137, 17 + + 8, 6 + 2 - - - True - 6, 20 + + lblSingleFilenameFormat + + + 12, 172 + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 12, 112 System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -164,17 +172,21 @@ labelEncodeWhenConfidence + 2 - - Decode HDCD to 24 bit + + 7 Single format: - - 5 + + chkWriteARLogOnVerify + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Very High @@ -203,9 +215,6 @@ %N-%A-%T - - HDCD decoding is irreversable. Resulting files cannot be burned to the CD. 24-bit audio files are created, but the actual resolution is 20 bit - btnOK @@ -218,6 +227,9 @@ 36, 21 + + True + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -242,6 +254,9 @@ 6 + + Некоторые FLAC-кодировщики добавляют лишние 4206 пустых сэмплов в конце файла. Эту ситуацию можно легко обнаружить и исправить. + 12, 20 @@ -251,8 +266,8 @@ grpWavPack - - True + + 136, 17 4 @@ -276,9 +291,6 @@ tabControl1 - - 81, 17 - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -286,7 +298,7 @@ True - 2 + 3 chkHDCDStopLooking @@ -294,9 +306,6 @@ groupBox3 - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Windows.Forms.Form, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -312,9 +321,6 @@ 542, 307 - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -324,8 +330,8 @@ - - groupBox1 + + 0 1 @@ -354,6 +360,9 @@ 9, 93 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 2 @@ -375,8 +384,8 @@ Yes - - 10 + + 1 grpFLAC @@ -411,6 +420,9 @@ 54, 17 + + grpHDCD + @@ -420,6 +432,9 @@ 4 + + rbWVHigh + groupBox1 @@ -438,8 +453,8 @@ lblTrackFilenameFormat - - grpAudioFilenames + + Top, Left, Right 75, 17 @@ -453,20 +468,20 @@ 1 - - - - + 0 + + rbAPEnormal + True System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 5 + + 12 Fill up missing CUE data from tags @@ -528,30 +543,33 @@ 125, 17 + + 1 + Locate audio files if missing 72, 13 - - txtSingleFilenameFormat - Codecs - - Audio Filenames + + numericWriteOffset 2 - 4 + 5 + + 6 + rbWVVeryHigh @@ -576,8 +594,11 @@ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 1 + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 46, 17 2 @@ -606,11 +627,11 @@ 0 - - + + groupBox1 - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + grpGeneral 229, 17 @@ -618,11 +639,17 @@ 4 - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + FLAC - - chkWriteARLogOnVerify + + 12, 61 + + + 543, 253 + + + Extra mode: True @@ -633,9 +660,6 @@ 273, 271 - - 0 - numericFLACCompressionLevel @@ -648,17 +672,14 @@ 2 - - - groupBox3 with confidence >= - - 38, 21 + + 6 12, 100 @@ -690,8 +711,8 @@ 6 - - FLAC + + 38, 21 True @@ -714,8 +735,11 @@ 0 - - + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpAudioFilenames 73, 23 @@ -735,8 +759,8 @@ Force ANSI filenames - - Top, Right + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -762,8 +786,17 @@ 0 - - grpFLAC + + + + + 8 + + + True + + + Decode HDCD to 24 bit 1 @@ -804,23 +837,26 @@ tabPage3 - - 97, 13 - 235, 40 System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + groupBox2 + 6 - - numEncodeWhenConfidence + + 5 True @@ -831,6 +867,9 @@ chkFLACVerify + + + CUETools @@ -840,11 +879,8 @@ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 1 - - - chkAutoCorrectFilenames + + 11 True @@ -888,12 +924,15 @@ numEncodeWhenPercent - - 12, 61 + + True grpGeneral + + numEncodeWhenConfidence + 7 @@ -904,7 +943,7 @@ 2 - 5 + 6 tabControl1 @@ -918,8 +957,11 @@ 1 + + 9 + - 7 + 8 2 @@ -933,8 +975,8 @@ 11 - - 9 + + 1 txtSpecialExceptions @@ -969,18 +1011,12 @@ chkWriteArTagsOnConvert - - groupBox1 - True - - True - System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -990,11 +1026,8 @@ txtTrackFilenameFormat - - 0 - - - grpWavPack + + groupBox1 Right @@ -1008,6 +1041,9 @@ grpAudioFilenames + + True + lblFLACCompressionLevel @@ -1035,14 +1071,17 @@ grpGeneral - - 6 + + 215, 17 True - - 0 + + txtSingleFilenameFormat + + + 7 System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1057,13 +1096,16 @@ grpGeneral - 6 + 7 - - 543, 253 + + NoControl - - CenterParent + + Monkey's Audio (.ape) + + + 5 127, 17 @@ -1089,14 +1131,11 @@ 137, 17 - - 0 - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True + + 1 System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1104,8 +1143,8 @@ 295, 215 - - groupBox2 + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1122,8 +1161,8 @@ 134, 17 - - 1 + + chkWVExtraMode chkWriteARTagsOnVerify @@ -1158,6 +1197,12 @@ groupBox1 + + + + + 5 + grpAudioFilenames @@ -1179,15 +1224,15 @@ groupBox2 - - 1 - 235, 19 9, 43 + + 38, 21 + 58, 17 @@ -1197,18 +1242,12 @@ 5 - - tabPage1 - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 264, 6 - - 12 - 226, 6 @@ -1248,8 +1287,8 @@ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 204, 148 + + grpAudioFilenames toolTip1 @@ -1275,8 +1314,8 @@ 1 - - NoControl + + 12, 146 46, 17 @@ -1284,6 +1323,9 @@ HDCD + + 1 + labelEncodeWhenPercent @@ -1299,8 +1341,11 @@ 0, 0, 0, 0 - - groupBox1 + + Verify, then convert + + + 149, 21 Extra High @@ -1308,9 +1353,6 @@ 1 - - True - 173, 62 @@ -1338,8 +1380,11 @@ chkPreserveHTOA - - Write AccurateRip tags + + 81, 17 + + + Truncate extra 4206 samples if present 3 @@ -1353,14 +1398,11 @@ 252, 204 - - grpAudioFilenames - 8 - - 12, 112 + + grpFLAC Right @@ -1383,11 +1425,11 @@ 6, 6 - - groupBox1 + + chkCreateCUEFileWhenEmbedded - - Verify, then convert + + 0 @@ -1416,6 +1458,9 @@ Create .m3u playlists + + chkTruncateExtra4206Samples + tabPage2 @@ -1431,6 +1476,12 @@ True + + 9, 23 + + + grpGeneral + 2 @@ -1440,24 +1491,27 @@ chkReplaceSpaces - - 1 + + - - 46, 17 + + - - Monkey's Audio (.ape) + + True System.Windows.Forms.ToolTip, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 7 + + 97, 13 130, 17 + + Audio Filenames + @@ -1467,11 +1521,14 @@ 235, 101 + + 0 + 6 - - rbWVHigh + + tabPage1 6, 13 @@ -1479,8 +1536,8 @@ tabPage3 - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + chkAutoCorrectFilenames Remove special characters except: @@ -1494,14 +1551,11 @@ groupBox2 - + - - chkWVExtraMode - - - + + Top, Right 1 @@ -1509,35 +1563,32 @@ True - - 0 - True 203, 165 - - - 149, 21 + + 4 + + + $this + 1 - - lblWriteOffset - - 3 + 4 36, 21 - - 194, 17 + + groupBox1 135, 17 @@ -1566,8 +1617,8 @@ 3 - - chkCreateCUEFileWhenEmbedded + + 12, 20 chkHDCDDecode @@ -1584,20 +1635,23 @@ Replace spaces with underscores - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Verify Stop looking after 750 frames - - 7 + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 0 155, 17 - - 0 + + 8 235, 80 @@ -1605,15 +1659,15 @@ + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + grpWavPack System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 136, 17 - numFixWhenConfidence @@ -1644,26 +1698,23 @@ True - - 8 - - - 12, 20 + + 1 1 - - 11 + + grpGeneral - - lblSingleFilenameFormat + + HDCD decoding is irreversable. Resulting files cannot be burned to the CD. 24-bit audio files are created, but the actual resolution is 20 bit - - Extra mode: + + % of verified tracks >= @@ -1671,20 +1722,26 @@ Store MD5 checksum - - 1 + + grpWavPack True - - + + 1 + + + 194, 17 + + + 0 3, 3, 3, 3 - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 62, 21 6, 149 @@ -1707,41 +1764,41 @@ Top, Right - - Track format: - - - 4 + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Add ACCURATERIPCOUNT/ACCURATERIPCOUNTALLOFFSETS/ACCURATERIPTOTAL tags to output files. You can set up foobar2000 to show those values, and see if your music was ripped correctly or how popular it is. + + 10 19, 42 - - $this + + groupBox1 Advanced Settings - - tabControl1 + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 6, 81 + + 3 + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 1 - - grpGeneral + + 0 @@ -1752,8 +1809,8 @@ chkFillUpCUE - - 12, 172 + + True tabPage1 @@ -1761,8 +1818,8 @@ 6 - - grpHDCD + + 3 @@ -1779,6 +1836,9 @@ + + + 5 @@ -1791,8 +1851,8 @@ 1 - - 1 + + 58, 17 @@ -1812,8 +1872,8 @@ 1 - - 8, 6 + + 4 @@ -1824,9 +1884,6 @@ Fast - - rbAPEnormal - groupBox1 @@ -1848,15 +1905,12 @@ 1 - - 9, 23 + + Write AccurateRip tags 108, 82 - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 128, 17 @@ -1872,30 +1926,24 @@ - - 6 + + Preprocess with filename corrector if unable to locate audio files btnCancel - - 3 - - - numericWriteOffset + + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 9 - - grpGeneral + + CenterParent with confidence >= - - 62, 21 - 2 @@ -1905,18 +1953,18 @@ - - tabPage2 + + 0 - - 149, 21 - - - Verify + + tabControl1 6, 20 + + Track format: + @@ -1938,14 +1986,8 @@ tabPage2 - - Top, Left, Right - - - 5 - - - 38, 21 + + lblWriteOffset High @@ -1959,8 +2001,8 @@ - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 10 System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1968,14 +2010,14 @@ - - 0 + + tabPage2 - - + + True 13, 20 @@ -1983,15 +2025,9 @@ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Preprocess with filename corrector if unable to locate audio files - 121, 23 - - % of verified tracks >= - True @@ -2004,11 +2040,8 @@ grpGeneral - - 10 - - - True + + grpAudioFilenames tabPage3 @@ -2016,9 +2049,6 @@ - - grpAudioFilenames - 166, 6 @@ -2034,8 +2064,8 @@ General - - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 204, 148 13, 88 @@ -2052,8 +2082,8 @@ rbWVFast - - + + 2 False diff --git a/CUETools/frmSettings.ru-RU.resx b/CUETools/frmSettings.ru-RU.resx index 6f6857b..75a852c 100644 --- a/CUETools/frmSettings.ru-RU.resx +++ b/CUETools/frmSettings.ru-RU.resx @@ -124,6 +124,12 @@ Общие + + 202, 17 + + + Выкидывать лишние 4206 сэмплов + 224, 17 diff --git a/CUEToolsLib/Main.cs b/CUEToolsLib/Main.cs index 04ff28d..d583c67 100644 --- a/CUEToolsLib/Main.cs +++ b/CUEToolsLib/Main.cs @@ -233,6 +233,7 @@ namespace CUEToolsLib public bool wait750FramesForHDCD; public bool createM3U; public bool createCUEFileWhenEmbedded; + public bool truncate4608ExtraSamples; public CUEConfig() { @@ -271,6 +272,7 @@ namespace CUEToolsLib decodeHDCD = false; createM3U = false; createCUEFileWhenEmbedded = false; + truncate4608ExtraSamples = true; } public void Save (SettingsWriter sw) @@ -310,6 +312,7 @@ namespace CUEToolsLib sw.Save("DecodeHDCD", decodeHDCD); sw.Save("CreateM3U", createM3U); sw.Save("CreateCUEFileWhenEmbedded", createCUEFileWhenEmbedded); + sw.Save("Truncate4608ExtraSamples", truncate4608ExtraSamples); } public void Load(SettingsReader sr) @@ -349,6 +352,7 @@ namespace CUEToolsLib decodeHDCD = sr.LoadBoolean("DecodeHDCD") ?? false; createM3U = sr.LoadBoolean("CreateM3U") ?? false; createCUEFileWhenEmbedded = sr.LoadBoolean("CreateCUEFileWhenEmbedded") ?? false; + truncate4608ExtraSamples = sr.LoadBoolean("Truncate4608ExtraSamples") ?? true; } public string CleanseString (string s) @@ -387,7 +391,7 @@ namespace CUEToolsLib private string _htoaFilename, _singleFilename; private bool _hasHTOAFilename, _hasTrackFilenames, _hasSingleFilename, _appliedWriteOffset; private bool _hasEmbeddedCUESheet; - private bool _paddedToFrame, _usePregapForFirstTrackInSingleFile; + private bool _paddedToFrame, _truncated4608, _usePregapForFirstTrackInSingleFile; private int _writeOffset; private bool _accurateRip, _accurateOffset; private uint? _dataTrackLength; @@ -434,6 +438,7 @@ namespace CUEToolsLib _sourcePaths = new List(); _cuePath = null; _paddedToFrame = false; + _truncated4608 = false; _usePregapForFirstTrackInSingleFile = false; _accurateRip = false; _accurateOffset = false; @@ -522,11 +527,16 @@ namespace CUEToolsLib absoluteFileStartTime += fileTimeLengthFrames; NameValueCollection tags; fileTimeLengthSamples = GetSampleLength(pathAudio, out tags); + if ((fileTimeLengthSamples % 588) == 492 && _config.truncate4608ExtraSamples) + { + _truncated4608 = true; + fileTimeLengthSamples -= 4608; + } + fileTimeLengthFrames = (int)((fileTimeLengthSamples + 587) / 588); if (_hasEmbeddedCUESheet) _albumTags = tags; else _trackTags = tags; - fileTimeLengthFrames = (int)((fileTimeLengthSamples + 587) / 588); seenFirstFileIndex = false; } } @@ -753,6 +763,17 @@ namespace CUEToolsLib if (_accurateRipId == null) _accurateRipId = _accurateRipIdActual; } + //if (!_dataTrackLength.HasValue && _cddbDiscIdTag != null) + //{ + // uint cddbDiscIdNum = UInt32.Parse(_cddbDiscIdTag, NumberStyles.HexNumber); + // if ((cddbDiscIdNum & 0xff) == TrackCount) + // { + // _cutOneFrame = true; + // string cddbDiscIdTagCut = CalculateAccurateRipId().Split('-')[2]; + // if (cddbDiscIdTagCut.ToUpper() != _cddbDiscIdTag.ToUpper()) + // _cutOneFrame = false; + // } + //} } public static Encoding Encoding { @@ -1334,6 +1355,10 @@ namespace CUEToolsLib sw.WriteLine("Data track was probably present, length {0}-{1}.", General.TimeToString(_minDataTrackLength.Value), General.TimeToString(_minDataTrackLength.Value + 74)); if (_accurateRipIdActual != _accurateRipId) sw.WriteLine("Using preserved id, actual id is {0}.", _accurateRipIdActual); + if (_truncated4608) + sw.WriteLine("Truncated 4608 extra samples in some input files."); + if (_paddedToFrame) + sw.WriteLine("Padded some input files to a frame boundary."); } if (hdcdDecoder != null && hdcdDecoder.Detected) @@ -2077,6 +2102,7 @@ namespace CUEToolsLib if (!foundAll || always) { + foundAll = false; for (i = 0; i < audioExts.Length; i++) { foundAll = true; @@ -2092,22 +2118,23 @@ namespace CUEToolsLib audioFiles = newFiles.ToArray(); break; } + } + if (!foundAll) + for (i = 0; i < audioExts.Length; i++) + { audioFiles = Directory.GetFiles(dir == "" ? "." : dir, audioExts[i]); if (audioFiles.Length == filePos.Count) { + Array.Sort(audioFiles); + foundAll = true; break; } } - if (i == audioExts.Length) - { + if (!foundAll) throw new Exception("Unable to locate the audio files."); - } - Array.Sort(audioFiles); for (i = 0; i < filePos.Count; i++) - { lines[filePos[i]] = "FILE \"" + Path.GetFileName(audioFiles[i]) + "\" WAVE"; - } } using (StringWriter sw = new StringWriter()) {