mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:17:39 +02:00
Tempo changes restored (#92)
* Prepwork for seeking + tempo change fixes TODO: make playing after seeking function (I'll need help with the offset stuff so if anyone can push to this branch please do) * functions to get the beat from a song position will need more testing but I think it works well enough to get into prod thanks @wooningcharithri#7419 for the psuedo-code
This commit is contained in:
@ -151,7 +151,7 @@ namespace HeavenStudio
|
||||
// LateUpdate works a bit better(?) but causes some bugs (like issues with bop animations).
|
||||
private void Update()
|
||||
{
|
||||
if (Beatmap.entities.Count < 1)
|
||||
if (BeatmapEntities() < 1) //bruh really you forgot to ckeck tempo changes
|
||||
return;
|
||||
if (!Conductor.instance.isPlaying)
|
||||
return;
|
||||
@ -197,9 +197,11 @@ namespace HeavenStudio
|
||||
|
||||
if (currentTempoEvent < Beatmap.tempoChanges.Count && currentTempoEvent >= 0)
|
||||
{
|
||||
// Debug.Log("Checking Tempo Change at " + tempoChanges[currentTempoEvent] + ", current beat " + Conductor.instance.songPositionInBeats);
|
||||
if (Conductor.instance.songPositionInBeats >= tempoChanges[currentTempoEvent])
|
||||
{
|
||||
Conductor.instance.songBpm = Beatmap.tempoChanges[currentTempoEvent].tempo;
|
||||
// Debug.Log("Tempo Change at " + Conductor.instance.songPositionInBeats + " of bpm " + Beatmap.tempoChanges[currentTempoEvent].tempo);
|
||||
Conductor.instance.SetBpm(Beatmap.tempoChanges[currentTempoEvent].tempo);
|
||||
Conductor.instance.timeSinceLastTempoChange = Time.time;
|
||||
currentTempoEvent++;
|
||||
}
|
||||
@ -325,9 +327,20 @@ namespace HeavenStudio
|
||||
|
||||
if (Beatmap.tempoChanges.Count > 0)
|
||||
{
|
||||
currentTempoEvent = 0;
|
||||
List<float> tempoChanges = Beatmap.tempoChanges.Select(c => c.beat).ToList();
|
||||
|
||||
currentTempoEvent = tempoChanges.IndexOf(Mathp.GetClosestInList(tempoChanges, beat));
|
||||
//for tempo changes, just go over all of em until the last one we pass
|
||||
for (int t = 0; t < tempoChanges.Count; t++)
|
||||
{
|
||||
// Debug.Log("checking tempo event " + t + " against beat " + beat + "( tc beat " + tempoChanges[t] + ")");
|
||||
if (tempoChanges[t] > beat)
|
||||
{
|
||||
break;
|
||||
}
|
||||
currentTempoEvent = t;
|
||||
}
|
||||
// Debug.Log("currentTempoEvent is now " + currentTempoEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user