コード例 #1
0
ファイル: Program.cs プロジェクト: MugenSAS/osc-.net
        private static OscBundle CreateTestBundle()
        {
            IPEndPoint sourceEndPoint = new IPEndPoint(IPAddress.Loopback, Port);
            OscBundle bundle = new OscBundle(sourceEndPoint);

            OscBundle nestedBundle = new OscBundle(sourceEndPoint);
            OscMessage nestedMessage = new OscMessage(sourceEndPoint, TestMethod);
            nestedMessage.AppendNil();
            nestedMessage.Append("Some String");
            nestedMessage.Append(10);
            nestedMessage.Append(100000L);
            nestedMessage.Append(1234.567f);
            nestedMessage.Append(10.0012345);
            nestedMessage.Append(new byte[] { 1, 2, 3, 4 });
            nestedMessage.Append(new OscTimeTag());
            nestedMessage.Append('c');
            nestedMessage.Append(Color.DarkGoldenrod);
            nestedMessage.Append(true);
            nestedMessage.Append(false);
            nestedMessage.Append(float.PositiveInfinity);
            nestedBundle.Append(nestedMessage);
            bundle.Append(nestedBundle);

            OscMessage message = new OscMessage(sourceEndPoint, AliveMethod);
            message.Append(9876.543f);
            bundle.Append(message);

            return bundle;
        }
コード例 #2
0
        /// <summary>
        /// 回転角や位置情報をOSCにより送信
        /// </summary>
        /// <param name="rotHeadXYZ"></param>
        /// <param name="posHeadXYZ"></param>
        /// <param name="posHandRightXYZ"></param>
        /// <param name="posHandLeftXYZ"></param>
        private void SendOSCMessage(Vector3DF rotHeadXYZ, Vector3DF posHeadXYZ, Vector3DF posHandRightXYZ, Vector3DF posHandLeftXYZ)
        {
            // OSCメッセージ生成
            OscMessage rotHeadOsc      = new OscMessage(from, "/head_rot", null);
            OscMessage posHeadOsc      = new OscMessage(from, "/head_pos", null);
            OscMessage posHandRightOsc = new OscMessage(from, "/hand_r", null);
            OscMessage posHandLeftOsc  = new OscMessage(from, "/hand_l", null);

            // 情報の追加
            rotHeadOsc.Append <float>(rotHeadXYZ.x);
            rotHeadOsc.Append <float>(rotHeadXYZ.y);
            rotHeadOsc.Append <float>(rotHeadXYZ.z);
            posHeadOsc.Append <float>(posHeadXYZ.x);
            posHeadOsc.Append <float>(posHeadXYZ.y);
            posHeadOsc.Append <float>(posHeadXYZ.z);
            posHandRightOsc.Append <float>(posHandRightXYZ.x);
            posHandRightOsc.Append <float>(posHandRightXYZ.y);
            posHandRightOsc.Append <float>(posHandRightXYZ.z);
            posHandLeftOsc.Append <float>(posHandLeftXYZ.x);
            posHandLeftOsc.Append <float>(posHandLeftXYZ.y);
            posHandLeftOsc.Append <float>(posHandLeftXYZ.z);

            // 送信
            rotHeadOsc.Send(toExp);
            posHeadOsc.Send(toExp);
            posHandRightOsc.Send(toExp);
            posHandLeftOsc.Send(toExp);
        }
コード例 #3
0
ファイル: Messenger.cs プロジェクト: mstevenson/OSCMessenger
    void DoSendCommand(string command, params object[] args)
    {
        var endPoint = new IPEndPoint(IPAddress.Parse(address), port);

        var oscMessage = new OscMessage(endPoint, "/" + command);

        foreach (var arg in args)
        {
            if (arg is int)
            {
                oscMessage.Append <int> ((int)arg);
            }
            else if (arg is float)
            {
                oscMessage.Append <float> ((float)arg);
            }
            else
            {
                oscMessage.Append <string> (arg.ToString());
            }
        }

        // Spam a few of the same message, effectively solves UDP unreliability in a clunky way
        for (int i = 0; i < 5; i++)
        {
            oscMessage.Send(endPoint);
        }
    }
