Example #1
0
        void Update()
        {
            // Create a test value.
            Vector3 value = Random.insideUnitSphere;

            // Use SetAsBlob to write a Vector2 value in a byte blob.
            _message.SetBlob(0, value);

            // Send.
            _oscOut.Send(_message);

            // Log.
            Debug.Log("Sending: " + value + "\n");
        }
        void Update()
        {
            // Create a test value.
            Quaternion value = Random.rotation;

            // Use SetAsBlob to write a Quaternion value in a byte blob.
            _message.SetBlob(0, value);

            // Send.
            _oscOut.Send(_message);

            // Log.
            Debug.Log("Sending: " + value + "\n");
        }
Example #3
0
        void Update()
        {
            // Create a test value.
            Vector4 value = new Vector4(Random.value, Random.value, Random.value, Random.value);

            // Use SetAsBlob to write a Vector4 value in a byte blob.
            _message.SetBlob(0, value);

            // Send.
            _oscOut.Send(_message);

            // Log.
            Debug.Log("Sending: " + value + "\n");
        }
Example #4
0
        void Update()
        {
            // Create a bundle, add two messages with seperate addresses and values, then send.
            OscBundle  bundle   = new OscBundle();
            OscMessage message1 = new OscMessage(address1, Random.value);
            OscMessage message2 = new OscMessage(address2, Random.value);

            bundle.Add(message1);
            bundle.Add(message2);
            oscOut.Send(bundle);

            // Update UI.
            sendLabel1.text = message1.ToString();
            sendLabel2.text = message2.ToString();
        }
        void Start()
        {
            // Ensure that we have a OscOut component.
            if (!_oscOut)
            {
                _oscOut = gameObject.AddComponent <OscOut>();
            }

            // Prepare for sending messages locally on this device on port 7000.
            _oscOut.Open(7000);

            // ... or, alternatively target a remote devices with an IP Address.
            //oscOut.Open( 7000, "192.168.1.101" );

            // If you want to send a single value then you can use this one-liner.
            _oscOut.Send(address1, Random.value);

            // If you want to send a message with multiple values, then you
            // need to create a message, add your values and send it.
            // Always cache messages you create, so that you can reuse them.
            _message2 = new OscMessage(address2);
            _message2.Add(Time.frameCount).Add(Time.time).Add(Random.value);
            _oscOut.Send(_message2);
        }
Example #6
0
        void Update()
        {
            // Update the bundle time tag if you want to.
            _bundle.timeTag = new OscTimeTag(System.DateTime.Now);

            // Update message arguments.
            _message1.Set(0, Random.value);
            _message2.Set(0, Random.value);

            // Send the bundle, containing the two messages.
            _oscOut.Send(_bundle);

            // Log.
            Debug.Log("Send as bundle\n" + _message1 + " AND " + _message2);
        }
        void Update()
        {
            // Update test text content.
            int  tempI    = Random.Range(0, _sendText.Length);
            char tempChar = _sendText[tempI];

            _sendText = _sendText.Remove(tempI, 1);
            _sendText = _sendText.Insert(Random.Range(0, _sendText.Length), tempChar.ToString());

            // Use SetAsBlob to write a utf-8 string to a byte blob.
            _message.SetBlob(0, System.Text.Encoding.UTF8, _sendText);

            // Send.
            _oscOut.Send(_message);

            // Log.
            Debug.Log("Sending: " + _sendText + "\n");
        }
