Пример #1
0
        /// <summary>
        /// Sends a list of OSC Messages.  Internally takes the OscMessage objects and
        /// serializes them into a byte[] suitable for sending to the PacketExchange.
        /// </summary>
        /// <param name="oms">The OSC Messages (as an ArrayList) to send.</param>
        public void Send(ArrayList oms)
        {
            byte[] packet = new byte[1000];
            int    length = Osc.OscMessagesToPacket(oms, packet, 1000);

            OscPacketIO.SendPacket(packet, length);
        }
Пример #2
0
        /// <summary>
        /// Send an individual OSC message.  Internally takes the OscMessage object and
        /// serializes it into a byte[] suitable for sending to the PacketIO.
        /// </summary>
        /// <param name="oscMessage">The OSC Message to send.</param>
        public void Send(OscMessage oscMessage)
        {
            byte[] packet = new byte[1000];
            int    length = Osc.OscMessageToPacket(oscMessage, packet, 1000);

            OscPacketIO.SendPacket(packet, length);
        }
Пример #3
0
 /// <summary>
 /// Read Thread.  Loops waiting for packets.  When a packet is received, it is
 /// dispatched to any waiting All Message Handler.  Also, the address is looked up and
 /// any matching handler is called.
 /// </summary>
 private void Read()
 {
     while (ReaderRunning)
     {
         byte[] buffer = new byte[1000];
         int    length = OscPacketIO.ReceivePacket(buffer);
         if (length > 0)
         {
             ArrayList messages = Osc.PacketToOscMessages(buffer, length);
             foreach (OscMessage om in messages)
             {
                 if (AllMessageHandler != null)
                 {
                     AllMessageHandler(om);
                 }
                 OscMessageHandler h = (OscMessageHandler)Hashtable.Synchronized(AddressTable)[om.Address];
                 if (h != null)
                 {
                     h(om);
                 }
             }
         }
         else
         {
             Thread.Sleep(500);
         }
     }
 }
Пример #4
0
        public QuickTest()
        {
            InitializeComponent();

              // udpPacket = new UdpPacket();
              // udpPacket.RemoteHostName = "192.168.0.200";
              // udpPacket.RemotePort = 10000;
              // udpPacket.LocalPort = 10000;
              // udpPacket.Open();
              // oscUdp = new Osc(udpPacket);

              usbPacket = new UsbPacket();
              usbPacket.Open();
              osc = new Osc(usbPacket);

              osc.SetAddressHandler("/analogin/7/value", TrimPotReading);
        }
Пример #5
0
        public DeskTimerForm()
        {
            InitializeComponent();

              // udpPacket = new UdpPacket();
              // udpPacket.RemoteHostName = "192.168.0.200";
              // udpPacket.RemotePort = 10000;
              // udpPacket.LocalPort = 10000;
              // udpPacket.Open();
              // osc = new Osc(udpPacket);

              usbPacket = new UsbPacket();
              usbPacket.Open();
              osc = new Osc(usbPacket);

              Working = true;
              ResetTimers();

              osc.SetAddressHandler("/analogin/0/value", SensorReading);
        }
Пример #6
0
        public CPUMonitorWindow()
        {
            InitializeComponent();

              cpuCounter = new PerformanceCounter();

              cpuCounter.CategoryName = "Processor";
              cpuCounter.CounterName = "% Processor Time";
              cpuCounter.InstanceName = "_Total";

              usbPacket = new UsbPacket();
              usbPacket.Open();
              osc = new Osc(usbPacket);

              // udpPacket = new UdpPacket();
              // udpPacket.RemoteHostName = "192.168.0.200";
              // udpPacket.RemotePort = 10000;
              // udpPacket.LocalPort = 10000;
              // udpPacket.Open();
              // osc = new Osc(udpPacket);
        }