コード例 #4
0
        //
        // message helpers
        //

        private OscMessage CreateSourceMessage(string type)
        {
            OscMessage msg = new OscMessage("/tuio/" + type);

            msg.Append("source");
            msg.Append("TUIO Simulator@" + localIPAddresses);
            return(msg);
        }
コード例 #5
0
        private OscMessage CreateFSeqMessage(string type)
        {
            OscMessage msg = new OscMessage("/tuio/" + type);

            msg.Append("fseq");
            msg.Append(fseq);
            return(msg);
        }
コード例 #6
0
ファイル: OSCTransmitter.cs プロジェクト: CERobertson/VRMAC
    // Update is called once per frame
    public void SendPosition()
    {
        OscMessage m = new OscMessage(address);

        m.Append(transform.position.x);
        m.Append(transform.position.y);
        m.Append(transform.position.z);
        transmitter.Send(m);
    }
コード例 #7
0
ファイル: HoloLens.cs プロジェクト: swoyenssss/Hevs_o_lens
    private void SendAxesGesture(string gesture, Vector3 axes)
    {
        // Message with address "/id/axes_gesture"
        OscMessage msg = new OscMessage("/" + display.id + "/axes_gesture");

        // Set the gesture
        msg.Append(gesture);
        msg.Append(axes.x);
        msg.Append(axes.y);
        msg.Append(axes.z);

        // Send the transform data to master
        _transmitter.Send(msg);
    }
コード例 #8
0
        private static OscBundle CreateTestBundle()
        {
            IPEndPoint sourceEndPoint = new IPEndPoint(IPAddress.Loopback, Port);
            OscBundle  bundle         = new OscBundle(sourceEndPoint);

            OscBundle  nestedBundle  = new OscBundle(sourceEndPoint);
            OscMessage nestedMessage = new OscMessage(sourceEndPoint, TestMethod);

            nestedMessage.AppendNil();
            nestedMessage.Append("Some String");
            nestedMessage.Append(10);
            nestedMessage.Append(100000L);
            nestedMessage.Append(1234.567f);
            nestedMessage.Append(10.0012345);
            nestedMessage.Append(new byte[] { 1, 2, 3, 4 });
            nestedMessage.Append(new OscTimeTag());
            nestedMessage.Append('c');
            nestedMessage.Append(Color.DarkGoldenrod);
            nestedMessage.Append(true);
            nestedMessage.Append(false);
            nestedMessage.Append(float.PositiveInfinity);
            nestedBundle.Append(nestedMessage);
            bundle.Append(nestedBundle);

            OscMessage message = new OscMessage(sourceEndPoint, AliveMethod);

            message.Append(9876.543f);
            bundle.Append(message);

            return(bundle);
        }
コード例 #9
0
    public void sendPickupCount(int count)
    {
        controllerOscMessage = new OscMessage("/playerPositionX");
        controllerOscMessage.Append(1.0f);

        oscTransmitter.Send(controllerOscMessage);
    }
コード例 #10
0
        private OscMessage CreateAliveMessage(string type)
        {
            OscMessage msg = new OscMessage("/tuio/" + type);

            msg.Append("alive");
            return(msg);
        }
コード例 #11
0
 // Send QTM OSC Command to server
 private void SendCommand(string cmd)
 {
     qtmCommand.ClearData();
     qtmCommand.Append(cmd);
     LogMessage(qtmCommand);
     qtmCommand.Send(serverEndPoint);
 }
コード例 #12
0
        /// <summary>
        ///     Delivers the value to method.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="stream">The stream.</param>
        /// <param name="method">The method.</param>
        /// <param name="value">The value.</param>
        private static void DeliverValueToMethod <T>(this IObserver <OscPacket> stream, string method, T value)
        {
            var msg = new OscMessage(method);

            msg.Append(value);
            stream.OnNext(msg);
        }