Example #8
0
        void Update()
        {
            // Update test list with new content.
            _sendFloats.Clear();
            int randomCount = Random.Range(1, 5);

            for (int i = 0; i < randomCount; i++)
            {
                _sendFloats.Add(Random.value);
            }

            // Use SetAsBlob to write list of floats to a byte blob.
            _message.SetBlob(0, _sendFloats);

            // Send.
            _oscOut.Send(_message);

            // Log.
            Debug.Log("Sending: " + ListToString(_sendFloats) + "\n");
        }
        void Start()
        {
            // Ensure that we have a OscOut component.
            if (!_oscOut)
            {
                _oscOut = gameObject.AddComponent <OscOut>();
            }

            // Prepare for sending messages locally on this device on port 7000.
            _oscOut.Open(12300);

            // ... or, alternatively target remote devices with a IP Address.
            //oscOut.Open( 7000, "192.168.1.101" );

            // If you want to send a single value then you can use this one-liner.
            _oscOut.Send("/3DTI-OSC", "play");

            // If you want to send a message with multiple values, then you
            // need to create a message, add your values and send it.
            // Always cache the messages you create, so that you can reuse them.
        }
Example #10
0
 void ReportOsc()
 {
     // in the voids DSP, /id comes after the specific /void/polyname/id; this is because there are independent
     // polys per independent void sound, and wanted to mute the processing on each of these independently
     // and that's how the routing works then
     if (aud_geyserOnEvent == true)
     {
         oscOutScript.Send("/void/geyser/" + (self_id + 1) + "/on", aud_geyserOnEvent);
         // oscOutScript.Send( "/void/geyser/" + ( self_id + 1 ) + "/rate", particlesRate );
         oscOutScript.Send("/void/geyser/" + (self_id + 1) + "/lfo/dynamics", aud_currentGeyser_lfoDynamics);
         oscOutScript.Send("/void/geyser/" + (self_id + 1) + "/delay", aud_currentGeyser_delayMode);
         oscOutScript.Send("/void/geyser/" + (self_id + 1) + "/amp/global", mx_ampGlobal);
     }
     if (geyserFading == true)
     {
         oscOutScript.Send("/void/geyser/" + (self_id + 1) + "/amp/fading", aud_geyserFading_globalAmp);
     }
     if (aud_geyserOffEvent == true)
     {
         oscOutScript.Send("/void/geyser/" + (self_id + 1) + "/off", aud_geyserOffEvent);
     }
 }
Example #11
0
 // data[0] must always be the adress ; adress is taken from https://plugins.iem.at/docs/osc/#multiencoder
 // data[1] must always be the value to send
 public void SendOSCMessageToClient(string[] data)
 {
     //Debug.Log("Sent a Message to the Client: " + ipadress + ":" + port + " adress: "+data[0]+" message: "+ data[1]);
     oscOut.Send(data[0], float.Parse(data[1]));
 }
