public void AddPlayed(TimedBeatId beat, IMatchResultsCollector results)
 {
     if (!patternBeats.Beats.IsEmpty)
     {
         var diff = beat.T - patternBeats.Beats.Next.T;
         if (Math.Abs(diff) <= settings.MaxMatchingTime)
         {
             var match = new BeatsMatch(patternBeats.Beats.RemoveNext(), beat, Accuracy(diff));
             results.Match(match);
             return;
         }
     }
     playedBeats.Add(beat);
 }
        private void LookForMatches(Action <BeatsMatch> matchFound)
        {
            if (patternBeats.Beats.IsEmpty || playedBeats.IsEmpty)
            {
                return;
            }
            var diff = playedBeats.Next.T - patternBeats.Beats.Next.T;

            if (Math.Abs(diff) > settings.MaxMatchingTime)
            {
                return;
            }
            var match = new BeatsMatch(patternBeats.Beats.RemoveNext(), playedBeats.RemoveNext(), Accuracy(diff));

            matchFound(match);
            LookForMatches(matchFound);
        }