Beispiel #1
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);
        }
Beispiel #2
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 Message to send.</param>
        public void Send(ArrayList oms)
        {
            byte[] packet = new byte[1000];
            int    length = OSC.OscMessagesToPacket(oms, packet, 1000);

            OscPacketIO.SendPacket(packet, length);
        }
Beispiel #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()
        {
            try
            {
                while (ReaderRunning)
                {
                    int length = OscPacketIO.ReceivePacket(buffer);

                    if (length > 0)
                    {
                        lock (ReadThreadLock)
                        {
                            if (paused == false)
                            {
                                ArrayList newMessages = OSC.PacketToOscMessages(buffer, length);
                                messagesReceived.AddRange(newMessages);
                            }
                        }
                    }
                    else
                    {
                        Thread.Sleep(5);
                    }
                }
            }

            catch (Exception e)
            {
                Debug.Log("ThreadAbortException" + e);
            }
            finally
            {
            }
        }