Skip to content

Commit

Permalink
延迟TempoManager修改信号到CorrectStatus之后以防止错误的时间转换
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuYunPlayer committed May 19, 2024
1 parent bddba96 commit 3a32915
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions TuneLab/Data/TempoManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public int AddTempo(double pos, double bpm)
{
pos = Math.Max(pos, Tempos[0].Pos);

BeginMergeNotify();
int i = mTempos.Count - 1;
for (; i >= 0; --i)
{
Expand All @@ -49,6 +50,7 @@ public int AddTempo(double pos, double bpm)
}

CorrectStatusFrom(i + 1);
EndMergeNotify();
return result;
}

Expand All @@ -57,17 +59,21 @@ public void RemoveTempoAt(int index)
if (index < 0 || index >= mTempos.Count)
return;

BeginMergeNotify();
mTempos.RemoveAt(index);
CorrectStatusFrom(index);
EndMergeNotify();
}

public void SetBpm(int index, double bpm)
{
if (index < 0 || index >= Tempos.Count)
return;

BeginMergeNotify();
mTempos[index].Bpm.Set(bpm);
CorrectStatusFrom(index + 1);
EndMergeNotify();
}

void CorrectStatusFrom(int index)
Expand Down

0 comments on commit 3a32915

Please sign in to comment.