NScumm.Core.MidiParser.ActiveNote C# (CSharp) Method

ActiveNote() protected method

protected ActiveNote ( int channel, int note, bool active ) : void
channel int
note int
active bool
return void
        protected void ActiveNote(int channel, int note, bool active)
        {
            if (note >= 128 || channel >= 16)
                return;

            if (active)
                ActiveNotes[note] |= (ushort)(1 << channel);
            else
                ActiveNotes[note] &= (ushort)~(1 << channel);

            // See if there are hanging notes that we can cancel
            foreach (var hangingNote in HangingNotes.Reverse())
            {
                if (hangingNote.Channel == channel && hangingNote.Note != 0 && hangingNote.TimeLeft != 0)
                {
                    hangingNote.TimeLeft = 0;
                    --HangingNotesCount;
                    break;
                }
            }
        }