コード例 #13
0
ファイル: JSonExtensions.cs プロジェクト: colombod/eDrive.OSC
        private static OscPacket DeserialiseMessage(JsonReader reader, string address)
        {
            reader.Read(); // read property tags
            var tags = reader.ReadAsString();
            var msg  = new OscMessage(address);

            reader.Read(); // data property name
            reader.Read(); // array start
            for (var index = 0; index < tags.Length; index++)
            {
                var tag = tags[index];

                if (tag == JsonSerializerFactory.ArrayOpen)
                {
                    // skip the '[' character.
                    index++;

                    // deserialise array of object
                    var ret = new List <object>();
                    while (tags[index] != JsonSerializerFactory.ArrayClose &&
                           index < tags.Length)
                    {
                        var des = JsonSerializerFactory.GetSerializer(tags[index]);
                        ret.Add(des.Decode(reader));

                        index++;
                    }

                    msg.Append(ret.ToArray());
                }
                else if (tag != JsonSerializerFactory.DefaultTag)
                {
                    if (tag != JsonSerializerFactory.EventTag)
                    {
                        var des = JsonSerializerFactory.GetSerializer(tag);
                        msg.Append(des.Decode(reader));
                    }
                    else
                    {
                        msg.IsEvent = true;
                    }
                }
            }
            reader.Read(); // array end

            return(msg);
        }
コード例 #14
0
        private OscMessage CreateOscMessage(SensorData sensorData)
        {
            OscMessage dataOscMessage = new OscMessage(_sourceEndPoint, "/taprapper/sensordata", sOscClient);

            dataOscMessage.Append(sensorData.AccDataObject.DataVector.X);
            dataOscMessage.Append(sensorData.AccDataObject.DataVector.Y);
            dataOscMessage.Append(sensorData.AccDataObject.DataVector.Z);
            dataOscMessage.Append(sensorData.GyroDataObject.Pitch);
            dataOscMessage.Append(sensorData.GyroDataObject.Roll);
            dataOscMessage.Append(sensorData.GyroDataObject.Yaw);
            dataOscMessage.Append(sensorData.QuaternionObject.X);
            dataOscMessage.Append(sensorData.QuaternionObject.Y);
            dataOscMessage.Append(sensorData.QuaternionObject.Z);
            dataOscMessage.Append(sensorData.QuaternionObject.W);

            return(dataOscMessage);
        }
コード例 #15
0
 void OnCollisionEnter(Collision collision)
 {
     if (!clicked)
     {
         var s = stroke.GetComponent <Stroke>();
         if (s.NumberOfStrokes > 0)
         {
             var        sound = collision.gameObject.GetComponent <Sound>();
             OscMessage m     = new OscMessage(audiomesh_address);
             m.Append(sound.AudioIndex);
             m.Append(0.0);
             var percentage = ((float)sound.Index) / s.NumberOfStrokes;
             m.Append(percentage);
             transmitter.Send(m);
         }
     }
 }
コード例 #16
0
    private void Controller_MenuUnclicked(object sender, ClickedEventArgs e)
    {
        OscMessage m = new OscMessage(reset_address);

        m.Append(0.0f);
        transmitter.Send(m);
        DestroyImmediate(strokes);
        strokes           = new GameObject();
        Sound.GlobalIndex = 1;
    }
コード例 #17
0
        /// <summary>
        /// Sends an OSC message to the remote host.
        /// </summary>
        public void Send(string message, params float[] args)
        {
            var msg = new OscMessage(OSCSettings.SourceEndPoint, message);

            foreach (var f in args)
            {
                msg.Append(f);
            }
            msg.Send(Target);
        }
コード例 #18
0
        public void TestArraySerialisation3()
        {
            var msg = new OscMessage("/test", new object[] { 1, 2f, "foo" });

            msg.Append(1); // the last argument is an integer.

            var expected = CreateExpectedDataArray3();

            msg.TypeTag.Should().Be(",[ifs]i");
            OscValidation.AssertSamePacket(expected, msg.ToByteArray());
        }
コード例 #19
0
    private void AppendMessage(string address, List <object> values)
    {
        OscMessage messageToSend = new OscMessage(localEndPoint, address);

        //        messageToSend.ClearData(); // do i need this?
        foreach (object message in values)
        {
            messageToSend.Append(message);
        }
        messagesThisFrame.Add(messageToSend);
    }
コード例 #20
0
        /// <summary>
        /// Send message to osc device.
        /// </summary>
        /// <param name="address">Address where to send the message.</param>
        /// <param name="value">List of Message(s) or value(s) to send.</param>
        /// <param name="ipAddress">IP address of the osc device.</param>
        /// <param name="port">Port of the osc device.</param>
        private void sendOscMessage(string address, IList <object> data, IPAddress ipAddress, int port)
        {
            IPEndPoint sourceEndPoint = new IPEndPoint(ipAddress, port);
            OscMessage oscMessage     = new OscMessage(sourceEndPoint, address);

            foreach (object value in data)
            {
                oscMessage.Append(value);
            }
            oscMessage.Send(sourceEndPoint);
        }
コード例 #21
0
ファイル: Playback.cs プロジェクト: robbell/compose-collide
        private void BuildTrackMessage(int[][] score, OscMessage m, int trackCount)
        {
            if (IsShortTrack(score, trackCount))
            {
                positions[trackCount] = 0;
            }

            if (HasBeat(score, trackCount)) m.Append(trackCount + 1);

            ProgressTrackPosition(trackCount);
        }
コード例 #22
0
ファイル: Program.cs プロジェクト: robbell/drum-score
        private static void SendMessage(string messageText)
        {
            var message = new OscMessage(endPoint, "/");

            foreach (var item in messageText.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
            {
                message.Append(item);
            }

            message.Send(endPoint);
        }
コード例 #23
0
ファイル: HoloLens.cs プロジェクト: swoyenssss/Hevs_o_lens
    private void SendButtonGesture(string gesture)
    {
        // Message with address "/id/button_gesture"
        OscMessage msg = new OscMessage("/" + display.id + "/button_gesture");

        // Set the gesture
        msg.Append(gesture);
        
        // Send the transform data to master
        _transmitter.Send(msg);
    }
コード例 #24
0
        private void AppendToBundle <T>(OscBundle oscBundle, OscMessage sourceMsg, OscMessage aliveMsg, OscMessage fseqMsg, bool forceSet = false) where T : ITUIOEntity
        {
            // http://www.tuio.org/?specification - Message & Bundle Format
            //
            // /tuio/2Dcur source application@address
            // /tuio/2Dcur alive s_id0 ... s_idN
            // /tuio/2Dcur set s x y X Y m
            // /tuio/2Dcur fseq f_id
            //
            // nb. TUIOsharp does not enforce an order for alive/set messages so long as they're before fseq

            oscBundle.Append(sourceMsg);

            // entities: alive, set
            aliveMsg.ClearData();             // nb. also clears address
            aliveMsg.Append("alive");

            oscBundle.Append(aliveMsg);

            for (int i = 0; i < _entities.Count; i++)
            {
                ITUIOEntity e = _entities[i];
                if (e.GetType() != typeof(T))
                {
                    continue;
                }

                aliveMsg.Append(e.Id);
                if (forceSet || e.isSendRequired)
                {
                    oscBundle.Append(e.oscMessage);                     // set
                    e.isSendRequired = false;
                }
            }

            // frame sequence
            fseqMsg.UpdateDataAt(1, fseq);
            oscBundle.Append(fseqMsg);
        }
コード例 #25
0
    private void HandleTriggerClicked(object sender, ClickedEventArgs e)
    {
        clicked = true;
        points.Clear();
        stroke = new GameObject(stroke_object, typeof(Stroke));
        stroke.transform.parent = strokes.transform;
        stroke_index            = -1;

        OscMessage m = new OscMessage(trigger_address);

        m.Append(transform.position.x);
        transmitter.Send(m);
    }
コード例 #26
0
    private void Controller_TriggerUnclicked(object sender, ClickedEventArgs e)
    {
        clicked           = false;
        lastStroke.points = points.ToArray();
        stroke.GetComponent <Stroke>().NumberOfStrokes = points.Count;

        OscMessage m = new OscMessage(trigger_address);

        m.Append(0);
        transmitter.Send(m);

        soundMarker.AudioIndex = Sound.GlobalIndex++;
    }
コード例 #27
0
    // --- game functions ---
    public void sendOSCPlayerPosition(float x, float z)
    {
        //controllerOscMessage = new OscMessage (spherePositionNamespace);
        controllerOscMessage = new OscMessage("/playerPositionX");
        //print("Test");
        controllerOscMessage.Append(x);
        //controllerOscMessage.Append (z);
        //controllerOscMessage.Append("/1/toggle1, f");

        //oscTransmitter.Send (controllerOscMessage);

        // /sphere/position 8.3 -3.1
    }
コード例 #28
0
        public void TestArraySerialisation4()
        {
            var msg = new OscMessage("/test", new object[] { 1, 2f, "foo" });

            var blob = CreateTestBlob();

            msg.Append(blob); // the last argument is a blob.

            var expected = CreateExpectedDataArray4();

            msg.TypeTag.Should().Be(",[ifs]b");
            OscValidation.AssertSamePacket(expected, msg.ToByteArray());
        }
コード例 #29
0
        /// <summary>
        /// Sends an OSC message to all connected Ableton Live sessions.
        /// </summary>
        public void Send(string message, params float[] args)
        {
            var msg = new OscMessage(SourceEndPoint, message);

            foreach (var f in args)
            {
                msg.Append(f);
            }
            foreach (var target in Targets)
            {
                msg.Send(target);
            }
        }
コード例 #30
0
        private void BuildTrackMessage(int[][] score, OscMessage m, int trackCount)
        {
            if (IsShortTrack(score, trackCount))
            {
                positions[trackCount] = 0;
            }

            if (HasBeat(score, trackCount))
            {
                m.Append(trackCount + 1);
            }

            ProgressTrackPosition(trackCount);
        }
コード例 #31
0
        private void SendMessage(string address, int[] values = null)
        {
            OscMessage msg = new OscMessage(source, string.Format(MESSAGE_FORMAT, address));

            if (values != null)
            {
                foreach (object v in values)
                {
                    msg.Append(v);
                }
            }

            msg.Send(dest);
        }
コード例 #32
0
        // Send data through OSC
        private void SendOSCX(string address, params object[] args)
        {
            // Message with address "/id/button_gesture"
            OscMessage msg = new OscMessage(address);

            // Set the gesture
            foreach (object arg in args)
            {
                msg.Append(arg);
            }

            // Send the transform data to master
            _transmitterX.Send(msg);
        }
コード例 #33
0
        /**
         * Creates an OSC formatted message using the current key/value pairs within the
         * local Peer.stateVars dictionary. Each key is represented as a component of the
         * string address (separated by forward slashes). Each value is appended to the
         * OSC packet using the appropriate bit packing method. The index parameter is used
         * to help the remote ServerConnection object match the OSC message with its locally
         * stored list of Client instances.
         *
         * @param index the integer sent to the client upon registration
         * @return TRUE if stateTransmitter was properly initialized, FALSE otherwise
         */
        internal bool PropagateStateVars(int index)
        {
            bool propagated = false;

            if (this.stateVarsInvalidated && null != this.stateTransmitter && this.stateTransmitter.IsConnected() && this.stateVars.Count > 0)
            {
                string     address = "";
                OscMessage message = new OscMessage("");
                message.Append(index);
                foreach (KeyValuePair <string, object> pair in this.stateVars)
                {
                    address += pair.Key + "/";
                    message.Append(pair.Value);
                }
                message.Address = address;
                this.stateTransmitter.Send(message);
                //UnityMainThreadDispatcher.Instance ().Enqueue (ExsecuteOnMainThread_TimeCheck ());
                propagated = true;
            }

            this.stateVarsInvalidated = false;

            return(propagated);
        }
コード例 #34
0
        private OscBundle CreateBundle()
        {
            var ipAddress      = _setting.UseLoopback ? IPAddress.Loopback : IPAddress.Parse(_setting.IpAddress);
            var sourceEndPoint = new IPEndPoint(ipAddress, _setting.Port);
            var bundle         = new OscBundle(sourceEndPoint);

            var nestedBundle = new OscBundle(sourceEndPoint);

            foreach (var bindValue in _setting.BindValues)
            {
                var message = new OscMessage(sourceEndPoint, bindValue.Address);
                message.Append(bindValue.Value);
                nestedBundle.Append(message);
            }
            bundle.Append(nestedBundle);
            return(bundle);
        }
コード例 #35
0
 private void limboViewerCaptureFree(int _userCount , int _cellPhoneNumber)
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view/picture");
     msg.Append(_userCount.ToString() + "_0" + _cellPhoneNumber.ToString());
     msg.Send(limboViewerIP);
 }
        OscBundle skeleton2DdataCoordEventArgsToOSCBundle(Skeleton2DdataCoordEventArgs e)
        { 
            //Bundles are collections of messages
            OscBundle bundle = new OscBundle(transmitter_ipendpoint);
            //Messages are like packets, label with their type by method name
            OscMessage message = new OscMessage(transmitter_ipendpoint, DEMO_METHOD);
            //Both bundles and messages can be nested
            //Must have at least one bundle and on message

            //Send the whole skeleton
            //First send the index
            message.Append(e.index);
            //Then append each point in order, x then y
            int num_points = e._points.Count();
            for (int i = 0; i < num_points; i++)
            {
                Point normalized_point = normalize_skeleton_point(e._points[i]);
                message.Append((float)normalized_point.X);
                message.Append((float)normalized_point.Y);
            }
            bundle.Append(message);
            return bundle;
        }
