Ejemplo n.º 1
0
        public static void WorkThreadFunction()
        {
            byte[] command;

            try
            {
                while (true)
                {
                    command = port.getCommand();

                    port.sendCommand(command);

                    var arrayToString = byteArrayToString(command);
                    if (arrayToString.Length < 2)
                    {
                        continue;
                    }

                    if (arrayToString == "90, 0x02, 0x4D" || arrayToString == "90, 0x04, 0x0D" || arrayToString == "90, 0x03, 0x0D")
                    {
                        continue;
                    }
                    Console.WriteLine("byteList.Add(new byte[] {0x" + arrayToString + "});");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("thread aborting: " + ex.Message);
            }
        }
Ejemplo n.º 2
0
 private static void WorkThreadFunction(TeVirtualMIDI port)
 {
     while (true)
     {
         port.sendCommand(port.getCommand());
     }
 }
        public void WorkThreadFunction()
        {
            byte[] command;

            try
            {
                while (true)
                {
                    command = port.getCommand();
                    OnNewMessageReceived(command);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("thread aborting: " + ex.Message);
            }
        }
Ejemplo n.º 4
0
 public void SendReceiveMIDI()
 {
     byte[] command;
     try
     {
         while (true)
         {
             command = midiPort.getCommand();
             midiPort.sendCommand(command);
             //Debug.Log("command: " + byteArrayToString(command));
         }
     }
     catch (Exception ex)
     {
         Debug.Log("Fail while sending / retrieving message: " + ex.Message);
     }
 }
Ejemplo n.º 5
0
        private static void RedirectorRun()
        {
            byte[] command;

            try
            {
                while (true)
                {
                    command = _port.getCommand();
                    _port.sendCommand(command);
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("thread aborting: " + ex.Message);
            }
        }
        public static void WorkThreadFunction()
        {
            byte[] command;

            try {
                while (true)
                {
                    command = port.getCommand();

                    port.sendCommand(command);

                    Console.WriteLine("command: " + byteArrayToString(command));
                }
            } catch (Exception ex) {
                Console.WriteLine("thread aborting: " + ex.Message);
            }
        }
Ejemplo n.º 7
0
        private void readInput()
        {
            MidiData midiData = new MidiData();

            try
            {
                while (true)
                {
                    byte[] command = mahPort.getCommand();
                    if (Monitor.TryEnter(outLock))
                    {
                        try
                        {
                            if (outPort.IsOpen)
                            {
                                if (command.Length == 3)
                                {
                                    midiData.Status     = command[0];
                                    midiData.Parameter1 = command[1];
                                    midiData.Parameter2 = command[2];
                                    outPort.ShortData(midiData);
                                }
                                else if (command.Length == 2)
                                {
                                    midiData.Status     = command[0];
                                    midiData.Parameter1 = command[1];
                                    midiData.Parameter2 = 0; //unused
                                    outPort.ShortData(midiData);
                                }
                            }
                        }
                        finally
                        {
                            Monitor.Exit(outLock);
                        }
                    }
                }
            }
            catch (TeVirtualMIDIException)
            {
                clearOtherMIDIout();
            }
        }
        private static void WorkThreadFunction()
        {
            byte[] command;
            try {
                port = new TeVirtualMIDI("Midi Visualizer");
                Console.WriteLine("Virtual port created");
                while (true)
                {
                    command = port.getCommand();

                    asi.processMidiCommand(command);

                    // echo command
                    port.sendCommand(command);
                    Console.WriteLine("command: " + byteArrayToString(command));
                }
            } catch (Exception ex) {
                Console.WriteLine("thread aborting: " + ex.Message);
            }
        }