bugfix and tweak doc

This commit is contained in:
alex 2025-12-11 16:51:25 +00:00
parent a34e58aa09
commit 37990b459f

View file

@ -25,13 +25,21 @@ export const reset_timelines = function () {
* to '2', it would always align '0' to the nearest cycle. You will likely want to trigger * to '2', it would always align '0' to the nearest cycle. You will likely want to trigger
* an evaluation a little bit before the cycle starts, to avoid missing events. * an evaluation a little bit before the cycle starts, to avoid missing events.
* *
* If you change and evaluate a pattern without changing the timeline, it will stay on that timeline * After the first use, a timeline will continue with the same 'offset'. That is, if you change
* without resetting. * a pattern without changing its timeline number, it will stay on that timeline without resetting.
* *
* Rather than incrementing a timeline to reset it, it's easier to negate it, e.g. by switching between `-2` * Rather than incrementing a timeline to reset it, it's easier to negate it, e.g. by switching between `-2`
* and `2`. This is because when you negate a timeline it will always reset. * and `2`. This is because when you negate a timeline it will always reset.
* *
* You can also pattern the timeline if you want, to create strange resetting patterns. * You can also pattern the timeline if you want, to create strange resetting patterns.
* @param {number | Pattern} timeline The timeline that the pattern should play on.
* @example
* n("<0 1 2 3>(3,8)")
* .sound("num")
* // resets the timeline every two cycles, by negating the timeline.
* // in a lot of cases this will be edited by a human live coder
* // rather than patterned!
* .timeline("<2 -2>".slow(2))
*/ */
export const timeline = register( export const timeline = register(
@ -40,8 +48,7 @@ export const timeline = register(
tpat = reify(tpat); tpat = reify(tpat);
const f = function (state) { const f = function (state) {
// Is this called from the scheduler? (rather than from e.g. the visualiser) // Is this called from the scheduler? (rather than from e.g. the visualiser)
const scheduler = !!state.controls._cyclist; const scheduler = !!state.controls.cyclist;
const timehaps = tpat.query(state); const timehaps = tpat.query(state);
const result = []; const result = [];
for (const timehap of timehaps) { for (const timehap of timehaps) {