Example #12
0
    void ReportOscStart()
    {
        // stupid Vector2s:
        osc_falling_transpRange.Add(aud_falling_transpRange[0]);
        osc_falling_transpRange.Add(aud_falling_transpRange[1]);
        osc_falling_delay_timeRange.Add(mx_falling_delay_timeRange[0]);
        osc_falling_delay_timeRange.Add(mx_falling_delay_timeRange[1]);
        osc_falling_delay_lineDurRange.Add(mx_falling_delay_lineDurRange[0]);
        osc_falling_delay_lineDurRange.Add(mx_falling_delay_lineDurRange[1]);
        osc_curving_casetopRolly_delay_timeRange.Add(mx_curving_casetopRolly_delay_timeRange[0]);
        osc_curving_casetopRolly_delay_timeRange.Add(mx_curving_casetopRolly_delay_timeRange[1]);
        osc_curving_casetopRolly_delay_lineDurRange.Add(mx_curving_casetopRolly_delay_lineDurRange[0]);
        osc_curving_casetopRolly_delay_lineDurRange.Add(mx_curving_casetopRolly_delay_lineDurRange[1]);
        osc_curving_figure8s_1_transpRange.Add(aud_curving_figure8s_1_transpRange[0]);
        osc_curving_figure8s_1_transpRange.Add(aud_curving_figure8s_1_transpRange[1]);
        osc_curving_figure8s_1_delay_timeRange.Add(mx_curving_figure8s_1_delay_timeRange[0]);
        osc_curving_figure8s_1_delay_timeRange.Add(mx_curving_figure8s_1_delay_timeRange[1]);
        osc_curving_figure8s_1_delay_lineDurRange.Add(mx_curving_figure8s_1_delay_lineDurRange[0]);
        osc_curving_figure8s_1_delay_lineDurRange.Add(mx_curving_figure8s_1_delay_lineDurRange[1]);
        osc_curving_figure8s_2_transpRange.Add(aud_curving_figure8s_2_transpRange[0]);
        osc_curving_figure8s_2_transpRange.Add(aud_curving_figure8s_2_transpRange[1]);
        osc_curving_figure8s_2_delay_timeRange.Add(mx_curving_figure8s_2_delay_timeRange[0]);
        osc_curving_figure8s_2_delay_timeRange.Add(mx_curving_figure8s_2_delay_timeRange[1]);
        osc_curving_figure8s_2_delay_lineDurRange.Add(mx_curving_figure8s_2_delay_lineDurRange[0]);
        osc_curving_figure8s_2_delay_lineDurRange.Add(mx_curving_figure8s_2_delay_lineDurRange[1]);

        oscOutScript.Send("/igniter/" + self_id + "/on", aud_GO_born);
        oscOutScript.Send("/igniter/" + self_id + "/falling/begin", aud_falling_begin);
        oscOutScript.Send("/igniter/" + self_id + "/falling/bufferName", mx_falling_bufferName);
        oscOutScript.Send("/igniter/" + self_id + "/falling/startDur", aud_falling_bufferStartDur);
        oscOutScript.Send(osc_falling_transpRange);
        oscOutScript.Send(osc_falling_delay_timeRange);
        oscOutScript.Send(osc_falling_delay_lineDurRange);
        oscOutScript.Send("/igniter/" + self_id + "/falling/amp/global", aud_falling_globalAmp);

        oscOutScript.Send("/igniter/" + self_id + "/curving/casetopRollyPolly/bufferName", mx_curving_casetopRolly_bufferName);
        oscOutScript.Send("/igniter/" + self_id + "/curving/casetopRollyPolly/startDur", aud_curving_casetopRolly_bufferStartDur);
        oscOutScript.Send(osc_curving_casetopRolly_delay_timeRange);
        oscOutScript.Send(osc_curving_casetopRolly_delay_lineDurRange);
        oscOutScript.Send("/igniter/" + self_id + "/curving/casetopRollyPolly/amp/global", aud_curving_casetopRolly_globalAmp);

        oscOutScript.Send("/igniter/" + self_id + "/curving/figure8s/1/bufferName", mx_curving_figure8s_1_bufferName);
        oscOutScript.Send("/igniter/" + self_id + "/curving/figure8s/1/startDur", aud_curving_figure8s_1_bufferStartDur);
        oscOutScript.Send(osc_curving_figure8s_1_transpRange);
        oscOutScript.Send(osc_curving_figure8s_1_delay_timeRange);
        oscOutScript.Send(osc_curving_figure8s_1_delay_lineDurRange);
        oscOutScript.Send("/igniter/" + self_id + "/curving/figure8s/1/amp/global", aud_curving_figure8s_1_globalAmp);

        oscOutScript.Send("/igniter/" + self_id + "/curving/figure8s/2/bufferName", mx_curving_figure8s_2_bufferName);
        oscOutScript.Send("/igniter/" + self_id + "/curving/figure8s/2/startDur", aud_curving_figure8s_2_bufferStartDur);
        oscOutScript.Send(osc_curving_figure8s_2_transpRange);
        oscOutScript.Send(osc_curving_figure8s_2_delay_timeRange);
        oscOutScript.Send(osc_curving_figure8s_2_delay_lineDurRange);
        oscOutScript.Send("/igniter/" + self_id + "/curving/figure8s/2/amp/global", aud_curving_figure8s_2_globalAmp);

        aud_GO_born       = false;
        aud_falling_begin = false;
    }
Example #13
0
 // osc
 void ReportOscStart()
 {
     oscOut_script.Send("/background/tubes/amp/global", aud_tubes_ampGlobal);
     oscOut_script.Send("/background/noise/amp/global", aud_noise_ampGlobal);
 }
