mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 13:48:40 +00:00
Tactus tweaks - fixes for maintaining tactus and highlight locations (#1065)
* outer bind/join should keep outer tactus * keep locations of outer pattern in stepJoin
This commit is contained in:
parent
9348a8015a
commit
267f58b7be
@ -257,12 +257,12 @@ export class Pattern {
|
|||||||
}
|
}
|
||||||
|
|
||||||
outerBind(func) {
|
outerBind(func) {
|
||||||
return this.bindWhole((a) => a, func);
|
return this.bindWhole((a) => a, func).setTactus(this.tactus);
|
||||||
}
|
}
|
||||||
|
|
||||||
outerJoin() {
|
outerJoin() {
|
||||||
// Flattens a pattern of patterns into a pattern, where wholes are
|
// Flattens a pattern of patterns into a pattern, where wholes are
|
||||||
// taken from inner haps.
|
// taken from outer haps.
|
||||||
return this.outerBind(id);
|
return this.outerBind(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2429,7 +2429,10 @@ export function _slices(haps) {
|
|||||||
const breakpoints = flatten(haps.map((hap) => [hap.part.begin, hap.part.end]));
|
const breakpoints = flatten(haps.map((hap) => [hap.part.begin, hap.part.end]));
|
||||||
const unique = uniqsortr([Fraction(0), Fraction(1), ...breakpoints]);
|
const unique = uniqsortr([Fraction(0), Fraction(1), ...breakpoints]);
|
||||||
const slicespans = pairs(unique);
|
const slicespans = pairs(unique);
|
||||||
return slicespans.map((s) => [s[1].sub(s[0]), stack(..._fitslice(new TimeSpan(...s), haps).map((x) => x.value))]);
|
return slicespans.map((s) => [
|
||||||
|
s[1].sub(s[0]),
|
||||||
|
stack(..._fitslice(new TimeSpan(...s), haps).map((x) => x.value.withHap((h) => h.setContext(h.combineContext(x))))),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function _fitslice(span, haps) {
|
export function _fitslice(span, haps) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user