1
0
Fork 0

Fix color right before wrapping

The buggy Split method was erroneously creating a looping span despite
explicitly passing `isLooping: false` parameter because with
`beatToInclusive: LoopBeats` wrapping will occur regardless. This
messed up with Duration calculations, and eventually caused the last
beat default to transition with t=0, when it should really be static.
This commit is contained in:
ivan tkachenko 2025-07-30 17:09:39 +03:00
parent c689198588
commit 991e2a56b7
2 changed files with 6 additions and 12 deletions

View File

@ -5,6 +5,7 @@
- Added LobbyCompatibility to dependencies to avoid desync issues. - Added LobbyCompatibility to dependencies to avoid desync issues.
- Fixed lyrics not being displayed in some situations. - Fixed lyrics not being displayed in some situations.
- Fixed minor visual issue with the fade out effect. - Fixed minor visual issue with the fade out effect.
- Fixed visual glitch at the last beat of a loop.
## MuzikaGromche 13.37.911 - Sri Lanka Bus hotfix ## MuzikaGromche 13.37.911 - Sri Lanka Bus hotfix

View File

@ -921,26 +921,20 @@ namespace MuzikaGromche
} }
public readonly float Duration() public readonly float Duration()
{
return Split().Sum(span => span.BeatToInclusive - span.BeatFromExclusive);
}
public readonly BeatTimeSpan[] Split()
{ {
if (IsEmpty()) if (IsEmpty())
{ {
return []; return 0f;
} }
else if (IsWrapped()) else if (IsWrapped())
{ {
return [ var beforeWrapping = LoopBeats - BeatFromExclusive;
new BeatTimeSpan(LoopBeats, isLooping: false, beatFromExclusive: /* epsilon */ -0.001f, beatToInclusive: BeatToInclusive), var afterWrapping = BeatToInclusive - 0f;
new BeatTimeSpan(LoopBeats, isLooping: false, beatFromExclusive: BeatFromExclusive, beatToInclusive: LoopBeats), return beforeWrapping + afterWrapping;
];
} }
else else
{ {
return [this]; return BeatToInclusive - BeatFromExclusive;
} }
} }
@ -1197,7 +1191,6 @@ namespace MuzikaGromche
// //
// Otherwise there is no transition running at this time. // Otherwise there is no transition running at this time.
const float currentClipLength = 1f; const float currentClipLength = 1f;
// var currentClipSpan = BeatTimespan timestamp.Floor()
var currentClipStart = timestamp.Floor(); var currentClipStart = timestamp.Floor();
var currentClipEnd = currentClipStart + currentClipLength; var currentClipEnd = currentClipStart + currentClipLength;