コード例 #1
0
        PerKeyArray <HashSet <int> > MoveNotes(double xOffset, int keyOffset, PerKeyArray <HashSet <int> > selectedNotes)
        {
            var pattern = PianoRollPattern.Pattern;

            var notesToMove = pattern.FetchSelectedNotes(selectedNotes);

            pattern.RemoveSelectedNotes(notesToMove);
            var shiftedNotes = notesToMove.Roll(keyOffset).MapParallel(k =>
            {
                foreach (var n in k)
                {
                    n.Start += xOffset;
                }
                return(k.AsEnumerable());
            });

            pattern.InjectNotes(shiftedNotes);

            var editedSelection = shiftedNotes.ToSelectedSNotes();

            PianoRollPattern.DeselectAllNotes();
            PianoRollPattern.SelectNoteRange(editedSelection);

            return(pattern.GetNoteLocations(shiftedNotes));
        }
コード例 #2
0
        public MIDIPatternInteractionMouseDown(MIDIPatternConnect pianoRollPattern) : base(pianoRollPattern)
        {
            if (ImGui.GetIO().KeyShift)
            {
                ContinueWith(new MIDIPatternInteractionMouseShiftDown(PianoRollPattern));
                return;
            }
            ClickLocation = GetMousePos();

            ClickedNote = PianoRollPattern.GetNoteAtLocation(ClickLocation);
            if (ClickedNote == null || !PianoRollPattern.IsNoteSelected(ClickedNote.Value))
            {
                PianoRollPattern.DeselectAllNotes();
            }

            if (ClickedNote != null)
            {
                PianoRollPattern.SelectNote(ClickedNote.Value);
            }
        }