public void Add_0_Ticks() { var a = new BeatTick(1, 0); var b = a.AddTicks(0); Assert.AreEqual(a, b); }
public void FillTickDataTable_1NoteWithMomentInMiliseconds() { var note = new GuitarScoreNote("G3", 1, 0, 480, 1000); var tickDataTable = new GtTickDataTable(1); var fileLoader = new GtFileLoader(); fileLoader.FillTickDataTable(tickDataTable, note); for (var pos = new BeatTick(1, 0); pos < new BeatTick(2, 0); pos = pos.AddTicks(10)) { var tickData = tickDataTable[pos.Beat, pos.Tick]; Assert.AreEqual(pos == new BeatTick(1, 0), tickData.IsStartTick); Assert.AreEqual(pos == new BeatTick(1, 470), tickData.IsEndTick); Assert.IsNull(tickData.String1); Assert.IsNull(tickData.String2); Assert.IsNull(tickData.String3); Assert.IsNull(tickData.String4); Assert.IsNull(tickData.String5); Assert.AreEqual(3, tickData.String6); if (pos == new BeatTick(1, 0)) { Assert.AreEqual(1000, tickData.MomentInMiliseconds); } else { Assert.IsNull(tickData.MomentInMiliseconds); } } }
public void Add_1_Tick_ChangingTheBeat() { var a = new BeatTick(1, 479); var b = a.AddTicks(1); Assert.AreEqual(2, b.Beat); Assert.AreEqual(0, b.Tick); }
public void Add_Many_Ticks() { var a = new BeatTick(1, 120); var b = a.AddTicks(480 + 480 + 10); Assert.AreEqual(a.Beat + 2, b.Beat); Assert.AreEqual(a.Tick + 10, b.Tick); }
public void Add_1_Tick() { var a = new BeatTick(1, 0); var b = a.AddTicks(1); Assert.AreEqual(a.Beat, b.Beat); Assert.AreEqual(a.Tick + 1, b.Tick); }
void fTimer_Elapsed(object sender, ElapsedEventArgs e) { fCurrentPosition.AddTicks(10); if (fCurrentPosition >= fDuration) { this.Stop(); } }
public void CurrentExpectedPlayingNotes_Tolerance_InBounds2() { var guitar = new GtSceneGuitar(new Double_GtTickDataTable_32Notes(), 30); var position = new BeatTick(2, 0); guitar.ForceCurrentPosition(position); Assert.AreEqual(3, guitar.CurrentStartingNotes.Count); guitar.ForceCurrentPosition(position.AddTicks(200)); Assert.AreEqual(0, guitar.CurrentStartingNotes.Count); }
public Double_GtTickDataTable_1NoteFirstBeat() : base(16) { var tickData = new GtTickData(); tickData.RemarkOrChordName = "E"; tickData.String6 = 0; var position = new BeatTick(1, 0); var duration = 8 * 480; this.AddTickData(position, position.AddTicks(duration), tickData); }
public void CurrentStartingNotes_Tolerance_OutOfBounds() { //1 note at 5:0 var guitar = new GtSceneGuitar(new Double_GtTickDataTable_1Note(), 30); var position = new BeatTick(5, 0); guitar.ForceCurrentPosition(position.AddTicks(GtSceneGuitar.PLAYER_TOLERANCE_IN_TICKS + 1)); Assert.AreEqual(0, guitar.CurrentStartingNotes.Count); guitar.ForceCurrentPosition(position.SubTicks(GtSceneGuitar.PLAYER_TOLERANCE_IN_TICKS + 1)); Assert.AreEqual(0, guitar.CurrentStartingNotes.Count); }
public Double_GtTickDataTable_1Note() : base(16) { var tickData = new GtTickData(); tickData.RemarkOrChordName = "E"; tickData.String6 = 0; //var position = new BeatTick(4, 0); //GtSceneGuitar.SetSceneGuitarNote add 1 beat - I know, must be adjusted. var position = new BeatTick(5, 0); var duration = 8 * 480; this.AddTickData(position, position.AddTicks(duration), tickData); }
public void CurrentExpectedPlayingNotes_Tolerance_InBounds() { //1 note at 5:0 var guitar = new GtSceneGuitar(new Double_GtTickDataTable_1Note(), 30); var position = new BeatTick(5, 0); guitar.ForceCurrentPosition(position.SubTicks(GtSceneGuitar.PLAYER_TOLERANCE_IN_TICKS)); Assert.AreEqual(1, guitar.CurrentStartingNotes.Count); //the note at (5:0) has 8 beats of duration. guitar.ForceCurrentPosition(position.AddTicks((8 * 480) + GtSceneGuitar.PLAYER_TOLERANCE_IN_TICKS)); Assert.AreEqual(1, guitar.CurrentExpectedPlayingNotes.Count); }
public void SubTicks(int pTicks) { var a = new BeatTick(10, 479); Assert.AreEqual(a.AddTicks(-pTicks), a.SubTicks(pTicks)); }
public Double_GtTickDataTable_3200Notes() : base(3200) { var tickData1 = new GtTickData(); tickData1.RemarkOrChordName = "B"; tickData1.String5 = 2; tickData1.String4 = 4; tickData1.String3 = 4; var tickData2 = new GtTickData(); tickData2.RemarkOrChordName = "F#"; tickData2.String6 = 2; tickData2.String5 = 4; tickData2.String4 = 4; var tickData3 = new GtTickData(); tickData3.RemarkOrChordName = "G#"; tickData3.String6 = 4; tickData3.String5 = 6; tickData3.String4 = 6; var tickData4 = new GtTickData(); tickData4.RemarkOrChordName = "E"; tickData4.String6 = 0; tickData4.String5 = 2; tickData4.String4 = 2; var position = new BeatTick(1, 0); var duration = 120; var distance = 240; for (int j = 0; j < 100; j++) { //Insert 8 B (2 for each beat) for (int i = 0; i < 8; i++) { this.AddTickData(position, position.AddTicks(duration), tickData1); position = position.AddTicks(distance); } //Insert 8 F# (2 for each beat) for (int i = 0; i < 8; i++) { this.AddTickData(position, position.AddTicks(duration), tickData2); position = position.AddTicks(distance); } //Insert 8 G# (2 for each beat) for (int i = 0; i < 8; i++) { this.AddTickData(position, position.AddTicks(duration), tickData3); position = position.AddTicks(distance); } //Insert 8 E (2 for each beat) for (int i = 0; i < 8; i++) { this.AddTickData(position, position.AddTicks(duration), tickData4); position = position.AddTicks(distance); } } }
public Double_GtTickDataTable_ChromaticScale() : base(600) { var tickData1 = new GtTickData(); tickData1.RemarkOrChordName = "C"; tickData1.String5 = 3; var tickData2 = new GtTickData(); tickData2.RemarkOrChordName = "C#"; tickData2.String5 = 4; var tickData3 = new GtTickData(); tickData3.RemarkOrChordName = "D"; tickData3.String5 = 5; var tickData4 = new GtTickData(); tickData4.RemarkOrChordName = "D#"; tickData4.String5 = 6; var tickData5 = new GtTickData(); tickData5.RemarkOrChordName = "E"; tickData5.String4 = 2; var tickData6 = new GtTickData(); tickData6.RemarkOrChordName = "F"; tickData6.String4 = 3; var tickData7 = new GtTickData(); tickData7.RemarkOrChordName = "F#"; tickData7.String4 = 4; var tickData8 = new GtTickData(); tickData8.RemarkOrChordName = "G"; tickData8.String4 = 5; var tickData9 = new GtTickData(); tickData9.RemarkOrChordName = "G#"; tickData9.String3 = 1; var tickData10 = new GtTickData(); tickData10.RemarkOrChordName = "A"; tickData10.String3 = 2; var tickData11 = new GtTickData(); tickData11.RemarkOrChordName = "A#"; tickData11.String3 = 3; var tickData12 = new GtTickData(); tickData12.RemarkOrChordName = "B"; tickData12.String3 = 4; var position = new BeatTick(3, 0); var duration = 230; var distance = 240; var ntimes = 1; for (int j = 0; j < 50; j++) { for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData1); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData2); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData3); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData4); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData5); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData6); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData7); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData8); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData9); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData10); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData11); position = position.AddTicks(distance); } for (int i = 0; i < ntimes; i++) { this.AddTickData(position, position.AddTicks(duration), tickData12); position = position.AddTicks(distance); } } }
public Double_GtTickDataTable_32Notes() : base(16) { var tickData1 = new GtTickData(); tickData1.RemarkOrChordName = "B"; tickData1.String5 = 2; tickData1.String4 = 4; tickData1.String3 = 4; var tickData2 = new GtTickData(); tickData2.RemarkOrChordName = "F#"; tickData2.String6 = 2; tickData2.String5 = 4; tickData2.String4 = 4; var tickData3 = new GtTickData(); tickData3.RemarkOrChordName = "G#"; tickData3.String6 = 4; tickData3.String5 = 6; tickData3.String4 = 6; var tickData4 = new GtTickData(); tickData4.RemarkOrChordName = "E"; tickData4.String6 = 0; tickData4.String5 = 2; tickData4.String4 = 2; var position = new BeatTick(1, 0); var duration = 120; var distance = 240; var distanceInMiliseconds = 500; //0.5 sec (60 BPM) var positionInMiliseconds = 0; //Insert 8 B (2 for each beat) for (int i = 0; i < 8; i++) { tickData1.MomentInMiliseconds = positionInMiliseconds; this.AddTickData(position, position.AddTicks(duration), tickData1); position = position.AddTicks(distance); positionInMiliseconds += distanceInMiliseconds; } //Insert 8 F# (2 for each beat) for (int i = 0; i < 8; i++) { tickData2.MomentInMiliseconds = positionInMiliseconds; this.AddTickData(position, position.AddTicks(duration), tickData2); position = position.AddTicks(distance); positionInMiliseconds += distanceInMiliseconds; } distanceInMiliseconds = 250; //0.25 sec (120 BPM) //Insert 8 G# (2 for each beat) for (int i = 0; i < 8; i++) { tickData3.MomentInMiliseconds = positionInMiliseconds; this.AddTickData(position, position.AddTicks(duration), tickData3); position = position.AddTicks(distance); positionInMiliseconds += distanceInMiliseconds; } //Insert 8 E (2 for each beat) for (int i = 0; i < 8; i++) { tickData4.MomentInMiliseconds = positionInMiliseconds; this.AddTickData(position, position.AddTicks(duration), tickData4); position = position.AddTicks(distance); positionInMiliseconds += distanceInMiliseconds; } }