From 991e2a56b7f73c0e372fe6cb33dd3974a2f7a206 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Wed, 30 Jul 2025 17:09:39 +0300 Subject: [PATCH] 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. --- CHANGELOG.md | 1 + MuzikaGromche/Plugin.cs | 17 +++++------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0febe23..ce16da3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Added LobbyCompatibility to dependencies to avoid desync issues. - Fixed lyrics not being displayed in some situations. - 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 diff --git a/MuzikaGromche/Plugin.cs b/MuzikaGromche/Plugin.cs index b5bec9e..12b2566 100644 --- a/MuzikaGromche/Plugin.cs +++ b/MuzikaGromche/Plugin.cs @@ -921,26 +921,20 @@ namespace MuzikaGromche } public readonly float Duration() - { - return Split().Sum(span => span.BeatToInclusive - span.BeatFromExclusive); - } - - public readonly BeatTimeSpan[] Split() { if (IsEmpty()) { - return []; + return 0f; } else if (IsWrapped()) { - return [ - new BeatTimeSpan(LoopBeats, isLooping: false, beatFromExclusive: /* epsilon */ -0.001f, beatToInclusive: BeatToInclusive), - new BeatTimeSpan(LoopBeats, isLooping: false, beatFromExclusive: BeatFromExclusive, beatToInclusive: LoopBeats), - ]; + var beforeWrapping = LoopBeats - BeatFromExclusive; + var afterWrapping = BeatToInclusive - 0f; + return beforeWrapping + afterWrapping; } else { - return [this]; + return BeatToInclusive - BeatFromExclusive; } } @@ -1197,7 +1191,6 @@ namespace MuzikaGromche // // Otherwise there is no transition running at this time. const float currentClipLength = 1f; - // var currentClipSpan = BeatTimespan timestamp.Floor() var currentClipStart = timestamp.Floor(); var currentClipEnd = currentClipStart + currentClipLength;