From 6a5b6527fbccf992978fe30b02221f06e9067d0b Mon Sep 17 00:00:00 2001 From: Yuu Morino Date: Mon, 16 Mar 2020 19:32:18 +0800 Subject: [PATCH] Fix:midi analyze will cause unexcepted note off when short internal notes appears --- Daigassou/CommonUtilities.cs | 19 +++++++++++-------- Daigassou/Input_Midi/MidiToKey.cs | 8 +++++--- Daigassou/Properties/AssemblyInfo.cs | 6 +++--- Daigassou/Utils/lyricPoster.cs | 5 +++-- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Daigassou/CommonUtilities.cs b/Daigassou/CommonUtilities.cs index 9facff3..440df39 100644 --- a/Daigassou/CommonUtilities.cs +++ b/Daigassou/CommonUtilities.cs @@ -33,20 +33,23 @@ public static async void GetLatestVersion() Environment.Exit(-1); } if (nowVersion != versionObj.Version) + { if (MessageBox.Show(new Form() { TopMost = true }, $"检测到新版本{versionObj.Version}已经发布,点击确定下载最新版哦!\r\n " + - $"当然就算你点了取消,这个提示每次打开还会出现的哦!" + - $"下载错误可以去NGA发布帖哦!bbs.nga.cn/read.php?tid=18790669 \r\n" + - $"新版本更新内容:{versionObj.Description}", "哇——更新啦!", - MessageBoxButtons.OKCancel, - MessageBoxIcon.Information) == DialogResult.OK) + $"当然就算你点了取消,这个提示每次打开还会出现的哦!" + + $"下载错误可以去NGA发布帖哦!bbs.nga.cn/read.php?tid=18790669 \r\n" + + $"新版本更新内容:{versionObj.Description}", "哇——更新啦!", + MessageBoxButtons.OKCancel, + MessageBoxIcon.Information) == DialogResult.OK) { Process.Start("http://blog.ffxiv.cat/index.php/download/"); } - if (versionObj.isForceUpdate) - { - Environment.Exit(-2); + if (versionObj.isForceUpdate) + { + Environment.Exit(-2); + } } + diff --git a/Daigassou/Input_Midi/MidiToKey.cs b/Daigassou/Input_Midi/MidiToKey.cs index c229987..116bede 100644 --- a/Daigassou/Input_Midi/MidiToKey.cs +++ b/Daigassou/Input_Midi/MidiToKey.cs @@ -189,16 +189,16 @@ public void PreProcessEvents() using (var notesManager = trunks.ElementAt(Index).ManageNotes()) { - var lastNote = notesManager.Notes.FirstOrDefault(); + Note lastNote = null; foreach (var @note in notesManager.Notes) { tickBase = 60000 / (float) Tmap.Tempo.AtTime(@note.Time).BeatsPerMinute / ticksPerQuarterNote; var minTick = (long) (85 / tickBase); - if(lastNote.Time+lastNote.Length+minTick> @note.Time) + if(lastNote!=null&& (lastNote.Time+lastNote.Length+minTick> @note.Time)) { - lastNote.Length = lastNote.Length < minTick ? @note.Time - lastNote.Time + minTick: lastNote.Length-minTick; + lastNote.Length = lastNote.Length < minTick ? minTick: lastNote.Length-minTick; } lastNote = @note; @@ -231,8 +231,10 @@ public void SaveToFile() PreProcessTempoMap(); for (var i = 0; i < trunks.Count; i++) { + PreProcessNoise(); PreProcessChord(); PreProcessEvents(); + } var stfd = new SaveFileDialog(); diff --git a/Daigassou/Properties/AssemblyInfo.cs b/Daigassou/Properties/AssemblyInfo.cs index 6e6d7af..19949ff 100644 --- a/Daigassou/Properties/AssemblyInfo.cs +++ b/Daigassou/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ffxiv.cat")] [assembly: AssemblyProduct("Daigassou")] -[assembly: AssemblyCopyright("Copyright © shiro@ffxiv.cat 2018-2019")] +[assembly: AssemblyCopyright("Copyright © shiro@ffxiv.cat 2018-2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.5.2.5")] -[assembly: AssemblyFileVersion("2.5.2.5")] +[assembly: AssemblyVersion("2.6.6.6")] +[assembly: AssemblyFileVersion("2.6.6.6")] diff --git a/Daigassou/Utils/lyricPoster.cs b/Daigassou/Utils/lyricPoster.cs index 0b50f43..9b1e07c 100644 --- a/Daigassou/Utils/lyricPoster.cs +++ b/Daigassou/Utils/lyricPoster.cs @@ -24,7 +24,7 @@ public lyricLine(string _time, string _text) startTimeMs += Convert.ToInt32(result.Groups["min"].Value) * 60000 + Convert.ToInt32(result.Groups["sec"].Value) * 1000 + Convert.ToInt32(result.Groups["hm"].Value) * 10; } } - public static uint port; + public static uint port=2345; public static string suffix = "/s"; public static string url = $"http://127.0.0.1:{port}/command"; public static Thread LrcThread; @@ -45,7 +45,7 @@ public static void PostJson(string text) { try { - var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); + var httpWebRequest = (HttpWebRequest)WebRequest.Create($"http://127.0.0.1:{port}/command"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) @@ -73,6 +73,7 @@ public static void LrcStart(string path, int startOffset) LrcThread = new Thread( () => {RunningLrc(lyric, startOffset);} ); + Log.overlayLog("【歌词播放】歌词导入成功,开始播放"); LrcThread.Start(); } else