build
This commit is contained in:
parent
5d8ccdff25
commit
225f6c7785
6 changed files with 20 additions and 13 deletions
|
|
@ -328,7 +328,7 @@ class Pattern {
|
||||||
_opleft(other, func) {
|
_opleft(other, func) {
|
||||||
return this.fmap(func).appLeft(reify(other));
|
return this.fmap(func).appLeft(reify(other));
|
||||||
}
|
}
|
||||||
_asNumber() {
|
_asNumber(silent = false) {
|
||||||
return this._withEvent((event) => {
|
return this._withEvent((event) => {
|
||||||
const asNumber = Number(event.value);
|
const asNumber = Number(event.value);
|
||||||
if (!isNaN(asNumber)) {
|
if (!isNaN(asNumber)) {
|
||||||
|
|
@ -344,8 +344,11 @@ class Pattern {
|
||||||
if (isNote(event.value)) {
|
if (isNote(event.value)) {
|
||||||
return new Hap(event.whole, event.part, toMidi(event.value), {...event.context, type: "midi"});
|
return new Hap(event.whole, event.part, toMidi(event.value), {...event.context, type: "midi"});
|
||||||
}
|
}
|
||||||
throw new Error('cannot parse as number: "' + event.value + '"');
|
if (!silent) {
|
||||||
});
|
throw new Error('cannot parse as number: "' + event.value + '"');
|
||||||
|
}
|
||||||
|
return event.withValue(() => void 0);
|
||||||
|
})._removeUndefineds();
|
||||||
}
|
}
|
||||||
add(other) {
|
add(other) {
|
||||||
return this._asNumber()._opleft(other, (a) => (b) => a + b);
|
return this._asNumber()._opleft(other, (a) => (b) => a + b);
|
||||||
|
|
|
||||||
2
docs/dist/draw.js
vendored
2
docs/dist/draw.js
vendored
|
|
@ -26,7 +26,7 @@ Pattern.prototype.draw = function(callback, cycleSpan, lookaheadCycles = 1) {
|
||||||
cycle = currentCycle;
|
cycle = currentCycle;
|
||||||
const begin = currentCycle * cycleSpan;
|
const begin = currentCycle * cycleSpan;
|
||||||
const end = (currentCycle + lookaheadCycles) * cycleSpan;
|
const end = (currentCycle + lookaheadCycles) * cycleSpan;
|
||||||
events = this.add(0).query(new State(new TimeSpan(begin, end)));
|
events = this._asNumber(true).query(new State(new TimeSpan(begin, end))).filter((event) => event.part.begin.valueOf() === event.whole.begin.valueOf());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
callback(ctx, events, t, cycleSpan, time);
|
callback(ctx, events, t, cycleSpan, time);
|
||||||
|
|
|
||||||
2
docs/dist/useCycle.js
vendored
2
docs/dist/useCycle.js
vendored
|
|
@ -20,7 +20,7 @@ function useCycle(props) {
|
||||||
events?.filter((event) => event.part.begin.valueOf() === event.whole.begin.valueOf()).forEach((event) => {
|
events?.filter((event) => event.part.begin.valueOf() === event.whole.begin.valueOf()).forEach((event) => {
|
||||||
Tone.getTransport().schedule((time) => {
|
Tone.getTransport().schedule((time) => {
|
||||||
const toneEvent = {
|
const toneEvent = {
|
||||||
time: event.part.begin.valueOf(),
|
time: event.whole.begin.valueOf(),
|
||||||
duration: event.whole.end.sub(event.whole.begin).valueOf(),
|
duration: event.whole.end.sub(event.whole.begin).valueOf(),
|
||||||
value: event.value,
|
value: event.value,
|
||||||
context: event.context
|
context: event.context
|
||||||
|
|
|
||||||
|
|
@ -42450,7 +42450,7 @@ class Pattern {
|
||||||
_opleft(other, func) {
|
_opleft(other, func) {
|
||||||
return this.fmap(func).appLeft(reify(other));
|
return this.fmap(func).appLeft(reify(other));
|
||||||
}
|
}
|
||||||
_asNumber() {
|
_asNumber(silent = false) {
|
||||||
return this._withEvent((event)=>{
|
return this._withEvent((event)=>{
|
||||||
const asNumber = Number(event.value);
|
const asNumber = Number(event.value);
|
||||||
if (!isNaN(asNumber)) return event.withValue(()=>asNumber
|
if (!isNaN(asNumber)) return event.withValue(()=>asNumber
|
||||||
|
|
@ -42466,8 +42466,10 @@ class Pattern {
|
||||||
...event.context,
|
...event.context,
|
||||||
type: 'midi'
|
type: 'midi'
|
||||||
});
|
});
|
||||||
throw new Error('cannot parse as number: "' + event.value + '"');
|
if (!silent) throw new Error('cannot parse as number: "' + event.value + '"');
|
||||||
});
|
return event.withValue(()=>undefined
|
||||||
|
); // silent error
|
||||||
|
})._removeUndefineds();
|
||||||
}
|
}
|
||||||
add(other) {
|
add(other) {
|
||||||
return this._asNumber()._opleft(other, (a)=>(b)=>a + b
|
return this._asNumber()._opleft(other, (a)=>(b)=>a + b
|
||||||
|
|
@ -136201,7 +136203,9 @@ _strudelMjs.Pattern.prototype.draw = function(callback, cycleSpan, lookaheadCycl
|
||||||
cycle = currentCycle;
|
cycle = currentCycle;
|
||||||
const begin = currentCycle * cycleSpan;
|
const begin = currentCycle * cycleSpan;
|
||||||
const end = (currentCycle + lookaheadCycles) * cycleSpan;
|
const end = (currentCycle + lookaheadCycles) * cycleSpan;
|
||||||
events = this.add(0).query(new State(new TimeSpan(begin, end)));
|
events = this._asNumber(true) // true = silent error
|
||||||
|
.query(new State(new TimeSpan(begin, end))).filter((event)=>event.part.begin.valueOf() === event.whole.begin.valueOf()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
callback(ctx, events, t, cycleSpan, time);
|
callback(ctx, events, t, cycleSpan, time);
|
||||||
|
|
@ -171654,7 +171658,7 @@ function useCycle(props) {
|
||||||
).forEach((event)=>{
|
).forEach((event)=>{
|
||||||
_tone.getTransport().schedule((time)=>{
|
_tone.getTransport().schedule((time)=>{
|
||||||
const toneEvent = {
|
const toneEvent = {
|
||||||
time: event.part.begin.valueOf(),
|
time: event.whole.begin.valueOf(),
|
||||||
duration: event.whole.end.sub(event.whole.begin).valueOf(),
|
duration: event.whole.end.sub(event.whole.begin).valueOf(),
|
||||||
value: event.value,
|
value: event.value,
|
||||||
context: event.context
|
context: event.context
|
||||||
|
|
@ -182991,4 +182995,4 @@ exports.default = cx;
|
||||||
|
|
||||||
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
|
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
|
||||||
|
|
||||||
//# sourceMappingURL=index.a8828e57.js.map
|
//# sourceMappingURL=index.5025d817.js.map
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -11,6 +11,6 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<script src="/tutorial/index.a8828e57.js" defer=""></script>
|
<script src="/tutorial/index.5025d817.js" defer=""></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue