Ejemplo n.º 1
0
        public void SendFirst(float value)
        {
            var message = new OSCMessage(_firstSlider, OSCValue.Float(value));

            Transmitter.Send(message);
            TransmitterTextFirst.text = value.ToString();
        }
        // IEnumerator SmoothValue(Slider slider, float target)
        // {
        //     float journey = 0f;
        //     float origin = slider.value;
        //     float duration = 1.0f;
        //     while (journey <= duration)
        //     {
        //         journey = journey + Time.deltaTime;
        //         float percent = Mathf.Clamp01(journey / duration);
        //         // description: float interpolated result between startValue and endValue = Vector3.Lerp(float startValue, float endValue, float interpolation value between the two floats)
        //         slider.value = Mathf.Lerp(origin, target, percent);
        //         yield return null;
        //     }
        // }

        protected virtual void Update()
        {
            if (color_toilette != prevLed_toilette_Color)
            {
                // print (color_toilette);
                // DMXData[port_led_toilette] = (byte)(color_toilette.r * masterfader_toilette_ui.value * 255);


                var message = new OSCMessage("/1/driveLight");
                message.AddValue(OSCValue.Float((float)(color_toilette.r * masterfader_toilette_ui.value)));

                // ));

                // Send message
                _transmitter_toilette.Send(message);



                // see color also on an UI element in scene
                softwareLight_toilette_gui.GetComponent <Image>().color = new Color(
                    color_toilette.r,
                    color_toilette.r,
                    color_toilette.r,
                    masterfader_toilette_ui.value);

                prevLed_toilette_Color = color_toilette;
            }
        }
Ejemplo n.º 3
0
    public void PlaySound(string soundName)
    {
        // Find sound
        Sound s = Array.Find(sounds, sound => sound.soundName == soundName);

        if (s == null)
        {
            Debug.LogWarning("Sound '" + soundName + "' not found!");
            return;
        }

        if (currentIndex + 1 <= maxIndex)
        {
            currentIndex += 1;
        }
        else
        {
            currentIndex = 0;
        }

        // Play sound
        // Create message
        var message = new OSCMessage("/playSound");

        // Populate values.
        message.AddValue(OSCValue.Float((float)currentIndex));
        message.AddValue(OSCValue.String("useless"));
        message.AddValue(OSCValue.String(s.absolutePath)); // filename
        message.AddValue(OSCValue.Float(s.volume));        // volume
        message.AddValue(OSCValue.Float(s.pitch));         // pitch
        // Send message
        _transmitter.Send(message);
    }
Ejemplo n.º 4
0
        public void SendOSCMessage(string key, bool value)
        {
            string     address = $"/{TabletName}{key}";
            OSCMessage msg     = new OSCMessage(address, value, false);

            oscTransmitter.Send(msg);
        }
Ejemplo n.º 5
0
        protected virtual void Start()
        {
            var message = new OSCMessage(Address);

            message.AddValue(OSCValue.String("Hello, world!"));

            Transmitter.Send(message);
        }
        protected virtual void Start()
        {
            var message = new OSCMessage(Address);

            message.AddValue(OSCValue.Int(440));
            Transmitter.Send(message);
            StartCoroutine(End(3));
            StartCoroutine(Wind(3));
        }
        public void SendCorrectMessage()
        {
            var message = new OSCMessage(_address);

            message.AddValue(OSCValue.String("Correct Message"));
            message.AddValue(OSCValue.Int(137));
            message.AddValue(OSCValue.Bool(true));
            message.AddValue(OSCValue.Bool(true));

            Transmitter.Send(message);
        }
    //Ready
    public void SendMovement(float value)
    {
        Debug.Log("Sending Movement Message: " + value);
        _transmitter_control.RemoteHost = serverIP;
        OSCMessage message = new OSCMessage(_osc_control);

        message.AddValue(OSCValue.String(localIP));
        message.AddValue(OSCValue.Float(value));

        _transmitter_control.Send(message);
    }
    //Ready
    public void SendClient()
    {
        Debug.Log("Sending Client Message");

        OSCMessage message = new OSCMessage(_osc_network_data);

        message.AddValue(OSCValue.String(deviceName));
        message.AddValue(OSCValue.String(localIP));
        message.AddValue(OSCValue.Int(modelID));
        message.AddValue(OSCValue.Int(teamID));
        message.AddValue(OSCValue.Bool(ready));

        _transmitter.Send(message);
    }
