diff --git a/BPMChange.cs b/BPMChange.cs index e910af2..059b02c 100644 --- a/BPMChange.cs +++ b/BPMChange.cs @@ -31,6 +31,10 @@ public BPMChange(int bar, int startTime, double BPM) this.BPM = BPM; } + /// + /// Construct BPMChange with takein value + /// + /// Take in BPMChange public BPMChange(BPMChange takein) { this.Bar = takein.Bar; @@ -38,33 +42,10 @@ public BPMChange(BPMChange takein) this.BPM = takein.BPM; } - //public int Bar - //{ - // get { return this.Bar; } - // set { this.Bar = value; } - //} - - public int Tick - { - get - { return this.StartTime; } - set - { this.StartTime = value; } - } - - //public int StartTime - //{ - // get - // { return this.StartTime; } - // set - // { - // this.StartTime = value; - // } - //} public override bool CheckValidity() { - throw new NotImplementedException(); + return this.BPM != 0; } public override string Compose(int format) diff --git a/BPMChanges.cs b/BPMChanges.cs index ba7450b..d41dfb3 100644 --- a/BPMChanges.cs +++ b/BPMChanges.cs @@ -81,6 +81,9 @@ public void Add(int bar, int tick, double bpm) this.changeNotes.Add(x); } + /// + /// Compose change notes according to BPMChanges + /// public void Update() { for (int i = 0; i < tick.Count; i++) @@ -127,6 +130,10 @@ public string InitialChange } } + /// + /// See if the BPMChange is valid + /// + /// True if valid, false elsewise public bool CheckValidity() { bool result = bar.IndexOf(0) == 0; @@ -135,12 +142,16 @@ public bool CheckValidity() return result; } + /// + /// Compose BPMChanges in beginning of MA2 + /// + /// public string Compose() { string result = ""; for (int i = 0; i < bar.Count; i++) { - result += "BPM" + "\t" + changeNotes[i].Bar + "\t" + changeNotes[i].Tick + "\t" + changeNotes[i].BPM + "\n"; + result += "BPM" + "\t" + changeNotes[i].Bar + "\t" + changeNotes[i].StartTime + "\t" + changeNotes[i].BPM + "\n"; //result += "BPM" + "\t" + bar[i] + "\t" + tick[i] + "\t" + String.Format("{0:F3}", bpm[i])+"\n"; } return result; diff --git a/GoodBrother1.cs b/GoodBrother1.cs index 70df161..9c3c666 100644 --- a/GoodBrother1.cs +++ b/GoodBrother1.cs @@ -317,6 +317,8 @@ public void Update() afterBar.AddRange(bar); this.chart.Add(FinishBar(afterBar, this.BPMChanges.ChangeNotes, i, CalculateQuaver(CalculateLeastMeasure(bar)))); } + Console.WriteLine("TOTAL DELAY: "+this.TotalDelay); + Console.WriteLine("TOTAL COUNT: "+ this.chart.Count * 384); if (this.totalDelay FinishBar(List bar, List bpmChanges, i // writeRest = false; //} } + bool addedTouch = false; foreach (BPMChange x in bpmChanges) { - if (eachSet.Contains(x)) + if (eachSet.Contains(x)&&!addedTouch) { eachSet.Remove(x); List adjusted = new List(); @@ -560,13 +563,15 @@ public static List FinishBar(List bar, List bpmChanges, i adjusted.AddRange(touchEachSet); adjusted.AddRange(eachSet); eachSet = adjusted; + addedTouch = true; } - else + else if (!addedTouch) { List adjusted = new List(); adjusted.AddRange(touchEachSet); adjusted.AddRange(eachSet); eachSet = adjusted; + addedTouch= true; } } //for (int index = 0;index FinishBar(List bar, List bpmChanges, i if (RealNoteNumber(result) != RealNoteNumber(bar)) { string error = ""; - error += ("Bar notes not match in bar: " + barNumber); - error += ("Expected: " + RealNoteNumber(bar)); + error += ("Bar notes not match in bar: " + barNumber)+"\n"; + error += ("Expected: " + RealNoteNumber(bar)) + "\n"; foreach (Note x in bar) { - error += (x.Compose(1)); + error += (x.Compose(1)) + "\n"; } - error += ("\nActrual: " + RealNoteNumber(result)); + error += ("\nActrual: " + RealNoteNumber(result)) + "\n"; foreach (Note y in result) { - error += (y.Compose(1)); + error += (y.Compose(1)) + "\n"; } Console.WriteLine(error); throw new Exception("NOTE NUMBER IS NOT MATCHING"); diff --git a/MaidataCompiler.cs b/MaidataCompiler.cs index 6964d51..fc41bfd 100644 --- a/MaidataCompiler.cs +++ b/MaidataCompiler.cs @@ -138,7 +138,7 @@ public string Compose() public string Compose(GoodBrother1 chart) { string result = ""; - int delayBar = (chart.TotalDelay) / 384 + 1; + int delayBar = (chart.TotalDelay) / 384 + 2; //Console.WriteLine(chart.Compose()); //foreach (BPMChange x in chart.BPMChanges.ChangeNotes) //{ diff --git a/Program.cs b/Program.cs index 4b335a4..8e06a54 100644 --- a/Program.cs +++ b/Program.cs @@ -1,10 +1,17 @@ namespace MusicConverterTest { + /// + /// Main program of converter + /// class Program { + /// + /// Main method to process charts + /// + /// Parameters to takein public static void Main(string[] args) { - //GoodBrother1 good = new GoodBrother1(@"C:\MUG\maimai\SDEZ1.17\Package\Sinmai_Data\StreamingAssets\A000\music\music011089\011089_03.ma2"); + //GoodBrother1 good = new GoodBrother1(@"C:\MUG\maimai\SDEZ1.17\Package\Sinmai_Data\StreamingAssets\A000\music\music011038\011038_03.ma2"); //MaidataCompiler compiler = new MaidataCompiler(); //Console.WriteLine(good.Compose()); //Console.WriteLine(compiler.Compose(good));