Example #14
0
 public void SendOscMessage(OscEventArgs msg)
 {
     WriteDebug($"Sending OSC: {msg}");
     OscOut.Send(new OscMessage(msg.Address, msg.Args));
 }
 void ReportOscStart()
 {
     oscOut_script.Send("/directionalLight/rotation/range", aud_rotationChange_eulerRange[0], aud_rotationChange_eulerRange[1]);
 }
        // The following methods are meant to be linked to Unity's runtime UI from the Unity Editor.


        public void SendFloat(float value)
        {
            float floatValue = value * 2 - 1;

            oscOut.Send(floatAddress, floatValue);
            floatOutputLabel.text = floatValue.ToString();
        }
 void Update()
 {
     _oscOut.Send(address, Random.value);
 }
Example #18
0
 // data[0] must always be the adress ; adress is taken from https://plugins.iem.at/docs/osc/#multiencoder
 // data[1] must always be the value to send
 public void SendOSCMessageToClient(string[] data)
 {
     oscOut.Send(data[0], float.Parse(data[1]));
 }
Example #19
0
    //******************************
    // OSC out
    void ReportOsc()
    {
        // in the voids DSP, /id comes after the specific /void/polyname/id; this is because there are independent
        // polys per independent void sound, and wanted to mute the processing on each of these independently
        // and that's how the routing works then
        if (aud_voidOpen_click == true)
        {
            oscOutScript.Send("/void/static/" + (self_id + 1) + "/on", aud_voidOpen_click);
            aud_voidOpen_click = false;
        }
        else if (aud_voidClose_click == true)
        {
            // mute all of this void's polys; also, this same method is called in Destroy() because user may destroy GO before it is faded out
            // and before we'd get the voidClose_click
            AllPolysOff();
            aud_voidClose_click = false;
        }
        // else open still and doing shit
        else
        {
            /*
             * oscOutScript.Send( "/void/edgeMoving/" + ( self_id + 1 ) + "/moving",             aud_edgeMoving_moving );
             * if( aud_edgeMoving_moving == true )
             * {
             *  oscOutScript.Send( "/void/edgeMoving/" + ( self_id + 1 ) + "/amp/global",     mx_edgeMoving_ampGlobal );
             * }*/

            if (aud_shakeIt_displacingBegin == true)
            {
                oscOutScript.Send("/void/shakeIt/" + (self_id + 1) + "/on", 1);
                oscOutScript.Send("/void/shakeIt/" + (self_id + 1) + "/amp/global", mx_shakeIt_ampGlobal);
                aud_shakeIt_displacingBegin = false;
            }
            else if (aud_shakeIt_springingEnd == true)
            {
                oscOutScript.Send("/void/shakeIt/" + (self_id + 1) + "/off", 1);
                aud_shakeIt_springingEnd = false;
            }

            if (aud_static_oneClick == true)
            {
                oscOutScript.Send("/void/static/" + (self_id + 1) + "/state", aud_static_state);
                oscOutScript.Send("/void/static/" + (self_id + 1) + "/oneClickEvent", aud_static_oneClick);
                oscOutScript.Send("/void/static/" + (self_id + 1) + "/amp/global", aud_static_ampGlobal);
                oscOutScript.Send("/void/static/" + (self_id + 1) + "/trail", aud_static_oneClick_trail);
                if (aud_static_oneClick_trail == true)
                {
                    oscOutScript.Send("/void/static/" + (self_id + 1) + "/amp/delay", aud_static_delayAmp);
                }

                if (aud_static_oneClick_trail == true)
                {
                    aud_static_oneClick_trail = false;
                }
            }

            if (aud_hitby_igniter == true)
            {
                // the voidIgniter GO tells me, the mesh, if i was hit by it - that is the beginning of the voidStatic phrase in max;
                // the end of that event end comes from max reporting, when its done performing its phrase - see OscIn method below
                oscOutScript.Send("/void/static/" + (self_id + 1) + "/igniterEvent/begin", aud_hitby_igniter);
                oscOutScript.Send("/void/static/" + (self_id + 1) + "/amp/global", aud_static_ampGlobal);
                // Debug.Log( "amp " + aud_static_ampGlobal + " state " + aud_static_state );
                aud_hitby_igniter = false;
            }
        }
    }
        // The following methods are meant to be linked to Unity's runtime UI from the Unity Editor.


        public void SendFloat(float value)
        {
            oscOut.Send(floatAddress, value);
            floatOutputLabel.text = value.ToString();
        }
