This commit is contained in:
Felix Roos 2022-03-17 16:12:42 +01:00
parent a3fa476c7f
commit c1a0f11c39
4 changed files with 26 additions and 5 deletions

View File

@ -365,6 +365,12 @@ class Pattern {
round() {
return this._asNumber().fmap((v) => Math.round(v));
}
floor() {
return this._asNumber().fmap((v) => Math.floor(v));
}
ceil() {
return this._asNumber().fmap((v) => Math.ceil(v));
}
union(other) {
return this._opleft(other, (a) => (b) => Object.assign({}, a, b));
}
@ -469,6 +475,9 @@ class Pattern {
const binary_pat = sequence(binary_pats);
return binary_pat.fmap((b) => (val) => b ? val : void 0).appRight(this)._removeUndefineds();
}
_segment(rate) {
return this.struct(pure(true).fast(rate));
}
invert() {
return this.fmap((x) => !x);
}
@ -556,7 +565,7 @@ class Pattern {
return this._withContext((context) => ({...context, velocity: (context.velocity || 1) * velocity}));
}
}
Pattern.prototype.patternified = ["apply", "fast", "slow", "early", "late", "duration", "legato", "velocity"];
Pattern.prototype.patternified = ["apply", "fast", "slow", "early", "late", "duration", "legato", "velocity", "segment"];
Pattern.prototype.factories = {pure, stack, slowcat, fastcat, cat, timeCat, sequence, polymeter, pm, polyrhythm, pr};
const silence = new Pattern((_) => []);
function pure(value) {

View File

@ -42598,6 +42598,14 @@ class Pattern {
return this._asNumber().fmap((v)=>Math.round(v)
);
}
floor() {
return this._asNumber().fmap((v)=>Math.floor(v)
);
}
ceil() {
return this._asNumber().fmap((v)=>Math.ceil(v)
);
}
union(other) {
return this._opleft(other, (a)=>(b)=>Object.assign({
}, a, b)
@ -42733,6 +42741,9 @@ class Pattern {
return binary_pat.fmap((b)=>(val)=>b ? val : undefined
).appRight(this)._removeUndefineds();
}
_segment(rate) {
return this.struct(pure(true).fast(rate));
}
invert() {
// Swap true/false in a binary pattern
return this.fmap((x)=>!x
@ -42859,7 +42870,8 @@ Pattern.prototype.patternified = [
'late',
'duration',
'legato',
'velocity'
'velocity',
'segment'
];
// methods that create patterns, which are added to patternified Pattern methods
Pattern.prototype.factories = {
@ -183271,4 +183283,4 @@ exports.default = cx;
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
//# sourceMappingURL=index.86c7b8fe.js.map
//# sourceMappingURL=index.df5f5725.js.map

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,6 @@
<body>
<div id="root"></div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script src="/tutorial/index.86c7b8fe.js" defer=""></script>
<script src="/tutorial/index.df5f5725.js" defer=""></script>
</body>
</html>