コード例 #37
0
ファイル: TuioKinect.cs プロジェクト: intuilab/KinectIA
        private OscMessage GetCursorMessage(TuioCursor cursor)
        {
            OscMessage msg = new OscMessage(_ipEndPoint, _cursorAddressPattern);

            msg.Append("set");
            msg.Append((Int32)cursor.Id);
            msg.Append(cursor.Location.X);
            msg.Append(cursor.Location.Y);
            msg.Append(cursor.Speed.X);
            msg.Append(cursor.Speed.Y);
            msg.Append(cursor.MotionAcceleration);

            return msg;
        }
コード例 #38
0
 // Limbo Viewer Message Send
 private void limboViewerSetScene(int sceneNumber)
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view/scene");
     msg.Append(sceneNumber);
     msg.Send(limboViewerIP);
 }
コード例 #39
0
        private void limboViewerSendSuccess(bool successStatus)
        {
            OscMessage msg = new OscMessage(limboViewerIP, "/view");
            if (successStatus)
            {
                msg.Append("success");
            }
            else
            {
                msg.Append("fail");
            }

            msg.Send(limboViewerIP);
        }
コード例 #40
0
 private void limboViewerPlayCountDown()
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view");
     msg.Append("countdown");
     msg.Send(limboViewerIP);
 }
