Skip to content

Backport fastgap fix #1189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yaxu opened this issue Mar 30, 2025 · 0 comments
Open

Backport fastgap fix #1189

yaxu opened this issue Mar 30, 2025 · 0 comments

Comments

@yaxu
Copy link
Member

yaxu commented Mar 30, 2025

fastgap got bugfixed in 2.0

_fastGap :: Time -> Signal a -> Signal a
_fastGap factor pat = splitQueries $ withEvent ef $ withQueryArcMaybe qf pat
-- A bit fiddly, to drop zero-width queries at the start of the next cycle
where qf (Arc b e) | bpos < 1 = Just $ Arc (cyc + bpos) (cyc + epos)
| otherwise = Nothing
where cyc = sam b
bpos = min 1 $ (b - cyc) * factor
epos = min 1 $ (e - cyc) * factor
-- Also fiddly, to maintain the right 'whole' relative to the part
ef ev = ev {whole = w', active = a'}
where a = active ev
b = aBegin a
e = aEnd a
a' = Arc (cyc + bpos) (cyc + epos)
where cyc = sam b
bpos = min 1 $ (b - cyc) / factor
epos = min 1 $ (e - cyc) / factor
w' = do w <- whole ev
let b' = aBegin a' - ((b - (aBegin w)) / factor)
e' = aEnd a' + (((aEnd w) - e) / factor)
return $ Arc b' e'

Originally posted by @yaxu in #1076

As noticed by Claude: https://discord.com/channels/779427371270275082/779743442288377876/1347507824145731616

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant