mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 02:58:32 +00:00
implement fit with pat state
This commit is contained in:
parent
738cea0025
commit
8052e10f0c
@ -427,7 +427,7 @@ export class Pattern {
|
|||||||
* @noAutocomplete
|
* @noAutocomplete
|
||||||
*/
|
*/
|
||||||
withHaps(func) {
|
withHaps(func) {
|
||||||
return new Pattern((state) => func(this.query(state)));
|
return new Pattern((state) => func(this.query(state), state));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2377,12 +2377,14 @@ export const { loopAt, loopat } = register(['loopAt', 'loopat'], function (facto
|
|||||||
* s("rhodes/4").fit()
|
* s("rhodes/4").fit()
|
||||||
*/
|
*/
|
||||||
export const fit = register('fit', (pat) =>
|
export const fit = register('fit', (pat) =>
|
||||||
pat.withHap((hap) =>
|
pat.withHaps((haps, state) =>
|
||||||
hap.withValue((v) => ({
|
haps.map((hap) =>
|
||||||
...v,
|
hap.withValue((v) => ({
|
||||||
speed: 1 / hap.whole.duration,
|
...v,
|
||||||
unit: 'c',
|
speed: (state.controls._cps || 1) / hap.whole.duration,
|
||||||
})),
|
unit: 'c',
|
||||||
|
})),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -142,19 +142,8 @@ export function repl({
|
|||||||
// already defined..
|
// already defined..
|
||||||
}
|
}
|
||||||
|
|
||||||
const fit = register('fit', (pat) =>
|
|
||||||
pat.withHap((hap) =>
|
|
||||||
hap.withValue((v) => ({
|
|
||||||
...v,
|
|
||||||
speed: scheduler.cps / hap.whole.duration, // overwrite speed completely?
|
|
||||||
unit: 'c',
|
|
||||||
})),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
evalScope({
|
evalScope({
|
||||||
loopAt,
|
loopAt,
|
||||||
fit,
|
|
||||||
all,
|
all,
|
||||||
hush,
|
hush,
|
||||||
setCps,
|
setCps,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user