コード例 #41
0
 // iPad Message Send
 //private void iPadSendPicture(int _userCount)
 //{
 //    OscMessage msg = new OscMessage(ipadIP, "/ipad/picture");
 //    msg.Append(_userCount);
 //    msg.Send(ipadIP);
 //}
 private void iPadNextUserReady()
 {
     OscMessage msg = new OscMessage(ipadIP, "/ipad");
     msg.Append("ready");
     msg.Send(ipadIP);
 }
コード例 #42
0
 private void iPadIsAlive()
 {
     OscMessage msg = new OscMessage(ipadIP, "/ipad");
     msg.Append("test");
     msg.Send(ipadIP);
 }
コード例 #43
0
 private void imageServerTakePhoto(int _userCount, int _cellPhoneNumber)
 {
     OscMessage msg = new OscMessage(imageServerIP, "/image/picture");
     msg.Append(_userCount.ToString()+"_0"+_cellPhoneNumber.ToString());
     msg.Send(imageServerIP);
 }
コード例 #44
0
 // Image Server Message Send
 private void imageServerMergeImage()
 {
     OscMessage msg = new OscMessage(imageServerIP, "/image");
     msg.Append("merge");
     msg.Send(imageServerIP);
 }
コード例 #45
0
 private void imageServerIsAlive()
 {
     OscMessage msg = new OscMessage(imageServerIP, "/image");
     msg.Append("test");
     msg.Send(imageServerIP);
 }
