Fix loop at tactus (#1145)

* fix loopAt tactus
This commit is contained in:
Alex McLean 2024-07-27 10:02:38 +01:00 committed by GitHub
parent 71e843e1a3
commit 6e496b7a4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -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);
});
/**

View File

@ -1248,4 +1248,9 @@ describe('Pattern', () => {
);
});
});
describe('loopAt', () => {
it('maintains tactus', () => {
expect(s('bev').chop(8).loopAt(2).tactus).toStrictEqual(Fraction(4));
});
});
});