示例#1
0
        /// <summary>
        /// Add a note to the sequence at the specified step/slot.
        /// </summary>
        /// <param name="seqNote">The note to add.</param>
        /// <param name="timeSlot">The step/slot in the sequence to add the note to.</param>
        public void AddNote(SequenceNote seqNote, int timeSlot)
        {
            // Record in the note-on schedule.
            List <SequenceNote> list = _noteSeq[timeSlot];

            if (null == list)
            {
                list = _noteSeq[timeSlot] = new List <SequenceNote>();
            }
            list.Add(seqNote);
        }
示例#2
0
        private void RegisterLiveNote(SequenceNote seqNote, Channel chan)
        {
            LiveNote liveNote = new LiveNote(seqNote.NoteId, chan, seqNote.DurationTicks);

            // Insert new node based on its time remaining (order is low to high).
            // Start the scan from the high end (were the new note is most likely to be).
            LinkedListNode <LiveNote> currNode = _liveNoteList.Last;

            while (null != currNode && seqNote.DurationTicks < currNode.Value.TicksRemaining)
            {
                currNode = currNode.Previous;
            }

            if (null == currNode)
            {
                _liveNoteList.AddFirst(liveNote);
                return;
            }
            _liveNoteList.AddAfter(currNode, liveNote);
        }