/******************************************** ******************************************** * This is th only function you ned to use * It catch the type of beat detected. * When using frequency mode you can get several * types of beat at the same time. * Add your code to manage the beats ******************************************** ********************************************/ void Update() { for (int i = 0; i < 4; ++i) { EventTypeCnt.SetFirst(i, false); } int theBeat = isBeat(); if ((theBeat & (int)beatType.kick) != (int)beatType.None) { SendEvent(EventType.Kick); } if ((theBeat & (int)beatType.snare) != (int)beatType.None) { SendEvent(EventType.Snare); } if ((theBeat & (int)beatType.hithat) != (int)beatType.None) { SendEvent(EventType.HitHat); } if ((theBeat & (int)beatType.energy) != (int)beatType.None) { SendEvent(EventType.Energy); } }
public void MyCallbackEventHandler(BeatDetection.EventInfo eventInfo) { EventTypeCnt.AddEventType((int)eventInfo.messageInfo); //SideFountain.AddEventType((int)eventInfo.messageInfo); switch (eventInfo.messageInfo) { case BeatDetection.EventType.Energy: Debug.Log("Energy"); break; case BeatDetection.EventType.HitHat: Debug.Log("Hithat"); break; case BeatDetection.EventType.Kick: Debug.Log("Kick"); break; case BeatDetection.EventType.Snare: Debug.Log("Snare"); break; } }
// Update is called once per frame void Update() { if (isStart) { if (EventTypeCnt.isEqualAndFirst(0, 1)) { StartCoroutine(PlayFirstFountain()); } if (EventTypeCnt.isEqualAndFirst(0, 5)) { StartCoroutine(PlayPopFountains(new int[] { 6, 8 }, 2, 4)); } if (EventTypeCnt.isEqualAndFirst(0, 6)) { StartCoroutine(PlayPopFountains(new int[] { 0, 2 }, 2, 2)); } } }