コード例 #1
0
        public void sendOSCBundle(OSCbundle ob)
        {
            byte[] Bval = new byte[4];
            byte[] data = new byte[4];

            string cmd = formateMSG("#bundle");

            data = Encoding.ASCII.GetBytes(cmd);

            data = append(data, toByte(0));
            data = append(data, toByte(0));

            for (int i = 0; i < ob.bundle.Count; i++)
            {
                string tt = ",";
                foreach (string s in ob.bundle[i].typeTag)
                {
                    tt = tt + s;
                }
                string ms = formateMSG(ob.bundle[i].msg) + formateMSG(tt);
                Bval = Encoding.ASCII.GetBytes(ms);
                Bval = append(Bval, ob.bundle[i].value[0]);

                for (int j = 1; j < ob.bundle[i].value.Count; j++)
                {
                    Bval = append(Bval, ob.bundle[i].value[j]);
                }
                //data = append(data, toByte(Bval.Length / 8 + (align(Bval.Length / 8))));
                data = append(data, toByte(Bval.Length));
                data = append(data, Bval);
            }

            server.Send(data, data.Length);
        }
コード例 #2
0
ファイル: OSC.cs プロジェクト: HadesDT/Sphero-play-with-Kyla
        public void sendOSCBundle(OSCbundle ob, int timetag)
        {
            byte[] Bval = new byte[4];
            byte[] data = new byte[4];

            string cmd = formateMSG("#bundle");
            data = Encoding.ASCII.GetBytes(cmd);

            data = append(data, toByte(0));
            data = append(data, toByte(timetag));

            for (int i = 0; i < ob.bundle.Count; i++)
            {
                string tt = ",";
                foreach (string s in ob.bundle[i].typeTag) { tt = tt + s; }
                string ms = formateMSG(ob.bundle[i].msg) + formateMSG(tt);
                Bval = Encoding.ASCII.GetBytes(ms);
                Bval = append(Bval, ob.bundle[i].value[0]);

                for (int j = 1; j < ob.bundle[i].value.Count; j++)
                {
                    Bval = append(Bval, ob.bundle[i].value[j]);
                }
                //data = append(data, toByte(Bval.Length/8 + (align(Bval.Length/8))));
                data = append(data, toByte(Bval.Length ));
                data = append(data, Bval);
            }

            server.Send(data, data.Length);
        }
コード例 #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            ip = TBIp.Text;
            port = int.Parse(TBPort.Text);
            oscm = new OSC(ip, port);

            OSCbundle obu = new OSCbundle();
            OSCmsg omess = new OSCmsg("/test bundel 1");
            omess.addValue(357);
            omess.addValue(25.75f);
            obu.addOSCmsg(omess);

            OSCmsg omess2 = new OSCmsg("/test bundel 2");
            omess2.addValue(85);
            omess2.addValue(0.3f);
            obu.addOSCmsg(omess2);
            oscm.sendOSCBundle(obu);
        }