Send() public method

Sends a list of OSC Messages. Internally takes the OscMessage objects and serializes them into a byte[] suitable for sending to the PacketExchange.
public Send ( ArrayList oms ) : void
oms ArrayList The OSC Message to send.
return void
Exemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            OscMessage oscMS = new OscMessage();

            oscMS.Address = "/analogin/7/value";
            osc.Send(oscMS);
        }
    void Update()
    {
        OscMessage msg;

        msg = Osc.StringToOscMessage("/camhead "
                                     + camhead.transform.position.x + " "
                                     + camhead.transform.position.y + " "
                                     + camhead.transform.position.z + " "
                                     + camhead.transform.rotation.x + " "
                                     + camhead.transform.rotation.y + " "
                                     + camhead.transform.rotation.z
                                     );
        osc.Send(msg);
        msg = Osc.StringToOscMessage("/ctrlleft "
                                     + ctrlleft.transform.position.x + " "
                                     + ctrlleft.transform.position.y + " "
                                     + ctrlleft.transform.position.z + " "
                                     + ctrlleft.transform.rotation.x + " "
                                     + ctrlleft.transform.rotation.y + " "
                                     + ctrlleft.transform.rotation.z
                                     );
        osc.Send(msg);
        msg = Osc.StringToOscMessage("/ctrlright "
                                     + ctrlright.transform.position.x + " "
                                     + ctrlright.transform.position.y + " "
                                     + ctrlright.transform.position.z + " "
                                     + ctrlright.transform.rotation.x + " "
                                     + ctrlright.transform.rotation.y + " "
                                     + ctrlright.transform.rotation.z
                                     );
        osc.Send(msg);
    }
Exemplo n.º 3
0
    public static void SingleServo(int iShield, int jServo, int MaxValue)
    {
        string     msg  = "/unity/single ";
        OscMessage oscM = Osc.StringToOscMessage(msg);

        oscM.Values.Add(iShield);
        oscM.Values.Add(jServo);
        oscM.Values.Add(MaxValue);
        handler.Send(oscM);
    }
    void Update()
    {
        string[] soundsOnOff = new string [4];

        if (soundObject1 != null)
        {
            SoundPositions(soundAlgorithm, 1, soundObject1, soundObject1Level);
            soundsOnOff[0] = "1";
        }
        else
        {
            soundsOnOff[0] = "0";
        }

        if (soundObject2 != null)
        {
            SoundPositions(soundAlgorithm, 2, soundObject2, soundObject2Level);
            soundsOnOff[1] = "1";
        }
        else
        {
            soundsOnOff[1] = "0";
        }

        if (soundObject3 != null)
        {
            SoundPositions(soundAlgorithm, 3, soundObject3, soundObject3Level);
            soundsOnOff[2] = "1";
        }
        else
        {
            soundsOnOff[2] = "0";
        }

        if (soundObject4 != null)
        {
            SoundPositions(soundAlgorithm, 4, soundObject4, soundObject4Level);
            soundsOnOff[3] = "1";
        }
        else
        {
            soundsOnOff[3] = "0";
        }

        if (soundAlgorithm == 0)
        {
            ListenerAndSpace();
        }

        SourceLooping();

        OscMessage onOff   = Osc.StringToOscMessage("/onOff " + soundsOnOff[0] + " " + soundsOnOff[1] + " " + soundsOnOff[2] + " " + soundsOnOff[3]);
        OscMessage srcName = Osc.StringToOscMessage("/sourceName " + soundName1 + " " + soundName2 + " " + soundName3 + " " + soundName4);

        oscHandler.Send(onOff);
        oscHandler.Send(srcName);
    }
Exemplo n.º 5
0
    public void Send(string prefix)
    {
        string     message = prefix + myHeadset.message;
        OscMessage oscM    = Osc.StringToOscMessage(message);

        //Debug.Log(myHeadset.message);
        oscHandler.Send(oscM);
    }
    // Update is called every frame, if the MonoBehaviour is enabled.
    void Update()
    {
        //Debug.LogWarning("time = " + Time.time);

        OscMessage oscM = Osc.StringToOscMessage("/test1 TRUE 23 0.501 bla");

        oscHandler.Send(oscM);
    }
Exemplo n.º 7
0
    // Update is called every frame, if the MonoBehaviour is enabled.
    void Update()
    {
        //Debug.LogWarning("time = " + Time.time);

        OscMessage oscM = Osc.StringToOscMessage("/1/push1");

        oscHandler.Send(oscM);
    }
Exemplo n.º 8
0
    void Update()
    {
        string     message = "";
        OscMessage oscM    = null;

        oscM = Osc.StringToOscMessage("/" + message);
        handler.Send(oscM);
    }
Exemplo n.º 9
0
    /// <summary>
    /// Update is called every frame, if the MonoBehaviour is enabled.
    /// </summary>
    void Update()
    {
        //Debug.LogWarning("time = " + Time.time);

        OscMessage oscM = Osc.StringToOscMessage("/wek/inputs " + Input.GetAxis("Vertical") + " " + Input.GetAxis("Horizontal"));

        Debug.Log("/wek/inputs " + Input.GetAxis("Vertical") + " " + Input.GetAxis("Horizontal"));
        oscHandler.Send(oscM);
    }
