mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 04:28:30 +00:00
fix tests
This commit is contained in:
parent
8a7e49780a
commit
420a955314
16
strudel.mjs
16
strudel.mjs
@ -469,23 +469,23 @@ class Pattern {
|
|||||||
|
|
||||||
_asNumber() {
|
_asNumber() {
|
||||||
return this._withEvent(event => {
|
return this._withEvent(event => {
|
||||||
const asNumber = Number(event.value)
|
const asNumber = Number(event.value);
|
||||||
if(!isNaN(asNumber)) {
|
if (!isNaN(asNumber)) {
|
||||||
return asNumber;
|
return event.withValue(() => asNumber);
|
||||||
}
|
}
|
||||||
const specialValue = {
|
const specialValue = {
|
||||||
e: Math.E,
|
e: Math.E,
|
||||||
pi: Math.PI
|
pi: Math.PI,
|
||||||
}[event.value];
|
}[event.value];
|
||||||
if(typeof specialValue !== 'undefined') {
|
if (typeof specialValue !== 'undefined') {
|
||||||
return specialValue;
|
return event.withValue(() => specialValue);
|
||||||
}
|
}
|
||||||
if(isNote(event.value)) {
|
if (isNote(event.value)) {
|
||||||
// set context type to midi to let the player know its meant as midi number and not as frequency
|
// set context type to midi to let the player know its meant as midi number and not as frequency
|
||||||
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 + '"');
|
throw new Error('cannot parse as number: "' + event.value + '"');
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
add(other) {
|
add(other) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user