From 420a955314b640bacd16b5faa199ffa19f31feba Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 27 Feb 2022 21:36:35 +0100 Subject: [PATCH] fix tests --- strudel.mjs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/strudel.mjs b/strudel.mjs index 45ec1c31..58033baa 100644 --- a/strudel.mjs +++ b/strudel.mjs @@ -469,23 +469,23 @@ class Pattern { _asNumber() { return this._withEvent(event => { - const asNumber = Number(event.value) - if(!isNaN(asNumber)) { - return asNumber; + const asNumber = Number(event.value); + if (!isNaN(asNumber)) { + return event.withValue(() => asNumber); } const specialValue = { e: Math.E, - pi: Math.PI + pi: Math.PI, }[event.value]; - if(typeof specialValue !== 'undefined') { - return specialValue; + if (typeof specialValue !== 'undefined') { + 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 return new Hap(event.whole, event.part, toMidi(event.value), { ...event.context, type: 'midi' }); } throw new Error('cannot parse as number: "' + event.value + '"'); - }) + }); } add(other) {