Example #21
0
    // UPDATE
    void Update()
    {
        if (Input.GetKey("up") && !manualStart)
        {
            calibrateReadings();
        }

        if (Input.GetKeyDown("space"))
        {
            manualStart = true;
            Debug.Log("manual start!!");
        }

        if (firstTime)
        {
            Debug.Log("first time");
            firstTime = false;
            oscout.Send("/start", 1);
            InitialStart();
        }

        if (nowRunning)
        {
            AnalyseSound();
            updateVisualisation();
        }

        // ***** reading sensors

        for (int j = 0; j < numberofarduinos; j++)
        {
            //readings = allReadings [j];
            try{
                switch (j)
                {
                case 0:
                    strIn = portPanel0.readingsData;
                    break;

                case 1:
                    strIn = portPanel1.readingsData;
                    break;

                case 2:
                    strIn = portPanel2.readingsData;
                    break;

                case 3:
                    strIn = portPanel3.readingsData;
                    break;

                default:
                    break;
                }
                //strIn = ReadFromArduino(j);
                //Debug.Log("receieved from arduino" + j + ":" + strIn);

                if (strIn != null)
                {
                    strIn = strIn.Trim();
                    string[] readingsText = strIn.Split(' ');
                    if (readingsText.Length == numberBubbles)
                    {
                        for (int i = 0; i < numberBubbles; i++)
                        {
                            readingsText[i] = readingsText[i].Trim();
                            bool Result;
                            int  number;
                            Result = int.TryParse(readingsText[i], out number);
                            if (Result)
                            {
                                //readings[i] = number;
                                allReadings[j][i] = number;
                                //Debug.Log("arduino:" + j + " bubble:" + i + " reading:" + number + " allReadings:" + allReadings[j][i]);
                            }
                            else
                            {
                                Debug.Log("failed");
                            }
                        }
                        //allReadings [j] = readings;
                    }
                }
            }
            catch (TimeoutException) {
                Debug.Log("timeout exception");
            }
        }

        readingsToSend = "";

        // **** process readings
        for (int o = 0; o < numberofarduinos; o++)
        {
            for (int p = 0; p < numberBubbles; p++)
            {
                // *** creating string for MAX
                //Debug.Log ("allreadings" + o + ":" + allReadings [o][p]);
                float currentDiff = restValues[o][p] - allReadings[o][p];
                float maxDiff     = restValues[o][p] - pressedValues[o][p];
                float percentDiff = currentDiff / maxDiff;
                if (percentDiff < 0)
                {
                    percentDiff = 0;
                }
                if (percentDiff > 1)
                {
                    percentDiff = 1;
                }
                // int valueForMax = Mathf.RoundToInt(percentDiff * 128);
                // String panelID = "/panel" + o + "_" + p;
                // Debug.Log(panelID + ":" + valueForMax);
                // oscout.Send(panelID, valueForMax);
                // readingsToSend += valueForMax + " ";

                readingsToSend += percentDiff + " ";

                // *** send specific triggers to max
                if (nowRunning)
                {
                    if (percentDiff > touchThreshold && clip_slot_triggers[o][p] == 0)
                    {
                        Debug.Log("press clip_slot_trigger current value pre:" + clip_slot_triggers[o][p] + "percentDiff:" + percentDiff);
                        clip_slot_triggers[o][p] = 1;
                        Debug.Log("press clip_slot_trigger current value post:" + clip_slot_triggers[o][p] + "percentDiff:" + percentDiff);
                        checkTriggers(o, p, percentDiff);
                    }

                    if (percentDiff < 0.05f && clip_slot_triggers[o][p] == 1)
                    {
                        Debug.Log("not press the clip_slot_trigger for pre  panel" + o + "_" + p + " is:" + clip_slot_triggers[o][p] + " should be 0");
                        clip_slot_triggers[o][p] = 0;
                        Debug.Log("not press the clip_slot_trigger for post panel" + o + "_" + p + " is:" + clip_slot_triggers[o][p] + " should be 0");
                    }
                }

                // *** check for first touch to start everything
                if (!firstTime && !nowRunning && manualStart)
                {
                    if (percentDiff > touchThreshold)
                    {
                        firstTime = true;
                    }
                }
            }
        }
        // Debug.Log(readingsToSend);
        OscMessage readingsMessage = new OscMessage("/touch");

        readingsMessage.Add(readingsToSend);
        oscout.Send(readingsMessage);

        //writeSocket(readingsToSend);
        //sendStringUDP(readingsToSend);

        updateBubbles();
    }
 void Update()
 {
     oscOut.Send("/test", Random.value);
 }
