Skip to content

Commit

Permalink
Fix:midi analyze will cause unexcepted note off when short internal n…
Browse files Browse the repository at this point in the history
…otes appears
  • Loading branch information
AmanoTooko committed Mar 16, 2020
1 parent 60548bb commit 6a5b652
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
19 changes: 11 additions & 8 deletions Daigassou/CommonUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}




Expand Down
8 changes: 5 additions & 3 deletions Daigassou/Input_Midi/MidiToKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -231,8 +231,10 @@ public void SaveToFile()
PreProcessTempoMap();
for (var i = 0; i < trunks.Count; i++)
{
PreProcessNoise();
PreProcessChord();
PreProcessEvents();

}

var stfd = new SaveFileDialog();
Expand Down
6 changes: 3 additions & 3 deletions Daigassou/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("")]

Expand All @@ -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")]
5 changes: 3 additions & 2 deletions Daigassou/Utils/lyricPoster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()))
Expand Down Expand Up @@ -73,6 +73,7 @@ public static void LrcStart(string path, int startOffset)
LrcThread = new Thread(
() => {RunningLrc(lyric, startOffset);}
);
Log.overlayLog("【歌词播放】歌词导入成功,开始播放");
LrcThread.Start();
}
else
Expand Down

0 comments on commit 6a5b652

Please sign in to comment.