fix(player): seek two bars before drops

This commit is contained in:
nvrl committed 2026-11-06 11:38:55 +01:00
1 parent 1775167515
commit fc5a711ab9
1 file changed
+3 -3
+3 -3
View File
@@ -294,12 +294,12 @@ const actions: CardActions = {
toDrop: (c) => toDrop(c),
};
/// Seek to the next drop of the playing card, a bar early so it lands; past the
/// last one, back to the first.
/// Seek to the next drop of the playing card, two bars early so the build is heard
/// before it lands; past the last one, back to the first.
function toDrop(card: Card): void {
const a = player.audio;
if (card !== current() || !a.duration || !card.drops.length) return;
const lead = 4 * beatSeconds();
const lead = 8 * beatSeconds();
const times = card.drops.map((d) => Math.max(0, d * a.duration - lead));
const next = times.find((t) => t > a.currentTime + 1) ?? times[0];
player.seek(next);