Example #23
0
 public void StopAll()
 {
     oscOut.Send("/stop-all-jobs", "SONIC_PI_CLI", "SONIC_PI_CLI");
 }
Example #24
0
    void ReportOsc()
    {
        if (busyFlare == true)
        {
            oscOutScript.Send("/disc/" + (self_id + 1) + "/ampLocal", aud_ampLocal);
            oscOutScript.Send("/disc/" + (self_id + 1) + "/lightEventType", aud_lightEventType);
        }
        else if (busySpin == true)
        {
            if (osc_freqsSpin != null)
            {
                oscOutScript.Send(osc_freqsSpin);
                oscOutScript.Send(osc_ampsSpin);
                oscOutScript.Send(osc_decaysSpin);
                oscOutScript.Send("/disc/" + (self_id + 1) + "/ampLocal", aud_ampLocal);
                oscOutScript.Send("/disc/" + (self_id + 1) + "/lightEventType", aud_lightEventType);
            }
        }

        // noteOn event to be accompanied by the first model values?
        if (aud_lightFlareEvent_start == true)
        {
            oscOutScript.Send(osc_freqsFlare);
            oscOutScript.Send(osc_ampsFlare);
            oscOutScript.Send(osc_decaysFlare);
            oscOutScript.Send("/disc/" + (self_id + 1) + "/noteOn", aud_lightFlareEvent_start);
            oscOutScript.Send("/disc/" + (self_id + 1) + "/ampGlobal/resonance", aud_lightFlareEvent_ampGlobal);
            oscOutScript.Send("/disc/" + (self_id + 1) + "/attack", 0);
            aud_lightFlareEvent_start = false;
        }
        else if (aud_lightFlareEvent_end == true)
        {
            oscOutScript.Send("/disc/" + (self_id + 1) + "/noteOff", aud_lightFlareEvent_end);
            aud_lightFlareEvent_end = false;
        }
        else if (aud_lightSpinEvent_start == true)
        {
            oscOutScript.Send("/disc/" + (self_id + 1) + "/noteOn", aud_lightSpinEvent_start);
            oscOutScript.Send("/disc/" + (self_id + 1) + "/ampGlobal/resonance", aud_lightSpinEvent_resonance_ampGlobal);
            oscOutScript.Send("/disc/" + (self_id + 1) + "/ampGlobal/attack", mx_lightSpinEvent_attack_ampGlobal);
            oscOutScript.Send("/disc/" + (self_id + 1) + "/attack", aud_attack);
            aud_lightSpinEvent_start = false;
        }
        else if (aud_lightSpinEvent_end == true)
        {
            oscOutScript.Send("/disc/" + (self_id + 1) + "/noteOff", aud_lightSpinEvent_end);
            aud_lightSpinEvent_end = false;
        }
    }