Beispiel #1
0
 private void ProcessChord(NotePress physicalNotePressed, IElement[] previousGroup, IElement[] currentGroup, IElement[] nextGroup, Dictionary <byte, List <byte> > pressedNotes)
 {
     foreach (var element in currentGroup)
     {
         if (context.Output != null)
         {
             if (!pressedNotes.ContainsKey(physicalNotePressed.Pitch))
             {
                 pressedNotes[physicalNotePressed.Pitch] = new List <byte>(currentGroup.Length);
             }
             pressedNotes[physicalNotePressed.Pitch].Add(element.Pitch);
             context.Output(new NotePress()
             {
                 Pitch    = element.Pitch,
                 Velocity = physicalNotePressed.Velocity
             });
         }
     }
 }
        private void ProcessChord(NotePress targetNotePress, List <NotePress> notePresses, IElement[] previousGroup, IElement[] filteredCurrentGroup, IElement[] nextGroup, Dictionary <byte, byte> pressedNotes)
        {
            // Zero-based index of which note out of the chord's notes is being processed
            var noteIndex = notePresses.OrderBy(x => x.Pitch).ToList().FindIndex(x => x.Pitch == targetNotePress.Pitch);

            var correctedNote = filteredCurrentGroup[noteIndex];

            if (correctedNote == null)
            {
                Trace.WriteLine($"No corrected note found in filtered current group {filteredCurrentGroup}.");
                return;
            }

            if (context.Output != null)
            {
                pressedNotes[targetNotePress.Pitch] = correctedNote.Pitch;
                context.Output(new NotePress()
                {
                    Pitch    = correctedNote.Pitch,
                    Velocity = targetNotePress.Velocity
                });
            }
        }