void Update() { xPos += Time.deltaTime * speed; //xPos = speed * myTimeSyncer.GetCurrentValue(); //Debug.Log(xPos); yPos = myPitchSyncer.GetCurrentValue(); //octave offshoot error correction for intervals +/- a 9th (13 semitones) if ((yPos < yPosPrev - 13.0f) | (yPos > yPosPrev + 13.0f)) { yPos = yPosPrev; } midiText.text = "MIDI note: " + yPos.ToString(); //Debug.Log(yPos); Vector3 movement = new Vector3(xPos, yPos, zPos); transform.position = movement; if (xPos > goalPosition) { DetermineGameState(); } else { transform.position = movement; } }
// Update is called once per frame void Update() //put these steps and the start intialization code into player controller { float newTimeStep = Mathf.Clamp(Input.mousePosition.x, 250, 1000) / 1000.0f; myChuck.SetFloat("timeStep", newTimeStep); //get timestep input from mouse position, this is to vary the "tempo" let's say myPos = myAdvancerSyncer.GetCurrentValue(); //unity system gets 'pos' value from chuck and applies it to cube position transform.position = new Vector3(myPos % 4, 0, 0); //apply myPos value to the cube's tranform component }
// Update is called once per frame void Update() { float newTimeStep = Mathf.Clamp(Input.mousePosition.x, 250, 1000) / 1000.0f; myChuck.SetFloat("timeStep", newTimeStep); myPos = myAdvancerSyncer.GetCurrentValue(); transform.position = new Vector3(myPos % 4, 0, 0); }
float SetPitch2YPosition() { yPos = MapPitchToYPosition(myPitchSyncer.GetCurrentValue()); if ((yPos < yPosPrev - 12.0f) | (yPos > yPosPrev + 12.0f)) //try to correct for >octave errors { yPos = yPosPrev; } else { yPosPrev = yPos; } return(yPos); }
// Update is called once per frame void Update() { float midiPlayedSyncerValue = midiPlayedSyncer.GetCurrentValue(); if (midiPlayedSyncerValue > 0.5f) { midiPlayed = true; } if (midiPlayed == true) { float midiNote = midiValueSyncer.GetCurrentValue(); GameObject newCube = Instantiate(cube, new Vector3((-4.0f + (0.42f * midiNote)), 10.0f, 15.0f), Quaternion.identity) as GameObject; float intensity = intensitySyncer.GetCurrentValue(); newCube.transform.localScale = new Vector3(0.00002f * intensity, 0.00002f * intensity, 0.00002f * intensity); Rigidbody clone = newCube.AddComponent <Rigidbody>(); midiPlayed = false; } }
// Update is called once per frame void Update() { // get input (for chicken editing) if (Input.GetKeyDown(KeyCode.A)) { m_selectedChicken--; if (m_selectedChicken < 0) { m_selectedChicken = NUM_CHICKENS - 1; } } else if (Input.GetKeyDown(KeyCode.D)) { m_selectedChicken++; if (m_selectedChicken >= NUM_CHICKENS) { m_selectedChicken = 0; } } else if (Input.GetKeyDown("left")) { AdjustRate(m_selectedChicken, true); } else if (Input.GetKeyDown("right")) { AdjustRate(m_selectedChicken, false); } else if (Input.GetKeyDown("up")) { AdjustGain(m_selectedChicken, true); } else if (Input.GetKeyDown("down")) { AdjustGain(m_selectedChicken, false); } // offset float offset = m_chickenSpacing * (NUM_CHICKENS - 1) + m_chickenSpacing * .4f; // update the playhead using info from ChucK's playheadPos m_playhead.transform.position = new Vector3( -offset / 2f + m_chickenSpacing * m_ckPlayheadPos.GetCurrentValue(), m_playhead.transform.position.y, m_playhead.transform.position.z); // get current step number int currentChicken = m_ckCurrentChicken.GetCurrentValue(); // should eat? if (currentChicken != m_previousChicken) { // chicken, eat! Eat(currentChicken); // remember m_previousChicken = currentChicken; } // animate the playhead animUpdate(); // position the selector PositionSelector(); }
// Update is called once per frame void Update() { Debug.Log("most recent dac loudness: " + myGetLoudnessSyncer.GetCurrentValue().ToString("0.000") ); }