Ejemplo n.º 10
0
        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            try
            {
                for (int i = 0; i < SpreadMax; i++)
                {
                    if (FInDo[i])
                    {
                        var msg = new OSCMessage("/live/send");
                        msg.Append((int)FInTrack[i]);

                        msg.Append((int)FInSend[i]);

                        msg.Append((float)FInLevel[i]);
                        client.Send(msg);
                    }
                }
                FOutStatus[0] = "OK";
            }
            catch (Exception e)
            {
                FOutStatus[0] = e.Message;
            }
            //FLogger.Log(LogType.Debug, "hi tty!");
        }
    public void changeRoomViaRoomConnection(string userInput)
    {
        Room newRoom = findRoomConnection(userInput);
        var  message = new OSCMessage(myOscAddress);

        if (newRoom == null)
        {
            return;
        }

        if (newRoom.isInitialized == false)
        {
            newRoom.initializeRuntimeVariables();
        }

        string raumFull   = newRoom.ToString();
        string raum_short = raumFull.Substring(0, raumFull.Length - 6);

        message.AddValue(OSCValue.String(raum_short));
        globalTransmitter.Send(message); // the global OSC Manager's transmitter sends message
        Debug.Log("from: " + currentRoom + "going to " + raum_short);

        currentRoom = newRoom;
        actionHandler.executeActions(currentRoom, currentRoom.roomEntryActions);
        printCurrentRoomEntryText();
    }
Ejemplo n.º 12
0
    public void Send(string ip, OSCPacket packet)
    {
        _transmiter.RemoteHost = ip;
        _transmiter.RemotePort = replyPort;

        _transmiter.Send(packet);
    }
Ejemplo n.º 13
0
        void SendFloatMessages(string _address, float _parameter)
        {
            var message = new OSCMessage(_address);

            message.AddValue(OSCValue.Float(_parameter));
            Transmitter.Send(message);
        }
Ejemplo n.º 14
0
    public void SendSamples(List <Point> samplePoints, string separatorString)
    {
        OSCValue[] messageStrings = new OSCValue[samplePoints.Count];
        for (int index = 0; index < samplePoints.Count; index++)
        {
            messageStrings[index] = OSCValue.String(samplePoints[index].audiokey);
        }

        OSCMessage message = new OSCMessage(samplesFilter);

        message.AddValue(OSCValue.Array(messageStrings));

        Debug.Log("Sent: " + message.ToString());

        transmitter.Send(message);
    }
Ejemplo n.º 15
0
        protected virtual void Start()
        {
            // Register receive callback.
            Receiver.Bind(_address, MessageReceived);

            // Create message
            var message = OSCMessage.Create(_address);

            // Create array
            var array = OSCValue.Array();

            array.AddValue(OSCValue.Int(1)); // You can use AddValue(OSCValue) method only with OSCValue what stored Array type.
            array.AddValue(OSCValue.Float(2.5f));
            array.AddValue(OSCValue.Color(Color.red));

            // You can store another array inside array.
            // Warning! OSCValue with "Array" type cannot store itself. It can do infinite loop.
            var secondArray = OSCValue.Array();

            secondArray.AddValue(OSCValue.String("This array..."));
            secondArray.AddValue(OSCValue.String("...inside another array!"));
            array.AddValue(secondArray);

            // Add array in message
            message.AddValue(array);

            // Send message
            Transmitter.Send(message);
        }
Ejemplo n.º 16
0
        private void PinChanged(object sender, EventArgs e)
        {
            if ((FOSCTransmitter != null) && FFeedback[0])
            {
                var pin     = sender as IPin2;
                var pinPath = pin.ParentNode.GetNodePath(false) + "/" + pin.Name;

                var bundle  = new OSCBundle();
                var message = new OSCMessage(pinPath);

                for (int i = 0; i < pin.SliceCount; i++)
                {
                    message.Append(pin[i]);
                }

                bundle.Append(message);

                try
                {
                    FOSCTransmitter.Send(bundle);
                }
                catch (Exception ex)
                {
                    FLogger.Log(LogType.Warning, "PinServer: " + ex.Message);
                }
            }
        }
Ejemplo n.º 17
0
    void Update()
    {
        if (sending)
        {
            Accelerometer = new Vector3(UnityEngine.Random.Range(-10.0f, 10.0f), UnityEngine.Random.Range(-10.0f, 10.0f), UnityEngine.Random.Range(-10.0f, 10.0f));
            Gyroscope     = new Vector3(UnityEngine.Random.Range(-10.0f, 10.0f), UnityEngine.Random.Range(-10.0f, 10.0f), UnityEngine.Random.Range(-10.0f, 10.0f));
            Magnetometer  = new Vector3(UnityEngine.Random.Range(-10.0f, 10.0f), UnityEngine.Random.Range(-10.0f, 10.0f), UnityEngine.Random.Range(-10.0f, 10.0f));


            for (int i = 0; i < 15; i++)
            {
                var message = new OSCMessage("/tuna" + i);

                message.AddValue(OSCValue.Float(Accelerometer.x));
                message.AddValue(OSCValue.Float(Accelerometer.y));
                message.AddValue(OSCValue.Float(Accelerometer.z));

                message.AddValue(OSCValue.Float(Gyroscope.x));
                message.AddValue(OSCValue.Float(Gyroscope.y));
                message.AddValue(OSCValue.Float(Gyroscope.z));

                message.AddValue(OSCValue.Float(Magnetometer.x));
                message.AddValue(OSCValue.Float(Magnetometer.y));
                message.AddValue(OSCValue.Float(Magnetometer.z));

                Transmitter.Send(message);
            }
        }
    }
