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); } }
// // 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"); } }