Esempio n. 1
0
        public void SetMidiDevice(int epNumber, MidiPort inputport, string name)
        {
            for (int i = 0; i < Midi.SourceCount; i++) {
                var ep = MidiEndpoint.GetSource (i);
                if (ep.Name.Contains (name)) {
                    var inCode = inputport.ConnectSource (ep);

                    if (inCode != MidiError.Ok) {
                        Console.WriteLine (i.ToString () + " - " + ep.DisplayName + " failed to add midi in device");
                    } else {
                        Console.WriteLine (i.ToString () + " - " + ep.DisplayName + " in device added");
                    }
                }
            }

            for (int i = 0; i < Midi.DestinationCount; i++) {
                var ep = MidiEndpoint.GetDestination (i);
                if (ep.Name.Contains (name)) {
                    if (epNumber == 1) {
                        this.Endpoint1 = ep;
                    } else {
                        this.Endpoint2 = ep;
                    }

                }
            }
        }
Esempio n. 2
0
        public MidiRouter()
        {
            Midi.Restart ();
            client = new MidiClient ("MidiRouter");

            InputPort1 = client.CreateInputPort ("mdrInput1");
            InputPort2 = client.CreateInputPort ("mdrInput2");

            outputPort = client.CreateOutputPort ("mdrOutput");

            InputPort1.MessageReceived += HandleMessageReceivedInput1;
            InputPort2.MessageReceived += HandleMessageReceivedInput2;
        }
Esempio n. 3
0
        public void SetupMidi()
        {
            //Midi.Restart ();

            //create new client
            client = new MidiClient ("MidiMod");

            //create input and output port
            outputPort = client.CreateOutputPort ("MidiMod Output Port");
            inputPort = client.CreateInputPort ("MidiMod Input Port");

            //create event handlers
            //			client.ObjectAdded += HandleObjectAdded;
            //			client.ObjectRemoved += HandleObjectRemoved;
            //			client.PropertyChanged += HandlePropertyChanged;
            //			client.ThruConnectionsChanged += HandleThruConnectionsChanged;
            //			client.SerialPortOwnerChanged += HandleSerialPortOwnerChanged;
            //			client.IOError += HandleIOError;
            inputPort.MessageReceived += HandleMessageReceived;

            //connect midi devices
            ConnectMidiDevices ();
        }