void Update() { perlinScale = .8f; //MidiMaster.GetKnob (74, 0) * 1.2f; waveSpeed = MidiMaster.GetKnob(18, 1) * 0.5f; b = MidiMaster.GetKnob(7, 1); waveHeight = MidiMaster.GetKnob(114, 1) * 6; var d = MidiMaster.GetKnob(71, 1) * 200; transform.rotation = Quaternion.Euler(new Vector3(transform.rotation.x, b * 360, transform.rotation.z)); // print ("nobs " + a + " " + c); if (Input.GetKey(KeyCode.C)) { step(); } for (int j = 0; j < vertices.Length; j++) { Vector3 v = vertices [j]; vertices [j] = new Vector3(v.x, Mathf.PerlinNoise(v.x, v.z) * a * a, v.z); // * WaveForm._freqBand [j / 64] * d // vertices [j] = new Vector3 (v.x, (Mathf.Sin (values [j].y) * a) % c * (WaveForm._freqBand [j / 64] * 100), v.z); // print ("WV " + WaveForm.samples); if (j == vertices.Length - 1) { step(); } } mesh.vertices = vertices; mesh.RecalculateBounds(); AnimateMesh(); }
// Update is called once per frame void Update() { for (int i = 0; i < keyboardKeys.Length; i++) //for all of the keys { float keyangle = keyboardKeys[i].transform.localEulerAngles.x; //get angle of the key if (keyangle > 180) { keyangle = keyangle - 360; //translate from 0-360 to -180-180 } if (MidiMaster.GetKey(i + octaveShift) > 0) //if the key is pressed { if (keyangle < keyDownAngle) { keyboardKeys[i].transform.Rotate(rotationPerFrame, 0, 0); //move key to pressed position } } else { if (keyangle > keyUpAngle) { keyboardKeys[i].transform.Rotate(-rotationPerFrame, 0, 0); //move key to rest postion } else if (keyangle < keyUpAngle) { keyboardKeys[i].transform.localEulerAngles = new Vector3(keyUpAngle, 0, 0); //reset key if it travels too far } } } //set the head colour based on the average keypress colour headMaterial.SetColor("_EmissionColor", Color.Lerp(headMaterial.GetColor("_EmissionColor"), headColorAverage, 10 * Time.deltaTime)); }
// Update is called once per frame void Update() { if (MidiMaster.GetKeyDown(4)) { BroadcastMessage("GotInput", Inputs.FIRE); } }
public void Update() { if (_control == Control.Off) { _level = _defaultLevel; } else if (_control == Control.MidiKnob) { _level = MidiMaster.GetKnob(_midiChannel, _knobIndex, _defaultLevel); } else if (_control == Control.MidiNote) { _level = MidiMaster.GetKey(_midiChannel, _noteNumber); } else // _control == Control.InputAxis { if (string.IsNullOrEmpty(_inputAxis)) { _level = _defaultLevel; } else { _level = Input.GetAxis(_inputAxis); } } _level = _curve.Evaluate(_level); }