Skip to content

Commit

Permalink
Improve precision
Browse files Browse the repository at this point in the history
  • Loading branch information
VioletXF committed Sep 9, 2023
1 parent 38c24eb commit 6d829a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Assets/Scripts/BMSParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public void Parse(string path, bool addReadyMeasure = false, bool metaOnly = fal
if(cancellationToken.IsCancellationRequested) return;

// Debug.Log($"measure: {i}, position: {position}, lastPosition: {lastPosition} bpm: {bpm} scale: {measure.scale} interval: {240 * 1000 * 1000 * (position - lastPosition) * measure.scale / bpm}");
double interval = 240 * 1000 * 1000 * (position - lastPosition) * measure.Scale / currentBpm;
double interval = 240000000D * (position - lastPosition) * measure.Scale / currentBpm;
timePassed += interval;
timeline.Timing = (long)timePassed;
if (timeline.BpmChange)
Expand Down Expand Up @@ -468,7 +468,7 @@ public void Parse(string path, bool addReadyMeasure = false, bool metaOnly = fal
};
measure.Timelines.Add(timeline);
}
timePassed += (long)(240 * 1000 * 1000 * (1 - lastPosition) * measure.Scale / currentBpm);
timePassed += (240000000D * (1 - lastPosition) * measure.Scale / currentBpm);

}
// Debug.Log($"Postprocessing took: "+ stopwatch.ElapsedMilliseconds + "ms");
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/BMSRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void Init(Chart chart)
this.lastTimeline = chart.Measures[0].Timelines[0];

TimeLine lastTimeline = chart.Measures[0].Timelines[0];
lastTimeline.Pos = 0.0;
lastTimeline.Pos = 0.0D;

foreach (Measure measure in chart.Measures)
{
Expand Down Expand Up @@ -484,7 +484,7 @@ float LaneToLeft(int lane)
float OffsetToTop(double offset)
{
// TODO: Implement
return (float)(judgeLinePosition + offset * 0.00007f);
return (float)(judgeLinePosition + offset * 0.00007D);
}


Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/RhythmControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public long GetCurrentDspTimeMicro(FMOD.System system, ChannelGroup channelGroup
public long GetCompensatedDspTimeMicro(FMOD.System system, ChannelGroup channelGroup)
{

return GetCurrentDspTimeMicro(system, channelGroup);// + SameDspClockCount * (long)(Time.fixedDeltaTime * 1000000);
return GetCurrentDspTimeMicro(system, channelGroup) + SameDspClockCount * (long)(Time.fixedDeltaTime * 1000000);
}
}
public class RhythmControl : MonoBehaviour
Expand Down

0 comments on commit 6d829a0

Please sign in to comment.