Example #1
0
        void Window(int id)
        {
            GUILayout.BeginHorizontal ();

            GUILayout.BeginVertical ();
            GUILayout.Label ("Server");
            _serverField.OnGUI ();
            if (GUILayout.Button ("Send")) {
                var osc = new MessageEncoder (OSC_PATH);
                osc.Add (JsonUtility.ToJson (serverData));
                server.Send (osc);
            }
            if (GUILayout.Button ("Poll")) {
                foreach (var r in server.PollReceived())
                    OnServerReceive (r);
            }
            GUILayout.EndVertical ();

            GUILayout.BeginVertical ();
            GUILayout.Label ("Client");
            _clientField.OnGUI ();
            if (GUILayout.Button ("Send")) {
                var osc = new MessageEncoder (OSC_PATH);
                osc.Add (JsonUtility.ToJson (clientData));
                client.Send (osc);
            }
            if (GUILayout.Button ("Poll")) {
                foreach (var r in client.PollReceived())
                    OnClientReceive (r);
            }
            GUILayout.EndVertical ();

            GUILayout.EndHorizontal ();
            GUI.DragWindow ();
        }
Example #2
0
        /******************** OUTPUT HELPERS ************************/
        private void OscOutput(MidiCommand command)
        {
            var osc = new Osc.MessageEncoder(OSC_PATH);

            osc.Add(JsonUtility.ToJson(command));
            socket.Send(osc);
        }
Example #3
0
 void Update()
 {
     index = Mathf.Clamp (index, 0, datasets.Length);
     var sender = datasets [index].sender;
     var packetsInFrame = Mathf.RoundToInt(Time.deltaTime * packetsPerSec);
     for (var i = 0; i < packetsInFrame; i++) {
         _nsent++;
         var oscdata = new MessageEncoder (OSC_PATH);
         oscdata.Add (_nsent);
         sender.Send (oscdata);
     }
 }