Skip to content

Commit

Permalink
Fix calibration using wrong time offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicfind committed Apr 8, 2024
1 parent 895791b commit 475b21f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Assets/Script/Menu/Calibrator/Calibrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private enum State
private YargPlayer _player;
#nullable enable
private StemMixer? _mixer;
private float _time;
#nullable disable

private void Start()
Expand Down Expand Up @@ -83,7 +84,7 @@ private void OnMenuInput(YargPlayer player, ref GameInput input)
_audioCalibrateText.color = Color.green;
_audioCalibrateText.text = "Detected";

_calibrationTimes.Add(Time.realtimeSinceStartup);
_calibrationTimes.Add(Time.realtimeSinceStartup - _time);
break;
case State.Starting:
case State.AudioDone:
Expand Down Expand Up @@ -141,6 +142,7 @@ private void UpdateForState()
var file = Path.Combine(Application.streamingAssetsPath, "calibration_music.ogg");
_mixer = GlobalAudioHandler.LoadCustomFile(file, SPEED, VOLUME);
_mixer.Play();
_time = Time.realtimeSinceStartup;
StartCoroutine(AudioCalibrateCoroutine());
break;
case State.AudioDone:
Expand Down

0 comments on commit 475b21f

Please sign in to comment.