private void Start() { if (beat == null) { beat = new UnityEvent(); } SetTempo(TempoUtils.FlipBpmInterval(BPM)); StartTempo(); }
public void ReceiveTempoInMiliseconds(double interval) { tempoFound = true; tempo.SetTempo(interval); tempo.SetLatencyMilliseconds(50); tempo.StartTempo(); Debug.Log("BPM: " + TempoUtils.FlipBpmInterval(interval)); TempoStartInformer.GetInstance().ReceiveTempo(interval); }
private void PlayMusic() { // do calculations and set everything up double bpm = TempoUtils.FlipBpmInterval(secsPerBeat); MusicClip clip = GetClip(bpm); currentSong.clip = clip.clip; currentSong.pitch = (float)TempoUtils.GetPitchModifierFromBpm(bpm, clip.bpm); currentSong = SoundUtils.MakeSource(currentSong, GetAudioSource()); currentSong.source.PlayDelayed((float)(AudioSettings.dspTime - (manager.GetCurrentBeatTime() + secsPerBeat))); }
private bool IsTappingUniform() { // .1 each side of the avg double avg = GetSecondsInterval(); bool uniform = true; double upperWindow = TempoUtils.FlipBpmInterval(TempoUtils.FlipBpmInterval(avg) + TAP_WINDOW); double lowerWindow = TempoUtils.FlipBpmInterval(TempoUtils.FlipBpmInterval(avg) - TAP_WINDOW); foreach (double i in tapIntervals) { uniform = uniform && (i <lowerWindow && i> upperWindow); } return(uniform); }
private void UpdateText(bool hasBpm) { text.text = BPM_DISPLAY + (hasBpm ? UNKNOWN : System.Math.Round(TempoUtils.FlipBpmInterval(secondsPerBeat), 1).ToString()); }