Ejemplo n.º 18
0
 private void Send(string address, OSCValue value)
 {
     if (Transmitter != null)
     {
         Transmitter.Send(address, value);
     }
 }
Ejemplo n.º 19
0
    protected void OnTriggerEnter(Collider collider)
    {
        var message = new OSCMessage(transmitterAddress);

        message.AddValue(OSCValue.String("Hello, world!"));

        transmitter.Send(message);
    }
Ejemplo n.º 20
0
        protected virtual void Start()
        {
            var message = new OSCMessage(Address);

            message.AddValue(OSCValue.Impulse());

            Transmitter.Send(message);
        }
Ejemplo n.º 21
0
    private void SendFloat(OSCTransmitter _transmitter, string address, float value)
    {
        //Send OSC message
        var message = new OSCMessage(string.Format("{0}", address));

        // Populate values.
        message.AddValue(OSCValue.Float((float)value));
        _transmitter.Send(message);
    }
Ejemplo n.º 22
0
    private void SendBang(OSCTransmitter _transmitter, string address)
    {
        //Send OSC message
        var message = new OSCMessage(string.Format("{0}", address));

        // Populate values.
        message.AddValue(OSCValue.Impulse());
        _transmitter.Send(message);
    }
Ejemplo n.º 23
0
        void SendOSCofShowingPlate()
        {
            var message = new OSCMessage(showPlateOscAddress);

            message.AddValue(OSCValue.Int(showPlateNotes[Random.Range(0, 3)]));
            message.AddValue(OSCValue.Int(120));
            message.AddValue(OSCValue.Int(1));

            oSCTransmitter.Send(message);
        }
    void Start()
    {
        helpers   = GameObject.Find("Helpers").GetComponent <Helpers>();
        numShapes = shapes.Length;
        //Debug.Log (shapes[1]);

        message     = new OSCMessage("/shape", "1");
        transmitter = new OSCTransmitter("127.0.0.1", sendport);
        transmitter.Send(message);
    }
Ejemplo n.º 25
0
        protected override void DoFeedBack(TodoVariable var, TodoOscInput source)
        {
            if (this.enableOutput)
            {
                OSCMessage msg = new OSCMessage(source.Message);
                msg.Append(Convert.ToSingle(var.Value));

                OSCTransmitter tr = new OSCTransmitter(this.remoteip, this.remoteport);
                tr.Send(msg);
            }
        }
Ejemplo n.º 26
0
    public void SendFloat(string path, params float[] data)
    {
        OSCMessage packet = new OSCMessage(path);

        foreach (float val in data)
        {
            packet.Append(val);
        }
        transmit.Send(packet);
        Debug.Log("Sent data! -" + data);
    }
Ejemplo n.º 27
0
        public void Send()
        {
            var message = new OSCMessage(transmitterAddress);

            if (FillMessage(message))
            {
                if (transmitter != null)
                {
                    transmitter.Send(message);
                }
            }
        }
Ejemplo n.º 28
0
    // Update is called once per frame
    void Update()
    {
        // Create message
        var message = new OSCMessage("/message/address");

        // Populate values.
        message.AddValue(OSCValue.String("Hello, world!"));

        // Send message
        _transmitter.Send(message);
        Debug.Log("Message sent !");
    }
Ejemplo n.º 29
0
    // Update is called once per frame
    void Update()
    {
        float difference = predictedpos - transform.position.y;

        //get axis from either Input system or OSC
        if (difference > buffer)
        {
            axis = 1;
        }
        else if (difference < -buffer)
        {
            axis = -1;
        }
        else if (difference < buffer && difference > -buffer)
        {
            axis = 0;
        }


        float move = axis * Time.deltaTime * speed;

        if (transform.position.y < GameManager.bottomLeft.y + height / 2 && move < 0)
        {
            move = 0;
        }

        if (transform.position.y > GameManager.topRight.y - height / 2 && move > 0)
        {
            move = 0;
        }

        transform.Translate(move * Vector2.up);


        //Send OSC message
        var message = new OSCMessage(string.Format("/paddle/pos/y", input));

        // Populate values.
        message.AddValue(OSCValue.Float(transform.position.y));

        if (isRight)
        {
            paddleLeftPos = GameObject.Find("PaletteLeft").GetComponent <Transform>();
            if (paddleLeftPos != null)
            {
                message.AddValue(OSCValue.Float(paddleLeftPos.position.y));
            }
        }
        _transmitter.Send(message);


        calVelocity();
    }
Ejemplo n.º 30
0
        private void SendVector(string address, Vector3 vector)
        {
            var message = new OSCMessage(address);

            message.AddValue(OSCValue.Float(vector.x));
            message.AddValue(OSCValue.Float(vector.y));
            message.AddValue(OSCValue.Float(vector.z));

            if (Transmitter != null)
            {
                Transmitter.Send(message);
            }
        }