Example #1
0
 private void OnBundleReceived(OscBundle bundle)
 {
     foreach (OscPacket packet in bundle.Contents)
     {
         if (packet is OscBundle)
         {
             OscBundle subBundle = packet as OscBundle;
             OnBundleReceived(subBundle);
         }
         else
         {
             OscMessage message = packet as OscMessage;
             OnMessageReceived(message);
         }
     }
 }
Example #2
0
        public OscReceiver()
        {
            AddressOnMessageReceived = new Dictionary <string, EventHandler <OSCMessageReceivedArgs> >();
            receiver = new UdpSocketReceiver();

            receiver.MessageReceived += (sender, args) =>
            {
                OscPacket packet = OscPacket.Parse(args.ByteData);
                if (packet is OscBundle)
                {
                    OscBundle bundle = packet as OscBundle;
                    OnBundleReceived(bundle);
                }
                else
                {
                    OscMessage message = packet as OscMessage;
                    OnMessageReceived(message);
                }
            };
        }