Exemple #1
0
 void Update()
 {
     var data = OscMaster.GetData("/audio/loud");
     if (data != null) {
         var loud = (float)data[0];
         transform.localScale = Vector3.one * loud;
         Debug.Log(loud);
     }
 }
Exemple #2
0
    void Update()
    {
        var data = OscMaster.GetData(_path);

        if (data != null)
        {
            var val = (float)data[0];
            _knob.value = val;
        }
        OscMaster.ClearData(_path);
    }
Exemple #3
0
    // Update is called once per frame
    void Update()
    {
        var data = OscMaster.GetData(_path);

        if (data != null)
        {
            var val = (string)data[0];
            if (val.Equals(_acceptValue))
            {
                _toggle.isOn = true;
                OscMaster.ClearData(_path);
            }
        }
    }
Exemple #4
0
    void Update()
    {
        var data = OscMaster.GetData("/audio/loud");

        if (data != null)
        {
            var loud = (float)data[0];
            transform.localScale = Vector3.one * loud;
            Debug.Log(loud);
        }

        if (OscMaster.HasData("/audio/attack"))
        {
            Camera.main.backgroundColor = Color.red;
            OscMaster.Remove("/audio/attack");
        }
        else
        {
            Camera.main.backgroundColor = new Color(0.2f, 0.3f, 0.5f, 1.0f);
        }
    }
Exemple #5
0
        void Update()
        {
            System.Object[] data = OscMaster.GetData(address);
            if (data == null)
            {
                return;
            }

            var level = (float)data[dataIndex];

            if (scaleMode == ScaleMode.Linear01)
            {
                const float refLevel = 0.70710678118f; // 1/sqrt(2)
                const float zeroOffs = 1.5849e-13f;
                level   = Mathf.Clamp01(level);
                dbLevel = Mathf.Log(level / refLevel + zeroOffs, 10) * 20;
            }
            else
            {
                dbLevel = Mathf.Min(level, 0.0f);
            }
        }
Exemple #6
0
    void Update()
    {
        var position = OscMaster.GetData("/camera/position");

        if (position != null)
        {
            if (position.Length > 2)
            {
                pos = new Vector3(
                    (float)position[0] * (InvertSignPosX ? -1.0f : 1.0f),
                    (float)position[1] * (InvertSignPosY ? -1.0f : 1.0f),
                    (float)position[2] * (InvertSignPosZ ? -1.0f : 1.0f)
                    ) * Scale;
            }
            OscMaster.ClearData("/camera/position");
        }

        var rotation = OscMaster.GetData("/camera/quaternion");

        if (rotation != null)
        {
            if (rotation.Length > 3)
            {
                rot = new Quaternion(
                    (float)rotation[0] * (InvertSignRotX ? -1.0f : 1.0f),
                    (float)rotation[1] * (InvertSignRotY ? -1.0f : 1.0f),
                    (float)rotation[2] * (InvertSignRotZ ? -1.0f : 1.0f),
                    (float)rotation[3] * (InvertSignRotW ? -1.0f : 1.0f)
                    );
            }
            OscMaster.ClearData("/camera/quaternion");
        }

        transform.localPosition = pos;
        transform.localRotation = rot;

        //OscMessageDebugger.oscMessage = mess;
    }
Exemple #7
0
        //    // Update is called once per frame
        void Update()
        {
            totalMessages = OscMaster.MasterDirectory.TotalMessageCount;

            if (OscMaster.HasData("/track2") || Input.GetKeyDown(KeyCode.Space))
            {
                onStartTrack2.Invoke();
                OscMaster.ClearData("/track2");
            }

            for (var i = 1; i <= numDials; i++)
            {
                var address = "/osc/dial/" + i.ToString();
                if (OscMaster.HasData(address))
                {
                    var val = (float)OscMaster.GetData(address).LastOrDefault();
                    dials[i - 1] = val;
                    onUpdateDial[i - 1].Invoke(val);
                    OscMaster.ClearData(address);
                }
            }
            dialBuffer.SetData(dials);
            for (var i = 1; i <= numSliders; i++)
            {
                var address = "/osc/slider/" + i.ToString();
                if (OscMaster.HasData(address))
                {
                    var val = (float)OscMaster.GetData(address).LastOrDefault();
                    sliders[i - 1] = val;
                    onUpdateSlider[i - 1].Invoke(val);
                    OscMaster.ClearData(address);
                }
            }
            compute.SetFloats("_Dial", dials);
            compute.SetFloats("_Slider", sliders);

            if (OscMaster.HasData("/light/color"))
            {
                var data = OscMaster.GetData("/light/color");
                if (data.Length > 3)
                {
                    var color = new Color((float)data[0], (float)data[1], (float)data[2], (float)data[3]);
                    Shader.SetGlobalColor("_LightColor", color);
                }
                OscMaster.ClearData("/light/color");
            }
            if (OscMaster.HasData("/light/intensity"))
            {
                var val = (float)OscMaster.GetData("/light/intensity").FirstOrDefault();
                Shader.SetGlobalFloat("_LightIntensity", val);
                OscMaster.ClearData("/light/intensity");
            }
            if (OscMaster.HasData("/core/color"))
            {
                var data  = OscMaster.GetData("/core/color");
                var color = new Color((float)data[0], (float)data[1], (float)data[2], (float)data[3]);
                onCoreColor.Invoke(color);
                OscMaster.ClearData("/core/color");
            }
            sliderBuffer.SetData(sliders);

            if (OscMaster.HasData("/beat"))
            {
                if (cpUpdater.gameObject.activeSelf)
                {
                    cpUpdater.OnClick();
                }
                OscMaster.ClearData("/beat");
            }
        }