Fix inaccurate beat snapping for Quaver charts.
This commit is contained in:
@@ -60,7 +60,7 @@ namespace Cryville.Crtr.Extensions.Quaver {
|
|||||||
evs.Sort();
|
evs.Sort();
|
||||||
|
|
||||||
var longevs = new Dictionary<EventWrapper, ChartEvent>();
|
var longevs = new Dictionary<EventWrapper, ChartEvent>();
|
||||||
var tm = new TimeTimingModel(src.TimingPoints[0].StartTime / 1e3);
|
var tm = new TimeTimingModel(src.TimingPoints[0].StartTime / 1e3, 2e-3);
|
||||||
foreach (var ev in evs) {
|
foreach (var ev in evs) {
|
||||||
tm.ForwardTo(ev.StartTime / 1e3);
|
tm.ForwardTo(ev.StartTime / 1e3);
|
||||||
if (ev is EventWrapper.HitObject) {
|
if (ev is EventWrapper.HitObject) {
|
||||||
@@ -84,6 +84,7 @@ namespace Cryville.Crtr.Extensions.Quaver {
|
|||||||
else if (ev is EventWrapper.TimingPoint) {
|
else if (ev is EventWrapper.TimingPoint) {
|
||||||
var tev = (EventWrapper.TimingPoint)ev;
|
var tev = (EventWrapper.TimingPoint)ev;
|
||||||
tm.BPM = tev.Event.Bpm;
|
tm.BPM = tev.Event.Bpm;
|
||||||
|
tm.ForceSnap();
|
||||||
chart.sigs.Add(new Chart.Signature {
|
chart.sigs.Add(new Chart.Signature {
|
||||||
time = tm.FractionalBeatTime,
|
time = tm.FractionalBeatTime,
|
||||||
tempo = tev.Event.Bpm,
|
tempo = tev.Event.Bpm,
|
||||||
|
@@ -43,7 +43,7 @@ namespace Cryville.Crtr.Extensions {
|
|||||||
}
|
}
|
||||||
public class TimeTimingModel : TimingModel {
|
public class TimeTimingModel : TimingModel {
|
||||||
public readonly double InputTimeAccuracy;
|
public readonly double InputTimeAccuracy;
|
||||||
public TimeTimingModel(double accuracy = 2e-3, double offset = 0) : base(offset) {
|
public TimeTimingModel(double offset = 0, double accuracy = 2e-3) : base(offset) {
|
||||||
if (accuracy <= 0) throw new ArgumentOutOfRangeException("accuracy");
|
if (accuracy <= 0) throw new ArgumentOutOfRangeException("accuracy");
|
||||||
InputTimeAccuracy = accuracy;
|
InputTimeAccuracy = accuracy;
|
||||||
}
|
}
|
||||||
|
@@ -108,7 +108,7 @@ namespace Cryville.Crtr.Extensions.osu {
|
|||||||
else if (ev is osuEvent.TimingChange) {
|
else if (ev is osuEvent.TimingChange) {
|
||||||
var tev = (osuEvent.TimingChange)ev;
|
var tev = (osuEvent.TimingChange)ev;
|
||||||
if (tm == null) {
|
if (tm == null) {
|
||||||
tm = new TimeTimingModel(2e-3, tev.StartTime / 1e3);
|
tm = new TimeTimingModel(tev.StartTime / 1e3, 2e-3);
|
||||||
bgmEv.offset = (float)(tev.StartTime / 1e3 + OFFSET);
|
bgmEv.offset = (float)(tev.StartTime / 1e3 + OFFSET);
|
||||||
}
|
}
|
||||||
tm.BeatLength = tev.BeatLength / 1e3;
|
tm.BeatLength = tev.BeatLength / 1e3;
|
||||||
|
Reference in New Issue
Block a user