public void LastQueriedPlayedNotes() { IGtPlayedNotesAnalyserHelper analyserHelper = new GtPlayedNotesAnalyserHelper( new GtFactoryMockedClock(), new DoubleAudioListenerDoNothing(40)); var note = new GtSceneGuitarNote( new BeatTick(1, 0), new BeatTick(2, 0), 6, 0); //E3 Assert.IsFalse(analyserHelper.NoteIsPlaying(note)); //Add the "E3" to the LastQueriedPlayedNotes list var playedNote = new MusicalNoteAndTimeStamp(); playedNote.MusicalNote = new MusicalNote("E3"); playedNote.TimeStamp = new DateTime(2010, 1, 1, 0, 0, 0, 0); analyserHelper.LastQueriedPlayedNotes.Add(playedNote); //50 ms after playedNote added to LastQueriedPlayedNotes GtFactoryMockedClock.MockCurrentDateTime = new DateTime(2010, 1, 1, 0, 0, 0, GtPlayedNotesAnalyserHelper.DELAY_TIME_FOR_PLAYING_NOTES_RECOGNITION); Assert.IsTrue(analyserHelper.NoteIsPlaying(note)); //51 ms after playedNote added to LastQueriedPlayedNotes GtFactoryMockedClock.MockCurrentDateTime = new DateTime(2010, 1, 1, 0, 0, 0, GtPlayedNotesAnalyserHelper.DELAY_TIME_FOR_PLAYING_NOTES_RECOGNITION + 1); Assert.IsFalse(analyserHelper.NoteIsPlaying(note)); //The expired playedNote was removed from analyserHelper.LastQueriedPlayedNotes Assert.AreEqual(0, analyserHelper.LastQueriedPlayedNotes.Count); }
public void NoteIsPlayingSignature() { IGtPlayedNotesAnalyserHelper analyserHelper = new GtPlayedNotesAnalyserHelper( new GtFactory(), new DoubleAudioListenerDoNothing(40)); var note = new GtSceneGuitarNote( new BeatTick(1, 0), new BeatTick(2, 0), 6, 0); //E3 Assert.IsFalse(analyserHelper.NoteIsPlaying(note)); }