コード例 #46
0
        public void sendSkeletonData(Skeleton skeleton_data, int i )
        {
            IPEndPoint sourceEndPoint = new IPEndPoint(IPAddress.Loopback, Port);
            OscBundle sBundle = new OscBundle(sourceEndPoint);
            //OscMessage sMessage = new OscMessage(sourceEndPoint, "/skeleton", client);

            foreach (Joint joint in skeleton_data.Joints)
            {
                if (this.oscCheck.IsChecked.HasValue && this.oscCheck.IsChecked.Value)
                {
                    OscMessage oscMessage = new OscMessage(sourceEndPoint, "/skeleton", client);
                    oscMessage.Append(joint.JointType.ToString());
                    oscMessage.Append(i.ToString());
                    oscMessage.Append(joint.Position.X.ToString());
                    oscMessage.Append(joint.Position.Y.ToString());
                    oscMessage.Append(joint.Position.Z.ToString());
                    oscMessage.Send(Destination);
                }

            }
        }
コード例 #47
0
        public static OscMessage CreateMessage(string Address)
        {
            Address = Address.Trim();
            string Value = null;
            if (Address.IndexOf(" ") > 0)
            {
                Value = Address.Substring(Address.IndexOf(" ") + 1);
                Address = Address.Substring(0, Address.IndexOf(" "));
            }

            OscMessage msg = new OscMessage(sourceEndPoint, Address);
            if (Value != null)
            {
                if (Address.EndsWith("updates") ||
                    Address.EndsWith("loadAt") ||
                    Address.EndsWith("preWait") ||
                    Address.EndsWith("duration") ||
                    Address.EndsWith("postWait") ||
                    Address.EndsWith("continueMode") ||
                    Address.EndsWith("flagged") ||
                    Address.EndsWith("armed") ||
                    Address.EndsWith("patch") ||
                    Address.EndsWith("startTime") ||
                    Address.EndsWith("endTime") ||
                    Address.EndsWith("playCount") ||
                    Address.EndsWith("infiniteLoop") ||
                    Address.EndsWith("rate") ||
                    Address.EndsWith("doFade") ||
                    Address.EndsWith("surfaceID") ||
                    Address.EndsWith("fullScreen") ||
                    Address.EndsWith("preserveAspectRatio") ||
                    Address.EndsWith("translationX") ||
                    Address.EndsWith("translationY") ||
                    Address.EndsWith("scaleX") ||
                    Address.EndsWith("scaleY") ||
                    Address.EndsWith("doEffect") ||
                    Address.EndsWith("effect"))
                {
                    msg.Append<float>((float)Convert.ToDouble(Value));
                }
                else if (Address.EndsWith("sliderLevel"))
                {
                    if (Value.Contains(" "))
                    {
                        msg.Append<float>((float)Convert.ToDouble(Value.Substring(0, Value.IndexOf(" "))));
                        Value = Value.Substring(Value.IndexOf(" ") + 1);
                    }
                    msg.Append<float>((float)Convert.ToDouble(Value));
                }
                else
                {
                    msg.Append<string>(Value);
                }
            }
            return msg;
        }
コード例 #48
0
 private void limboViewerGetImageFromServer(int _userCount, int _cellPhoneNumber)
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view/merge");
     msg.Append(_userCount.ToString() + "_0" + _cellPhoneNumber.ToString());
     msg.Send(limboViewerIP);
 }
コード例 #49
0
 private void limboViewerIsAlive()
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view");
     msg.Append("test");
     msg.Send(limboViewerIP);
 }
コード例 #50
0
        private void iPadSendSuccess(bool successStatus)
        {
            // keep trying until 'photoReady = true'
            OscMessage msg;
            if (successStatus)
            {
                msg = new OscMessage(limboViewerIP, "/ipad/success");
                msg.Append(userCount.ToString() + "_0"+ cellPhoneNumber.ToString());
            }
            else
            {
                msg = new OscMessage(limboViewerIP, "/ipad/fail");
                msg.Append(userCount.ToString() + "_0" + cellPhoneNumber.ToString());
            }

            userCount++;
            MySettings.Default.userCountSetting = userCount;
            this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
            {
                userCountDisplay.Text = userCount.ToString();
            }));

            msg.Send(ipadIP);
        }
コード例 #51
0
 private void limboViewerPlaySlideView()
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view");
     msg.Append("slideview");
     msg.Send(limboViewerIP);
 }
