This commit is contained in:
Felix Roos 2022-03-11 22:03:58 +01:00
parent 1d1d29a163
commit cbd1bde7e6
12 changed files with 379 additions and 30 deletions

View file

@ -5,12 +5,15 @@ import "./voicings.js";
import "./tonal.js";
import "./xen.js";
import "./tune.js";
import "./tonal.js";
import "./tune.js";
import "./pianoroll.js";
import * as drawHelpers from "./draw.js";
import gist from "./gist.js";
import shapeshifter from "./shapeshifter.js";
import {minify} from "./parse.js";
import * as Tone from "../_snowpack/pkg/tone.js";
import * as toneHelpers from "./tone.js";
import * as voicingHelpers from "./voicings.js";
const bootstrapped = {...strudel, ...strudel.Pattern.prototype.bootstrap()};
function hackLiteral(literal, names, func) {
names.forEach((name) => {
@ -23,9 +26,10 @@ function hackLiteral(literal, names, func) {
}
hackLiteral(String, ["mini", "m"], bootstrapped.mini);
hackLiteral(String, ["pure", "p"], bootstrapped.pure);
Object.assign(globalThis, bootstrapped, Tone, toneHelpers, {gist});
Object.assign(globalThis, bootstrapped, Tone, toneHelpers, voicingHelpers, drawHelpers, {gist});
export const evaluate = async (code) => {
const shapeshifted = shapeshifter(code);
drawHelpers.cleanup();
let evaluated = await eval(shapeshifted);
if (typeof evaluated === "function") {
evaluated = evaluated();