// Update is called once per frame void Update() { //print(parts); if (parts != null) { //print(parts[0].timesig); if (Input.GetKeyDown(KeyCode.A)) { Debug.Log("playing"); playFile(); } if (Input.GetKeyDown("space") && !paused) { if (counter <= parts[0].timesig) { setUpNumbers(); } GameObject background = Instantiate(backgroundPrefab, backgroundPrefab.transform.position, Quaternion.identity); counter++; if (!started) { started = true; playFile(); } else { myChuck.BroadcastEvent("space"); } } } }
void Update() { if (Input.GetKeyDown("space")) { // on first press, set entire array if (numPresses == 0) { myChuck.SetFloatArray("myFloatNotes", myMidiNotes); } // on any press, change the value of index 1 myChuck.SetFloatArrayValue("myFloatNotes", 1, 60.5f + numPresses); // set a dictionary value too myChuck.SetAssociativeFloatArrayValue("myFloatNotes", "numPlayed", numPresses); // test some gets too myChuck.GetFloatArray("myFloatNotes", myFloatArrayCallback); myChuck.GetFloatArrayValue("myFloatNotes", 1, myFloatCallback); myChuck.GetAssociativeFloatArrayValue("myFloatNotes", "numPlayed", myFloatCallback); // actually play it! myChuck.BroadcastEvent("playMyNotes"); numPresses++; } }
private IEnumerator SyncLoopWithMetronome() { sporkWaiting = true; yield return(new WaitUntil(() => globalBeatFlag == true)); myInstrumentSyncer.SetNewValue(main.instrumentDict[main.currentInstrument]); myChuck.BroadcastEvent("sporkTheLoop"); main.adcFlag = false; sporkWaiting = false; }
// Update is called once per frame void Update() { if (Input.GetKeyDown("space")) { if (!haveSetOnce) { mySyncer.SetNewValue("special:dope"); haveSetOnce = true; } myChuck.BroadcastEvent("playTheFile"); Debug.Log("Hey, the synced string is " + mySyncer.GetCurrentValue()); } }
public void Start(NextAction fn) { GetNext = fn; StartTick(); instance.BroadcastEvent("start"); }