Tempo change? (Don't update very buggy)

This commit is contained in:
Braedon
2022-01-27 21:50:57 -05:00
parent 8f268f4d60
commit 9185249dd1
36 changed files with 2630 additions and 39 deletions

View File

@ -47,6 +47,8 @@ namespace RhythmHeavenMania
// Metronome tick sound enabled
public bool metronome = false;
public float timeSinceLastTempoChange = 0;
private bool beat;
// private AudioDspTimeKeeper timeKeeper;
@ -56,11 +58,6 @@ namespace RhythmHeavenMania
instance = this;
}
void Start()
{
secPerBeat = 60f / songBpm;
}
public void SetBeat(float beat)
{
float secFromBeat = GetSongPosFromBeat(beat);
@ -79,6 +76,7 @@ namespace RhythmHeavenMania
public void Play(float beat)
{
this.time = GetSongPosFromBeat(beat);
songPositionInBeats = GetSongPosFromBeat(beat) / secPerBeat;
isPlaying = true;
isPaused = false;
@ -103,22 +101,27 @@ namespace RhythmHeavenMania
public void Stop(float time)
{
this.time = time;
songPositionInBeats = time / secPerBeat;
isPlaying = false;
isPaused = false;
musicSource.Stop();
}
float test;
public void Update()
{
secPerBeat = 60f / songBpm;
if (isPlaying)
{
time += Time.deltaTime * musicSource.pitch;
songPosition = time - firstBeatOffset;
songPositionInBeats = songPosition / secPerBeat;
songPositionInBeats += (Time.deltaTime - firstBeatOffset) / secPerBeat;
// songPositionInBeats = Time.deltaTime / secPerBeat;
if (metronome)
{