mirror of
https://github.com/narrrl/pl8list-rewind.git
synced 2026-11-13 17:17:03 +01:00
fix(player): seek two bars before drops
This commit is contained in:
1 parent
1775167515
commit
fc5a711ab9
1 file changed
+3
-3
+3
-3
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user