コード例 #52
0
 private void iPadTestButton_Click(object sender, RoutedEventArgs e)
 {
     msg = new OscMessage(ipadIP, iPadMsgAddr);
     msg.Append(iPadMsgArg);
     msg.Send(ipadIP);
 }
コード例 #53
0
 private void limboViewerSendUserTracked()
 {
     OscMessage msg = new OscMessage(limboViewerIP, "/view/user");
     msg.Append("tracked");
     msg.Send(limboViewerIP);
 }
コード例 #54
0
        // Kinect Message Send
        private void kinectOn(int kinect)
        {
            string addr = "/kinect/" + kinect.ToString();

            if(kinect == 1)
            {
                OscMessage msg = new OscMessage(kinectFrontIP, addr); ;
                msg.Append("on");
                msg.Send(kinectFrontIP);
            }
            else if (kinect == 2)
            {
                OscMessage msg = new OscMessage(kinectBackIP, addr); ;
                msg.Append("on");
                msg.Send(kinectBackIP);
            }
            else
            {
                return;
            }
        }
コード例 #55
0
 private void limboStandIsAlive()
 {
     OscMessage msg = new OscMessage(limboStandIP, "/stand");
     msg.Append("test");
     msg.Send(limboStandIP);
 }
コード例 #56
0
 private void limboStandReset()
 {
     OscMessage msg = new OscMessage(limboStandIP, "/stand");
     msg.Append("reset");
     msg.Send(limboStandIP);
 }
コード例 #57
0
ファイル: TuioKinect.cs プロジェクト: intuilab/KinectIA
        private OscMessage GetAliveMessage()
        {
            OscMessage msg = new OscMessage(_ipEndPoint, _cursorAddressPattern);

            msg.Append("alive");
            lock (_cursors)
                foreach (TuioCursor cursor in _cursors.Values)
                    msg.Append((Int32)cursor.Id);

            return msg;
        }
コード例 #58
0
 // Limbo Stand Message Send
 private void limboStandSetStandHeight(int _standHeight)
 {
     OscMessage msg = new OscMessage(limboStandIP, "/stand");
     msg.Append(_standHeight);
     msg.Send(limboStandIP);
 }
コード例 #59
0
ファイル: TuioKinect.cs プロジェクト: intuilab/KinectIA
        private OscMessage GetSequenceMessage()
        {
            OscMessage msg = new OscMessage(_ipEndPoint, _cursorAddressPattern);

            msg.Append("fseq");
            msg.Append((Int32)_currentFrame);

            return msg;
        }
コード例 #60
0
        //Return an OSC bundle for skeleton index provided
        /*
        OscBundle skeletonToOSCBundle(Skeleton s, int index)
        {
            Skeleton2DdataCoordEventArgs e = Skeleton2DDataExtract.skeletonToSkeleton2DdataCoordEventArgs(s, index);
            return skeleton2DdataCoordEventArgsToOSCBundle(e);
        }
         */

        OscBundle skeleton2DdataCoordEventArgsToOSCBundle(Skeleton2DdataCoordEventArgs e)
        { 
            //Bundles are collections of messages
            OscBundle bundle = new OscBundle(transmitter_ipendpoint);
            //Messages are like packets, label with their type by method name
            OscMessage message = new OscMessage(transmitter_ipendpoint, SKELETON_METHOD);
            //Both bundles and messages can be nested
            //Must have at least one bundle and on message

            //Send the whole skeleton
            //Send packet number
            message.Append(sent_bundles);
            //Debug.WriteLine("Sent bundle: " + sent_bundles);
            //Send the index
            message.Append(e.index);
            //Then append each point in order, x then y
            int num_points = e._points.Count();
            for (int i = 0; i < num_points; i++)
            {
                Point normalized_point = normalize_skeleton_point(e._points[i]);
                message.Append((float)normalized_point.X);
                message.Append((float)normalized_point.Y);
            }
            message.Append(kinect_id); //#19
            //There are 19 things appended to this message. If you add more,
            //you must change the numSkeletonOSCArgs in the c++ code

            bundle.Append(message);
            return bundle;
        }