mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 05:38:35 +00:00
Fixes fit so it works after a chop or slice (#1171)
* fix fit so it works after a chop or slice * format
This commit is contained in:
parent
39006e4d71
commit
263c13c36e
@ -2957,11 +2957,14 @@ export const { loopAt, loopat } = register(['loopAt', 'loopat'], function (facto
|
||||
export const fit = register('fit', (pat) =>
|
||||
pat.withHaps((haps, state) =>
|
||||
haps.map((hap) =>
|
||||
hap.withValue((v) => ({
|
||||
...v,
|
||||
speed: (state.controls._cps || 1) / hap.whole.duration,
|
||||
unit: 'c',
|
||||
})),
|
||||
hap.withValue((v) => {
|
||||
const slicedur = ('end' in v ? v.end : 1) - ('begin' in v ? v.begin : 0);
|
||||
return {
|
||||
...v,
|
||||
speed: ((state.controls._cps || 1) / hap.whole.duration) * slicedur,
|
||||
unit: 'c',
|
||||
};
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user