Ejemplo n.º 1
0
        internal MidiNoteMapIndex CompileIndex()
        {
            MidiNoteMapIndex index = new MidiNoteMapIndex();

            index.AddRange(this);

            return(index);
        }
Ejemplo n.º 2
0
        public void Start(int inPortId, int outPortId, MidiNoteMapIndex index)
        {
            _index = index;

            try
            {
                byte channel = (byte)((InChannel - 1) & 0x0F);
                _inNoteOn  = (byte)(NoteOn | channel);
                _inNoteOff = (byte)(NoteOff | channel);

                channel     = (byte)((OutChannel - 1) & 0x0F);
                _outNoteOn  = (byte)(NoteOn | channel);
                _outNoteOff = (byte)(NoteOff | channel);

                _diagnosticsReceiver.Reset();

                _outPort.Open(outPortId);

                _inPort.Open(inPortId);
                _inPort.Start();
            }
            catch
            {
                if (_outPort.HasStatus(MidiPortStatus.Open))
                {
                    _outPort.Close();
                }

                if (_inPort.HasStatus(MidiPortStatus.Open))
                {
                    _inPort.Close();
                }

                throw;
            }
        }