private void CompleteRecording() { clipRecording.StopRecording(); recorded = true; round.playerRecording = clipRecording; repeatPhraseText.gameObject.SetActive(false); playTimer = recordTime; PlayBackwards(); }
// Update is called once per frame void Update() { if (clipRecording.IsRecording()) { timer += Time.deltaTime; waveform.DrawWaveform(); if (timer >= recordTime) { clipRecording.StopRecording(); } } else if (clipRecording.IsPlaying()) { if (clipRecording.GetPlayDir() > 0) { if (timer < recordTime) { timer += Time.deltaTime; } if (timer >= recordTime) { clipRecording.StopClip(audioSrc); } } else if (clipRecording.GetPlayDir() < 0) { if (timer > 0) { timer -= Time.deltaTime; } if (timer <= 0) { clipRecording.StopClip(audioSrc); } } } waveform.SetPlayhead(timer / recordTime); }