Skip to content

Commit

Permalink
Fix loop at tactus (#1145)
Browse files Browse the repository at this point in the history
* fix loopAt tactus
  • Loading branch information
yaxu authored Jul 27, 2024
1 parent 71e843e commit 6e496b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/pattern.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2929,7 +2929,8 @@ export const splice = register(
);

export const { loopAt, loopat } = register(['loopAt', 'loopat'], function (factor, pat) {
return new Pattern((state) => _loopAt(factor, pat, state.controls._cps).query(state));
const tactus = pat.tactus ? pat.tactus.div(factor) : undefined;
return new Pattern((state) => _loopAt(factor, pat, state.controls._cps).query(state), tactus);
});

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/core/test/pattern.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1248,4 +1248,9 @@ describe('Pattern', () => {
);
});
});
describe('loopAt', () => {
it('maintains tactus', () => {
expect(s('bev').chop(8).loopAt(2).tactus).toStrictEqual(Fraction(4));
});
});
});

0 comments on commit 6e496b7

Please sign in to comment.