Exemplo n.º 10
0
    public void SendOSCMessage(string data)
    {
        // data is a string with the addr followed by the message parms seperated by " "'s
        // example: "/test1 TRUE 23 0.501 bla"
        Debug.Log("sending: " + data);
        OscMessage oscM = Osc.StringToOscMessage(data);

        oscHandler.Send(oscM);
    }
Exemplo n.º 11
0
    public void SendOscMessage(string content)
    {
        string text = string.IsNullOrEmpty(address) ? content : address + " " + content;

        OscMessage msg = Osc.StringToOscMessage(text);

        oscHandler.Send(msg);

        SenderPrinter.Invoke(text);
    }
Exemplo n.º 12
0
    void Start()
    {
        UDPPacketIO udp = GetComponent <UDPPacketIO> ();

        udp.init(remoteIp, sendToPort, listenerPort);
        osc = GetComponent <Osc> ();
        osc.init(udp);
        OscMessage msg = Osc.StringToOscMessage("/startup");

        osc.Send(msg);
    }
Exemplo n.º 13
0
    /*
    void OnDisable()
    {
        // close OSC UDP socket
        Debug.Log("closing OSC UDP socket in OnDisable");
        oscHandler.Cancel();
        oscHandler = null;
    }*/
    // Start is called just before any of the Update methods is called the first time.
    void Start()
    {
        UDPPacketIO udp = GetComponent<UDPPacketIO>();
        udp.init(remoteIp, 9000, 8000);

        oscHandler = GetComponent<Osc>();
        oscHandler.init(udp);

        if (Application.loadedLevelName != "Date") {
            print("WHAT");
            OscMessage oscM = Osc.StringToOscMessage ("/2");
            oscHandler.Send (oscM);
        }
        //oscHandler.SetAddressHandler("/hand1", Example);
    }
Exemplo n.º 14
0
 void Update()
 {
     _emg01.text = str3[0];
     _emg02.text = str3[1];
     _emg03.text = str3[2];
     _emg04.text = str3[3];
     _emg05.text = str3[4];
     _emg06.text = str3[5];
     _emg07.text = str3[6];
     _emg08.text = str3[7];
     if (Input.GetKeyDown(KeyCode.A))
     {
         handler.Send(Osc.StringToOscMessage("/imu"));
         print("A key was pressed");
     }
 }
Exemplo n.º 15
0
    /// <summary>
    /// Update is called every frame, if the MonoBehaviour is enabled.
    /// </summary>
    void Update()
    {
        //Debug.LogWarning("time = " + Time.time);

        //OscMessage oscM = Osc.StringToOscMessage("/test1 TRUE 23 0.501 bla");
        //oscHandler.Send(oscM);

        OscMessage msgToSend = new OscMessage();

        msgToSend.Address = "/wek/inputs";
        //msgToSend.Values.Add(Input.mousePosition.x);
        //msgToSend.Values.Add(Input.mousePosition.y);

        msgToSend.Values.Add(8);

        oscHandler.Send(msgToSend);
    }
Exemplo n.º 16
0
    private void OnTripodViewUpdate(Texture2D texture)
    {
        Color[]    colors  = texture.GetPixels(0, 0, texture.width, texture.height);
        OscMessage message = new OscMessage();

        message.Address = RemoteOscAddress;

        foreach (Color color in colors)
        {
            message.Values.Add(color.r);
            message.Values.Add(color.g);
            message.Values.Add(color.b);
        }

        Debug.Log("Sending osc message with length: " + message.Values.Count + " to " + RemoteHost + ":" + RemotePort);
        handler.Send(message);
    }
Exemplo n.º 17
0
////////////////////////////////////////////////////////////////////
    void Update()
    {
        // Check if the state of the leds has changed
        if (wasLed1On != led1On || wasLed2On != led2On)
        {
            hasLedStatusChanged = true;
            currentChangeSignal = 0;
        }

        // If the status has changed, send a specified number of OSC
        // messages to inform openFrameworks of the change
        if (hasLedStatusChanged)
        {
            if (currentChangeSignal < numberChangeSignals)
            {
                OscMessage m = new OscMessage();
                m.Address = "/unity/state";
                ArrayList state = new ArrayList();
                if (led1On && led2On)
                {
                    state.Add(0);
                }
                else if (led1On && !led2On)
                {
                    state.Add(1);
                }
                else if (!led1On && led2On)
                {
                    state.Add(2);
                }
                else if (!led1On && !led2On)
                {
                    state.Add(3);
                }
                m.Values = state;
                handler.Send(m);
            }
            currentChangeSignal++;
        }

        wasLed1On = led1On;
        wasLed2On = led2On;
    }
Exemplo n.º 18
0
    /// <summary>
    /// Start is called just before any of the Update methods is called the first time.
    /// </summary>
    void Start()
    {
        UDPPacketIO udp = GetComponent <UDPPacketIO>();

        udp.init(remoteIp, sendToPort, listenerPort);

        oscHandler = GetComponent <Osc>();
        oscHandler.init(udp);

        oscHandler.SetAddressHandler("/wek/inputs", Example);

        // Copy of code from Leap Motion
        OscMessage msg = new OscMessage();

        msg.Address = "/wek/inputs";
        msg.Values.Add(8);
        msg.Values.Add(10);

        oscHandler.Send(msg);
    }
Exemplo n.º 19
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            //handler.Send(Osc.StringToOscMessage("/surfaces/Quad1/red 0.1"));
            //handler.Send(Osc.StringToOscMessage("/surfaces/Quad/green 0.5"));
            //handler.Send(Osc.StringToOscMessage("/surfaces/Quad1/green 0.1"));
            //handler.Send(Osc.StringToOscMessage("/surfaces/Quad1/blue 0.5"));
            //handler.Send(Osc.StringToOscMessage("/surfaces/Quad1/color 0.5,0.5,0.5,0.5"));
            //handler.Send("/surfaces/Quad 1/red 0.5");

            OscMessage message = new OscMessage();
            message.Address = "/surfaces/Quad 1/color";
            //message.Values.Add(0.5f);
            message.Values.Add(new Color(255, 125, 0, 255));


            handler.Send(message);
            print("A key was pressed");
        }
    }
Exemplo n.º 20
0
    public void AllMessageHandler(OscMessage message)
    {
        Debug.Log("received message");
        //handler.Send("/message received");

        string     msgString = Osc.OscMessageToString(message);     //the message and value combined
        OscMessage oscM      = Osc.StringToOscMessage(msgString);

        handler.Send(oscM);
        Debug.Log(msgString);         //log the message and values coming from OSC
        string msgValue = msgString.Split("/"[0])[1];

        //Debug.Log(msgValue);
        //FUNCTIONS YOU WANT CALLED WHEN A SPECIFIC MESSAGE IS RECEIVED
        switch (msgValue)
        {
        case "1":
            //Debug.Log('we have a match');
            dim = orig_dim;
            break;

        case "2":
            //Debug.Log('we have a match');
            dim  = orig_dim;
            dim *= 2;
            break;

        case "3":
            //Debug.Log('we have a match');
            dim  = orig_dim;
            dim *= 3;
            break;

        default:
            Debug.Log("we dont have a match");
            break;
        }
    }
Exemplo n.º 21
0
 public void send(OscMessage oscM)
 {
     oscHandler.Send(oscM);
 }
Exemplo n.º 22
0
    /// <summary>
    /// Send out OSC message to be played by Pure Data.
    /// </summary>
    public void PlaySoundOSC(string oscString)
    {
        OscMessage oscM = Osc.StringToOscMessage(oscString);

        oscHandler.Send(oscM);
    }
    /*
     * an example OSC address string would look like:
     * /servo/1/position
     *
     * The second part of an OSC message is a list of values to be sent to the specified address: integers, floats, and strings.
     * The values in this list are simply separated by spaces, and the list can be arbitrarily long.
     * Most devices on the Make Controller Kit expect only one value.
     *
     * /servo/1/position 512
     */

    public void oscSend(string text)
    {
        OscMessage oscM = Osc.StringToOscMessage(text);

        handler.Send(oscM);
    }
Exemplo n.º 24
0
 public void sendData(string data)
 {
     oscHandler.Send(Osc.StringToOscMessage(data));
 }
Exemplo n.º 25
0
 public void Send(string id, string content)
 {
     _handler.Send(Osc.StringToOscMessage("/" + id + " " + content));
 }
Exemplo n.º 26
0
    void sendCollision(Transform hit)
    {
        OscMessage oscM = Osc.StringToOscMessage("/cube/collision " + transform.position.x + " " + transform.position.y + " " + transform.position.z);

        oscHandler.Send(oscM);
    }
Exemplo n.º 27
0
 void sendMessage(string message)
 {
     oscHandler.Send(Osc.StringToOscMessage(message));
 }
Exemplo n.º 28
0
    public void SendNoteOn(int noteNum)
    {
        OscMessage oscM = Osc.StringToOscMessage("/noteon " + noteNum + " 120");

        oscHandler.Send(oscM);
    }
Exemplo n.º 29
0
    public void SetGazedAt(bool gazedAt)
    {
        OscMessage oscM = Osc.StringToOscMessage("/looking 1.0");

        oscHandler.Send(oscM);
    }
Exemplo n.º 30
0
    private void SendMessage(string m)
    {
        OscMessage oscM = Osc.StringToOscMessage(m);

        handler.Send(oscM);
    }
Exemplo n.º 31
0
 void Start()
 {
     preTime = Time.time;
     osc.Send(Osc.StringToOscMessage("/begin/ " + 1));
     playerBody = player.GetComponent <Rigidbody>();
 }