Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@elemaudio/core

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elemaudio/core - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0-alpha.0

504

./dist/index.js

@@ -554,3 +554,2 @@ var __defProp = Object.defineProperty;

$$Set: () => $$Set,
NodeRepr: () => NodeRepr,
RenderDelegate: () => RenderDelegate,

@@ -563,6 +562,10 @@ mount: () => mount,

// node_modules/rescript/lib/es6/js_exn.js
function raiseError(str) {
throw new Error(str);
}
// src/NodeRepr.bs.js
var NodeRepr_bs_exports = {};
__export(NodeRepr_bs_exports, {
create: () => create,
isNode: () => isNode,
shallowCopy: () => shallowCopy,
symbol: () => symbol
});

@@ -638,2 +641,15 @@ // node_modules/rescript/lib/es6/js_types.js

// node_modules/rescript/lib/es6/caml_option.js
function some(x) {
if (x === void 0) {
return {
BS_PRIVATE_NESTED_SOME_NONE: 0
};
} else if (x !== null && x.BS_PRIVATE_NESTED_SOME_NONE !== void 0) {
return {
BS_PRIVATE_NESTED_SOME_NONE: x.BS_PRIVATE_NESTED_SOME_NONE + 1 | 0
};
} else {
return x;
}
}
function valFromOption(x) {

@@ -836,19 +852,2 @@ if (!(x !== null && x.BS_PRIVATE_NESTED_SOME_NONE !== void 0)) {

}
function everyU(_xs, p) {
while (true) {
var xs = _xs;
if (!xs) {
return true;
}
if (!p(xs.hd)) {
return false;
}
_xs = xs.tl;
continue;
}
;
}
function every(xs, p) {
return everyU(xs, __1(p));
}

@@ -868,2 +867,3 @@ // src/Hash.ts

renderer.setProperty(hash, key, value);
prevProps[key] = value;
}

@@ -874,2 +874,9 @@ }

// node_modules/rescript/lib/es6/js_dict.js
function get(dict, k) {
if (k in dict) {
return some(dict[k]);
}
}
// node_modules/rescript/lib/es6/js_option.js

@@ -899,35 +906,22 @@ function getExn(x) {

var r = hashString(-2128831035, kind);
var r2 = test(props.key, 4) ? hashString(r, props.key) : hashString(r, getExn(JSON.stringify(props)));
var k = get(props, "key");
var r2 = k !== void 0 && test(k, 4) ? hashString(r, k) : hashString(r, getExn(JSON.stringify(props)));
return reduceU(children, r2, mixNumber) & 2147483647;
}
// src/Reconciler.bs.js
var symbol = Symbol.for("ELEM_NODE");
function createPrimitive(kind, props, children) {
// src/NodeRepr.bs.js
var symbol = "__ELEM_NODE__";
function create(kind, props, children) {
var childrenList = fromArray(children);
var childHashes = map(childrenList, function(n) {
return n.hash;
});
return {
symbol,
kind: {
NAME: "Primitive",
VAL: kind
},
hash: hashNode(kind, props, childHashes),
kind,
props,
children: fromArray(children)
children: childrenList
};
}
function createComposite(fn, props, children) {
return {
symbol,
kind: {
NAME: "Composite",
VAL: [
{
contents: void 0
},
fn
]
},
props,
children: fromArray(children)
};
}
function isNode(a) {

@@ -942,3 +936,3 @@ var match = classify(a);

var s = classify(a.symbol);
if (typeof s === "number" || s.TAG !== 4) {
if (typeof s === "number" || s.TAG !== 1) {
return false;

@@ -949,34 +943,15 @@ } else {

}
function getHashUnchecked(n) {
var x = n.hash;
if (x !== void 0) {
return x;
} else {
return raiseError("Missing hash property");
}
}
function shallowCopy(node) {
var match = node.kind;
if (match.NAME === "Composite") {
return raiseError("Attempting to shallow copy a composite node");
} else {
return {
symbol,
hash: getHashUnchecked(node),
kind: match.VAL,
props: Object.assign({}, node.props),
generation: {
contents: 0
}
};
}
return {
symbol: node.symbol,
hash: node.hash,
kind: node.kind,
props: Object.assign({}, node.props),
generation: {
contents: 0
}
};
}
var NodeRepr = {
symbol,
createPrimitive,
createComposite,
isNode,
getHashUnchecked,
shallowCopy
};
// src/Reconciler.bs.js
function valuesArray(m) {

@@ -990,16 +965,16 @@ return Array.from(m.values());

var RenderDelegate = {};
function mount(delegate, node, kind, hash, childHashes) {
function mount(delegate, node) {
var nodeMap = delegate.getNodeMap();
if (nodeMap.has(hash)) {
var existing = nodeMap.get(hash);
updateNodeProps2(delegate, hash, existing.props, node.props);
nodeMap.set(hash, shallowCopy(node));
if (nodeMap.has(node.hash)) {
var existing = nodeMap.get(node.hash);
updateNodeProps2(delegate, existing.hash, existing.props, node.props);
existing.generation.contents = 0;
return;
}
delegate.createNode(hash, kind);
updateNodeProps2(delegate, hash, {}, node.props);
forEach(childHashes, function(ch) {
delegate.appendChild(hash, ch);
delegate.createNode(node.hash, node.kind);
updateNodeProps2(delegate, node.hash, {}, node.props);
forEach(node.children, function(child) {
delegate.appendChild(node.hash, child.hash);
});
nodeMap.set(hash, shallowCopy(node));
nodeMap.set(node.hash, shallowCopy(node));
}

@@ -1009,4 +984,4 @@ function visit(delegate, visitSet, _ns) {

var ns = _ns;
var visited = function(x) {
return visitSet.has(x);
var markVisited = function(n2) {
visitSet.add(n2.hash);
};

@@ -1018,41 +993,9 @@ if (!ns) {

var n = ns.hd;
if (visitSet.has(n)) {
if (visitSet.has(n.hash)) {
_ns = rest;
continue;
}
var childrenVisited = every(n.children, visited);
if (childrenVisited) {
var childHashes = map(n.children, function(child) {
return getExn(child.hash);
});
var match = n.kind;
if (match.NAME === "Composite") {
var match$1 = match.VAL;
var res = match$1[0];
var context = delegate.getRenderContext();
var n$1 = res.contents;
var resolved = n$1 !== void 0 ? n$1 : _1(match$1[1], {
context,
props: n.props,
children: toArray(n.children)
});
res.contents = resolved;
if (visitSet.has(resolved)) {
n.hash = getExn(resolved.hash);
visitSet.add(n);
_ns = rest;
continue;
}
_ns = add(add(rest, n), resolved);
continue;
}
var k = match.VAL;
var hash = hashNode(k, n.props, childHashes);
n.hash = hash;
mount(delegate, n, k, hash, childHashes);
visitSet.add(n);
_ns = rest;
continue;
}
_ns = concat(n.children, ns);
markVisited(n);
mount(delegate, n);
_ns = concat(n.children, rest);
continue;

@@ -1065,3 +1008,3 @@ }

var roots = mapWithIndex(fromArray(graphs), function(i, g) {
return createPrimitive("root", {
return create("root", {
channel: i

@@ -1071,3 +1014,5 @@ }, [g]);

visit(delegate, visitSet, roots);
delegate.activateRoots(toArray(map(roots, getHashUnchecked)));
delegate.activateRoots(toArray(map(roots, function(r) {
return r.hash;
})));
delegate.commitUpdates();

@@ -1098,13 +1043,2 @@ }

var ReconcilerBS = Reconciler_bs_exports;
var NodeRepr_createPrimitive = function(Arg1, Arg2, Arg3) {
const result = Curry._3(ReconcilerBS.NodeRepr.createPrimitive, Arg1, Arg2, Arg3);
return result;
};
var NodeRepr_createComposite = function(Arg1, Arg2, Arg3) {
const result = Curry._3(ReconcilerBS.NodeRepr.createComposite, Arg1, Arg2, Arg3);
return result;
};
var NodeRepr_isNode = ReconcilerBS.NodeRepr.isNode;
var NodeRepr_getHashUnchecked = ReconcilerBS.NodeRepr.getHashUnchecked;
var NodeRepr_shallowCopy = ReconcilerBS.NodeRepr.shallowCopy;
var renderWithDelegate2 = function(Arg1, Arg2) {

@@ -1116,2 +1050,12 @@ const result = Curry._2(ReconcilerBS.renderWithDelegate, Arg1, Arg2);

// src/NodeRepr.gen.ts
var Curry2 = curry_exports;
var NodeReprBS = NodeRepr_bs_exports;
var create2 = function(Arg1, Arg2, Arg3) {
const result = Curry2._3(NodeReprBS.create, Arg1, Arg2, Arg3);
return result;
};
var isNode2 = NodeReprBS.isNode;
var shallowCopy2 = NodeReprBS.shallowCopy;
// nodeUtils.ts

@@ -1121,22 +1065,13 @@ import invariant from "invariant";

if (typeof n === "number")
return NodeRepr_createPrimitive("const", { value: n }, []);
invariant(isNode2(n), `Whoops, expecting a Node type here! Got: ${typeof n}`);
return create2("const", { value: n }, []);
invariant(isNode3(n), `Whoops, expecting a Node type here! Got: ${typeof n}`);
return n;
}
function isNode2(n) {
return NodeRepr_isNode(n);
function isNode3(n) {
return isNode2(n);
}
function createNode(kind, props, children) {
if (typeof kind === "string") {
return NodeRepr_createPrimitive(kind, props, children.map(resolve));
}
console.warn("WARNING: Support for composite nodes are deprecated as of v2.1.0, and will be removed in v3");
return NodeRepr_createComposite(kind, props, children.map(resolve));
return create2(kind, props, children.map(resolve));
}
// src/Events.ts
import events from "events";
var EventEmitter = class extends events.EventEmitter {
};
// lib/core.ts

@@ -1158,5 +1093,7 @@ var core_exports = {};

metro: () => metro,
mm1p: () => mm1p,
once: () => once,
phasor: () => phasor,
pole: () => pole,
prewarp: () => prewarp,
rand: () => rand,

@@ -1170,5 +1107,7 @@ sample: () => sample,

sparseq: () => sparseq,
sparseq2: () => sparseq2,
sr: () => sr,
svf: () => svf,
svfshelf: () => svfshelf,
syncphasor: () => syncphasor,
table: () => table,

@@ -1190,3 +1129,3 @@ tapIn: () => tapIn,

function counter(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("counter", {}, [resolve(a)]);

@@ -1197,3 +1136,3 @@ }

function accum(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("accum", {}, [resolve(a), resolve(b)]);

@@ -1203,10 +1142,16 @@ }

}
function phasor(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
return createNode("phasor", {}, [resolve(a), resolve(b)]);
function phasor(a, b) {
if (typeof a === "number" || isNode3(a)) {
return createNode("phasor", {}, [resolve(a)]);
}
return createNode("phasor", a, [resolve(b), resolve(c)]);
return createNode("phasor", a, [resolve(b)]);
}
function syncphasor(a, b, c) {
if (typeof a === "number" || isNode3(a)) {
return createNode("sphasor", {}, [resolve(a), resolve(b)]);
}
return createNode("sphasor", a, [resolve(b), resolve(c)]);
}
function latch(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("latch", {}, [resolve(a), resolve(b)]);

@@ -1217,3 +1162,3 @@ }

function maxhold(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("maxhold", {}, [resolve(a), resolve(b)]);

@@ -1224,3 +1169,3 @@ }

function once(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("once", {}, [resolve(a)]);

@@ -1260,4 +1205,7 @@ }

}
function sparseq2(props, time2) {
return createNode("sparseq2", props, [resolve(time2)]);
}
function pole(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("pole", {}, [resolve(a), resolve(b)]);

@@ -1268,3 +1216,3 @@ }

function env(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("env", {}, [resolve(a), resolve(b), resolve(c)]);

@@ -1275,3 +1223,3 @@ }

function z(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("z", {}, [resolve(a)]);

@@ -1282,3 +1230,3 @@ }

function delay(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("delay", {}, [resolve(a), resolve(b), resolve(c)]);

@@ -1291,4 +1239,19 @@ }

}
function prewarp(fc) {
return createNode("prewarp", {}, [fc]);
}
function mm1p(a, b, c) {
if (typeof a === "number" || isNode3(a)) {
return createNode("mm1p", {}, [
resolve(a),
resolve(b)
]);
}
return createNode("mm1p", a, [
resolve(b),
resolve(c)
]);
}
function svf(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("svf", {}, [

@@ -1307,3 +1270,3 @@ resolve(a),

function svfshelf(a, b, c, d, e) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("svfshelf", {}, [

@@ -1324,3 +1287,3 @@ resolve(a),

function biquad(a, b, c, d, e, f, g) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("biquad", {}, [

@@ -1351,3 +1314,3 @@ resolve(a),

function meter(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("meter", {}, [resolve(a)]);

@@ -1358,3 +1321,3 @@ }

function snapshot(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("snapshot", {}, [resolve(a), resolve(b)]);

@@ -1365,3 +1328,3 @@ }

function scope(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("scope", {}, [a, ...bs].map(resolve));

@@ -1372,3 +1335,3 @@ }

function fft(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("fft", {}, [resolve(a)]);

@@ -1379,3 +1342,3 @@ }

function capture(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("capture", {}, [resolve(a), resolve(b)]);

@@ -1426,45 +1389,45 @@ }

function identity(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("in", {}, [resolve(a)]) : typeof b === "number" || isNode2(b) ? createNode("in", a, [resolve(b)]) : createNode("in", a, []);
return typeof a === "number" || isNode3(a) ? createNode("in", {}, [resolve(a)]) : typeof b === "number" || isNode3(b) ? createNode("in", a, [resolve(b)]) : createNode("in", a, []);
}
function sin(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("sin", {}, [resolve(a)]) : createNode("sin", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("sin", {}, [resolve(a)]) : createNode("sin", a, [resolve(b)]);
}
function cos(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("cos", {}, [resolve(a)]) : createNode("cos", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("cos", {}, [resolve(a)]) : createNode("cos", a, [resolve(b)]);
}
function tan(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("tan", {}, [resolve(a)]) : createNode("tan", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("tan", {}, [resolve(a)]) : createNode("tan", a, [resolve(b)]);
}
function tanh(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("tanh", {}, [resolve(a)]) : createNode("tanh", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("tanh", {}, [resolve(a)]) : createNode("tanh", a, [resolve(b)]);
}
function asinh(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("asinh", {}, [resolve(a)]) : createNode("asinh", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("asinh", {}, [resolve(a)]) : createNode("asinh", a, [resolve(b)]);
}
function ln(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("ln", {}, [resolve(a)]) : createNode("ln", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("ln", {}, [resolve(a)]) : createNode("ln", a, [resolve(b)]);
}
function log(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("log", {}, [resolve(a)]) : createNode("log", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("log", {}, [resolve(a)]) : createNode("log", a, [resolve(b)]);
}
function log2(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("log2", {}, [resolve(a)]) : createNode("log2", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("log2", {}, [resolve(a)]) : createNode("log2", a, [resolve(b)]);
}
function ceil(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("ceil", {}, [resolve(a)]) : createNode("ceil", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("ceil", {}, [resolve(a)]) : createNode("ceil", a, [resolve(b)]);
}
function floor(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("floor", {}, [resolve(a)]) : createNode("floor", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("floor", {}, [resolve(a)]) : createNode("floor", a, [resolve(b)]);
}
function sqrt(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("sqrt", {}, [resolve(a)]) : createNode("sqrt", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("sqrt", {}, [resolve(a)]) : createNode("sqrt", a, [resolve(b)]);
}
function exp(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("exp", {}, [resolve(a)]) : createNode("exp", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("exp", {}, [resolve(a)]) : createNode("exp", a, [resolve(b)]);
}
function abs(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("abs", {}, [resolve(a)]) : createNode("abs", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("abs", {}, [resolve(a)]) : createNode("abs", a, [resolve(b)]);
}
function le(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("le", {}, [resolve(a), resolve(b)]);

@@ -1475,3 +1438,3 @@ }

function leq(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("leq", {}, [resolve(a), resolve(b)]);

@@ -1482,3 +1445,3 @@ }

function ge(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("ge", {}, [resolve(a), resolve(b)]);

@@ -1489,3 +1452,3 @@ }

function geq(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("geq", {}, [resolve(a), resolve(b)]);

@@ -1496,3 +1459,3 @@ }

function pow(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("pow", {}, [resolve(a), resolve(b)]);

@@ -1503,3 +1466,3 @@ }

function eq(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("eq", {}, [resolve(a), resolve(b)]);

@@ -1510,3 +1473,3 @@ }

function and(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("and", {}, [resolve(a), resolve(b)]);

@@ -1517,3 +1480,3 @@ }

function or(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("or", {}, [resolve(a), resolve(b)]);

@@ -1524,3 +1487,3 @@ }

function add2(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("add", {}, [a, ...bs].map(resolve));

@@ -1531,3 +1494,3 @@ }

function sub2(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("sub", {}, [a, ...bs].map(resolve));

@@ -1538,3 +1501,3 @@ }

function mul(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("mul", {}, [a, ...bs].map(resolve));

@@ -1545,3 +1508,3 @@ }

function div(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("div", {}, [a, ...bs].map(resolve));

@@ -1552,3 +1515,3 @@ }

function mod(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("mod", {}, [a, ...bs].map(resolve));

@@ -1559,3 +1522,3 @@ }

function min2(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("min", {}, [a, ...bs].map(resolve));

@@ -1566,3 +1529,3 @@ }

function max2(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("max", {}, [a, ...bs].map(resolve));

@@ -1606,3 +1569,3 @@ }

function compress(a_, b_, c_, d_, e_, f_, g_) {
let children = typeof a_ === "number" || isNode2(a_) ? [a_, b_, c_, d_, e_, f_] : [b_, c_, d_, e_, f_, g_];
let children = typeof a_ === "number" || isNode3(a_) ? [a_, b_, c_, d_, e_, f_] : [b_, c_, d_, e_, f_, g_];
const [atkMs, relMs, threshold, ratio, sidechain, xn] = children;

@@ -1642,3 +1605,3 @@ const env2 = el2.env(el2.tau2pole(el2.mul(1e-3, atkMs)), el2.tau2pole(el2.mul(1e-3, relMs)), sidechain);

function smooth(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.pole(a, el3.mul(el3.sub(1, a), b));

@@ -1649,3 +1612,3 @@ }

function sm(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return smooth(el3.tau2pole(0.02), a);

@@ -1656,15 +1619,15 @@ }

function zero(a, b, c, d) {
let [b0, b1, x] = typeof a === "number" || isNode2(a) ? [a, b, c] : [b, c, d];
let [b0, b1, x] = typeof a === "number" || isNode3(a) ? [a, b, c] : [b, c, d];
return el3.sub(el3.mul(b0, x), el3.mul(b1, el3.z(x)));
}
function dcblock(a, b) {
let x = typeof a === "number" || isNode2(a) ? a : b;
let x = typeof a === "number" || isNode3(a) ? a : b;
return el3.pole(0.995, zero(1, 1, x));
}
function df11(a, b, c, d, e) {
let [b0, b1, a1, x] = typeof a === "number" || isNode2(a) ? [a, b, c, d] : [b, c, d, e];
let [b0, b1, a1, x] = typeof a === "number" || isNode3(a) ? [a, b, c, d] : [b, c, d, e];
return el3.pole(a1, zero(b0, b1, x));
}
function lowpass(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "lowpass" }, a, b, c);

@@ -1675,3 +1638,3 @@ }

function highpass(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "highpass" }, a, b, c);

@@ -1682,3 +1645,3 @@ }

function bandpass(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "bandpass" }, a, b, c);

@@ -1689,3 +1652,3 @@ }

function notch(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "notch" }, a, b, c);

@@ -1696,3 +1659,3 @@ }

function allpass(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "allpass" }, a, b, c);

@@ -1703,3 +1666,3 @@ }

function peak(a, b, c, d, e) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svfshelf({ mode: "peak" }, a, b, c, d);

@@ -1710,3 +1673,3 @@ }

function lowshelf(a, b, c, d, e) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svfshelf({ mode: "lowshelf" }, a, b, c, d);

@@ -1717,3 +1680,3 @@ }

function highshelf(a, b, c, d, e) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svfshelf({ mode: "highshelf" }, a, b, c, d);

@@ -1724,3 +1687,3 @@ }

function pink(a, b) {
let x = typeof a === "number" || isNode2(a) ? a : b;
let x = typeof a === "number" || isNode3(a) ? a : b;
let clip = (min3, max3, x2) => el3.min(max3, el3.max(min3, x2));

@@ -1733,3 +1696,3 @@ return clip(-1, 1, el3.mul(el3.db2gain(-30), el3.add(el3.pole(0.99765, el3.mul(x, 0.099046)), el3.pole(0.963, el3.mul(x, 0.2965164)), el3.pole(0.57, el3.mul(x, 1.0526913)), el3.mul(0.1848, x))));

function adsr(a_, b_, c_, d_, e_, f_) {
let children = typeof a_ === "number" || isNode2(a_) ? [a_, b_, c_, d_, e_] : [b_, c_, d_, e_, f_];
let children = typeof a_ === "number" || isNode3(a_) ? [a_, b_, c_, d_, e_] : [b_, c_, d_, e_, f_];
let [a, d, s, r, g] = children;

@@ -1760,3 +1723,3 @@ let atkSamps = el4.mul(a, el4.sr());

function train(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el5.le(el5.phasor(a, 0), 0.5);

@@ -1767,12 +1730,12 @@ }

function cycle(a, b) {
return typeof a === "number" || isNode2(a) ? el5.sin(el5.mul(2 * Math.PI, el5.phasor(a, 0))) : el5.sin(el5.mul(2 * Math.PI, el5.phasor(a, b, 0)));
return typeof a === "number" || isNode3(a) ? el5.sin(el5.mul(2 * Math.PI, el5.phasor(a, 0))) : el5.sin(el5.mul(2 * Math.PI, el5.phasor(a, b, 0)));
}
function saw(a, b) {
return typeof a === "number" || isNode2(a) ? el5.sub(el5.mul(2, el5.phasor(a, 0)), 1) : el5.sub(el5.mul(2, el5.phasor(a, b, 0)), 1);
return typeof a === "number" || isNode3(a) ? el5.sub(el5.mul(2, el5.phasor(a, 0)), 1) : el5.sub(el5.mul(2, el5.phasor(a, b, 0)), 1);
}
function square(a, b) {
return typeof a === "number" || isNode2(a) ? el5.sub(el5.mul(2, train(a)), 1) : el5.sub(el5.mul(2, train(a, b)), 1);
return typeof a === "number" || isNode3(a) ? el5.sub(el5.mul(2, train(a)), 1) : el5.sub(el5.mul(2, train(a, b)), 1);
}
function triangle(a, b) {
return typeof a === "number" || isNode2(a) ? el5.mul(2, el5.sub(0.5, el5.abs(saw(a)))) : el5.mul(2, el5.sub(0.5, el5.abs(saw(a, b))));
return typeof a === "number" || isNode3(a) ? el5.mul(2, el5.sub(0.5, el5.abs(saw(a)))) : el5.mul(2, el5.sub(0.5, el5.abs(saw(a, b))));
}

@@ -1787,3 +1750,3 @@ function polyblep(step, phase) {

function blepsaw(a, b) {
let hasProps = !(typeof a === "number" || isNode2(a));
let hasProps = !(typeof a === "number" || isNode3(a));
let props = hasProps ? a : {};

@@ -1797,3 +1760,3 @@ let rate = hasProps ? b : a;

function blepsquare(a, b) {
let hasProps = !(typeof a === "number" || isNode2(a));
let hasProps = !(typeof a === "number" || isNode3(a));
let props = hasProps ? a : {};

@@ -1810,3 +1773,3 @@ let rate = hasProps ? b : a;

function bleptriangle(a, b) {
let hasProps = !(typeof a === "number" || isNode2(a));
let hasProps = !(typeof a === "number" || isNode3(a));
let props = hasProps ? a : {};

@@ -1830,2 +1793,7 @@ let rate = hasProps ? b : a;

// src/Events.ts
import events from "events";
var EventEmitter = class extends events.EventEmitter {
};
// index.ts

@@ -1845,3 +1813,8 @@ var stdlib = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, core_exports), dynamics_exports), envelopes_exports), filters_exports), math_exports), oscillators_exports), signals_exports), {

var Delegate = class {
constructor(sampleRate, batchHandler) {
constructor() {
this.nodeMap = /* @__PURE__ */ new Map();
this.currentActiveRoots = /* @__PURE__ */ new Set();
this.clear();
}
clear() {
this.nodesAdded = 0;

@@ -1851,12 +1824,10 @@ this.nodesRemoved = 0;

this.propsWritten = 0;
this.nodeMap = /* @__PURE__ */ new Map();
this.currentActiveRoots = /* @__PURE__ */ new Set();
this.renderContext = {
sampleRate,
blockSize: 512,
numInputs: 1,
numOutputs: 1
this.batch = {
createNode: [],
deleteNode: [],
appendChild: [],
setProperty: [],
activateRoots: [],
commitUpdates: []
};
this.batch = [];
this.batchHandler = batchHandler;
}

@@ -1869,20 +1840,17 @@ getNodeMap() {

}
getRenderContext() {
return this.renderContext;
}
createNode(hash, type) {
this.nodesAdded++;
this.batch.push([InstructionTypes.CREATE_NODE, hash, type]);
this.batch.createNode.push([InstructionTypes.CREATE_NODE, hash, type]);
}
deleteNode(hash) {
this.nodesRemoved++;
this.batch.push([InstructionTypes.DELETE_NODE, hash]);
this.batch.deleteNode.push([InstructionTypes.DELETE_NODE, hash]);
}
appendChild(parentHash, childHash) {
this.edgesAdded++;
this.batch.push([InstructionTypes.APPEND_CHILD, parentHash, childHash]);
this.batch.appendChild.push([InstructionTypes.APPEND_CHILD, parentHash, childHash]);
}
setProperty(hash, key, value) {
this.propsWritten++;
this.batch.push([InstructionTypes.SET_PROPERTY, hash, key, value]);
this.batch.setProperty.push([InstructionTypes.SET_PROPERTY, hash, key, value]);
}

@@ -1892,3 +1860,3 @@ activateRoots(roots) {

if (!alreadyActive) {
this.batch.push([InstructionTypes.ACTIVATE_ROOTS, roots]);
this.batch.activateRoots.push([InstructionTypes.ACTIVATE_ROOTS, roots]);
this.currentActiveRoots = new Set(roots);

@@ -1898,6 +1866,14 @@ }

commitUpdates() {
this.batch.push([InstructionTypes.COMMIT_UPDATES]);
this.batchHandler(this.batch);
this.batch = [];
this.batch.commitUpdates.push([InstructionTypes.COMMIT_UPDATES]);
}
getPackedInstructions() {
return [
...this.batch.createNode,
...this.batch.deleteNode,
...this.batch.appendChild,
...this.batch.setProperty,
...this.batch.activateRoots,
...this.batch.commitUpdates
];
}
};

@@ -1911,15 +1887,28 @@ function now() {

var Renderer = class {
constructor(sampleRate, sendMessage) {
this._delegate = new Delegate(sampleRate, (batch) => {
sendMessage(batch);
});
constructor(sendMessage) {
this._delegate = new Delegate();
this._sendMessage = sendMessage;
this._nextRefId = 0;
}
createRef(kind, props, children) {
let key = `__refKey:${this._nextRefId++}`;
let node = createNode(kind, Object.assign({ key }, props), children);
let setter = (newProps) => {
if (!this._delegate.nodeMap.has(node.hash)) {
throw new Error("Cannot update a ref that has not been mounted; make sure you render your node first");
}
const nodeMapCopy = this._delegate.nodeMap.get(node.hash);
this._delegate.clear();
updateNodeProps(this._delegate, node.hash, nodeMapCopy.props, newProps);
this._delegate.commitUpdates();
this._sendMessage(this._delegate.getPackedInstructions());
};
return [node, setter];
}
render(...args) {
const t0 = now();
this._delegate.nodesAdded = 0;
this._delegate.nodesRemoved = 0;
this._delegate.edgesAdded = 0;
this._delegate.propsWritten = 0;
this._delegate.clear();
renderWithDelegate2(this._delegate, args.map(resolve));
const t1 = now();
this._sendMessage(this._delegate.getPackedInstructions());
return {

@@ -1934,2 +1923,3 @@ nodesAdded: this._delegate.nodesAdded,

export {
Delegate,
EventEmitter,

@@ -1939,3 +1929,3 @@ Renderer,

stdlib as el,
isNode2 as isNode,
isNode3 as isNode,
renderWithDelegate2 as renderWithDelegate,

@@ -1942,0 +1932,0 @@ resolve,

import events from 'events';
declare type NodeRepr_symbol$1 = Symbol;
declare abstract class EmptyList {

@@ -13,50 +11,39 @@ protected opaque: any;

declare abstract class NodeRepr_props {
declare abstract class props {
protected opaque: any;
}
declare type NodeRepr_renderContext = {
readonly sampleRate: number;
readonly blockSize: number;
readonly numInputs: number;
readonly numOutputs: number;
declare type t = {
readonly symbol: string;
readonly hash: number;
readonly kind: string;
readonly props: props;
readonly children: list<t>;
};
declare type NodeRepr_symbol = NodeRepr_symbol$1;
declare type NodeRepr_t = {
readonly symbol: NodeRepr_symbol;
hash?: number;
readonly kind: {
NAME: "Composite";
VAL: [
{
contents: (null | undefined | NodeRepr_t);
},
(_1: {
readonly props: NodeRepr_props;
readonly context: NodeRepr_renderContext;
readonly children: NodeRepr_t[];
}) => NodeRepr_t
];
} | {
NAME: "Primitive";
VAL: string;
};
readonly props: NodeRepr_props;
readonly children: list<NodeRepr_t>;
};
declare type ElemNode = t | number;
declare function resolve(n: ElemNode): t;
declare function isNode(n: unknown): n is t;
declare function createNode(kind: string, props: any, children: Array<ElemNode>): t;
declare abstract class RenderDelegate_t {
protected opaque: any;
}
declare const NodeRepr_createPrimitive: <T1>(kind: string, props: T1, children: NodeRepr_t[]) => NodeRepr_t;
declare const NodeRepr_createComposite: <T1>(fn: ((_1: {
readonly children: NodeRepr_t[];
readonly context: NodeRepr_renderContext;
readonly props: NodeRepr_props;
}) => NodeRepr_t), props: T1, children: NodeRepr_t[]) => NodeRepr_t;
declare const renderWithDelegate: (delegate: RenderDelegate_t, graphs: NodeRepr_t[]) => void;
declare const renderWithDelegate: (delegate: RenderDelegate_t, graphs: t[]) => void;
declare const stepGarbageCollector: (delegate: RenderDelegate_t) => void;
declare function resolve(n: NodeRepr_t | number): NodeRepr_t;
declare function isNode(n: unknown): n is NodeRepr_t;
declare function createNode(kind: Parameters<typeof NodeRepr_createPrimitive>[0] | Parameters<typeof NodeRepr_createComposite>[0], props: any, children: Array<NodeRepr_t | number>): NodeRepr_t;
declare type ConstNodeProps = {
key?: string;
value: number;
};
declare function constant(props: ConstNodeProps): t;
declare type IdentityNodeProps = {
key?: string;
channel?: number;
};
declare function identity(x: ElemNode): t;
declare function identity(props: IdentityNodeProps): t;
declare function identity(props: IdentityNodeProps, x: ElemNode): t;
declare type EventListener<E> = (event: E) => void;

@@ -103,294 +90,284 @@ declare type Events = {

declare type ConstNodeProps = {
key?: string;
value: number;
};
declare function constant(props: ConstNodeProps): NodeRepr_t;
declare type IdentityNodeProps = {
key?: string;
channel?: number;
};
declare function identity(x: NodeRepr_t | number): NodeRepr_t;
declare function identity(props: IdentityNodeProps): NodeRepr_t;
declare function identity(props: IdentityNodeProps, x: NodeRepr_t | number): NodeRepr_t;
declare const stdlib: {
const: typeof constant;
in: typeof identity;
ms2samps(t: number | NodeRepr_t): number | NodeRepr_t;
tau2pole(t: number | NodeRepr_t): number | NodeRepr_t;
db2gain(db: number | NodeRepr_t): number | NodeRepr_t;
gain2db(gain: number | NodeRepr_t): number | NodeRepr_t;
select(g: number | NodeRepr_t, a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
hann(t: number | NodeRepr_t): number | NodeRepr_t;
train(rate: number | NodeRepr_t): NodeRepr_t;
ms2samps(t: ElemNode): t;
tau2pole(t: ElemNode): t;
db2gain(db: ElemNode): t;
gain2db(gain: ElemNode): t;
select(g: ElemNode, a: ElemNode, b: ElemNode): t;
hann(t: ElemNode): t;
train(rate: ElemNode): t;
train(props: {
key?: string;
}, rate: number | NodeRepr_t): NodeRepr_t;
cycle(rate: number | NodeRepr_t): NodeRepr_t;
}, rate: ElemNode): t;
cycle(rate: ElemNode): t;
cycle(props: {
key?: string;
}, rate: number | NodeRepr_t): NodeRepr_t;
saw(rate: number | NodeRepr_t): NodeRepr_t;
}, rate: ElemNode): t;
saw(rate: ElemNode): t;
saw(props: {
key?: string;
}, rate: number | NodeRepr_t): NodeRepr_t;
square(rate: number | NodeRepr_t): NodeRepr_t;
}, rate: ElemNode): t;
square(rate: ElemNode): t;
square(props: {
key?: string;
}, rate: number | NodeRepr_t): NodeRepr_t;
triangle(rate: number | NodeRepr_t): NodeRepr_t;
}, rate: ElemNode): t;
triangle(rate: ElemNode): t;
triangle(props: {
key?: string;
}, rate: number | NodeRepr_t): NodeRepr_t;
blepsaw(rate: number | NodeRepr_t): NodeRepr_t;
}, rate: ElemNode): t;
blepsaw(rate: ElemNode): t;
blepsaw(props: {
key?: string;
}, rate: number | NodeRepr_t): NodeRepr_t;
blepsquare(rate: number | NodeRepr_t): NodeRepr_t;
}, rate: ElemNode): t;
blepsquare(rate: ElemNode): t;
blepsquare(props: {
key?: string;
}, rate: number | NodeRepr_t): NodeRepr_t;
bleptriangle(rate: number | NodeRepr_t): NodeRepr_t;
}, rate: ElemNode): t;
bleptriangle(rate: ElemNode): t;
bleptriangle(props: {
key?: string;
}, rate: number | NodeRepr_t): NodeRepr_t;
noise(): NodeRepr_t;
}, rate: ElemNode): t;
noise(): t;
noise(props: {
key?: string;
seed?: number;
}): NodeRepr_t;
pinknoise(): NodeRepr_t;
}): t;
pinknoise(): t;
pinknoise(props: {
key?: string;
seed?: number;
}): NodeRepr_t;
identity(x: number | NodeRepr_t): NodeRepr_t;
}): t;
identity(x: ElemNode): t;
identity(props: {
key?: string;
channel?: number;
}): NodeRepr_t;
}): t;
identity(props: {
key?: string;
channel?: number;
}, x: number | NodeRepr_t): NodeRepr_t;
sin(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
sin(x: ElemNode): t;
sin(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
cos(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
cos(x: ElemNode): t;
cos(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
tan(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
tan(x: ElemNode): t;
tan(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
tanh(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
tanh(x: ElemNode): t;
tanh(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
asinh(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
asinh(x: ElemNode): t;
asinh(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
ln(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
ln(x: ElemNode): t;
ln(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
log(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
log(x: ElemNode): t;
log(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
log2(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
log2(x: ElemNode): t;
log2(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
ceil(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
ceil(x: ElemNode): t;
ceil(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
floor(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
floor(x: ElemNode): t;
floor(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
sqrt(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
sqrt(x: ElemNode): t;
sqrt(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
exp(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
exp(x: ElemNode): t;
exp(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
abs(x: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
abs(x: ElemNode): t;
abs(props: {
key?: string;
}, x: number | NodeRepr_t): number | NodeRepr_t;
le(a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
}, x: ElemNode): t;
le(a: ElemNode, b: ElemNode): t;
le(props: {
key?: string;
}, a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
leq(a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
}, a: ElemNode, b: ElemNode): t;
leq(a: ElemNode, b: ElemNode): t;
leq(props: {
key?: string;
}, a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
ge(a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
}, a: ElemNode, b: ElemNode): t;
ge(a: ElemNode, b: ElemNode): t;
ge(props: {
key?: string;
}, a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
geq(a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
}, a: ElemNode, b: ElemNode): t;
geq(a: ElemNode, b: ElemNode): t;
geq(props: {
key?: string;
}, a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
pow(a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
}, a: ElemNode, b: ElemNode): t;
pow(a: ElemNode, b: ElemNode): t;
pow(props: {
key?: string;
}, a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
eq(a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
}, a: ElemNode, b: ElemNode): t;
eq(a: ElemNode, b: ElemNode): t;
eq(props: {
key?: string;
}, a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
and(a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
}, a: ElemNode, b: ElemNode): t;
and(a: ElemNode, b: ElemNode): t;
and(props: {
key?: string;
}, a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
or(a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
}, a: ElemNode, b: ElemNode): t;
or(a: ElemNode, b: ElemNode): t;
or(props: {
key?: string;
}, a: number | NodeRepr_t, b: number | NodeRepr_t): number | NodeRepr_t;
add(...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
}, a: ElemNode, b: ElemNode): t;
add(...args: ElemNode[]): t;
add(props: {
key?: string;
}, ...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
sub(...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
}, ...args: ElemNode[]): t;
sub(...args: ElemNode[]): t;
sub(props: {
key?: string;
}, ...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
mul(...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
}, ...args: ElemNode[]): t;
mul(...args: ElemNode[]): t;
mul(props: {
key?: string;
}, ...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
div(...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
}, ...args: ElemNode[]): t;
div(...args: ElemNode[]): t;
div(props: {
key?: string;
}, ...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
mod(...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
}, ...args: ElemNode[]): t;
mod(...args: ElemNode[]): t;
mod(props: {
key?: string;
}, ...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
min(...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
}, ...args: ElemNode[]): t;
min(...args: ElemNode[]): t;
min(props: {
key?: string;
}, ...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
max(...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
}, ...args: ElemNode[]): t;
max(...args: ElemNode[]): t;
max(props: {
key?: string;
}, ...args: (number | NodeRepr_t)[]): number | NodeRepr_t;
smooth(p: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, ...args: ElemNode[]): t;
smooth(p: ElemNode, x: ElemNode): t;
smooth(props: {
key?: string;
}, p: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
sm(x: number | NodeRepr_t): NodeRepr_t;
}, p: ElemNode, x: ElemNode): t;
sm(x: ElemNode): t;
sm(props: {
key?: string;
}, x: number | NodeRepr_t): NodeRepr_t;
zero(b0: number | NodeRepr_t, b1: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode): t;
zero(b0: ElemNode, b1: ElemNode, x: ElemNode): t;
zero(props: {
key?: string;
}, b0: number | NodeRepr_t, b1: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
dcblock(x: number | NodeRepr_t): NodeRepr_t;
}, b0: ElemNode, b1: ElemNode, x: ElemNode): t;
dcblock(x: ElemNode): t;
dcblock(props: {
key?: string;
}, x: number | NodeRepr_t): NodeRepr_t;
df11(b0: number | NodeRepr_t, b1: number | NodeRepr_t, a1: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode): t;
df11(b0: ElemNode, b1: ElemNode, a1: ElemNode, x: ElemNode): t;
df11(props: {
key?: string;
}, b0: number | NodeRepr_t, b1: number | NodeRepr_t, a1: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
lowpass(fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, b0: ElemNode, b1: ElemNode, a1: ElemNode, x: ElemNode): t;
lowpass(fc: ElemNode, q: ElemNode, x: ElemNode): t;
lowpass(props: {
key?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
highpass(fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, x: ElemNode): t;
highpass(fc: ElemNode, q: ElemNode, x: ElemNode): t;
highpass(props: {
key?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
bandpass(fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, x: ElemNode): t;
bandpass(fc: ElemNode, q: ElemNode, x: ElemNode): t;
bandpass(props: {
key?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
notch(fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, x: ElemNode): t;
notch(fc: ElemNode, q: ElemNode, x: ElemNode): t;
notch(props: {
key?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
allpass(fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, x: ElemNode): t;
allpass(fc: ElemNode, q: ElemNode, x: ElemNode): t;
allpass(props: {
key?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
peak(fc: number | NodeRepr_t, q: number | NodeRepr_t, gainDecibels: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, x: ElemNode): t;
peak(fc: ElemNode, q: ElemNode, gainDecibels: ElemNode, x: ElemNode): t;
peak(props: {
key?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, gainDecibels: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
lowshelf(fc: number | NodeRepr_t, q: number | NodeRepr_t, gainDecibels: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, gainDecibels: ElemNode, x: ElemNode): t;
lowshelf(fc: ElemNode, q: ElemNode, gainDecibels: ElemNode, x: ElemNode): t;
lowshelf(props: {
key?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, gainDecibels: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
highshelf(fc: number | NodeRepr_t, q: number | NodeRepr_t, gainDecibels: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, gainDecibels: ElemNode, x: ElemNode): t;
highshelf(fc: ElemNode, q: ElemNode, gainDecibels: ElemNode, x: ElemNode): t;
highshelf(props: {
key?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, gainDecibels: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
pink(x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, gainDecibels: ElemNode, x: ElemNode): t;
pink(x: ElemNode): t;
pink(props: {
key?: string;
}, x: number | NodeRepr_t): NodeRepr_t;
adsr(attackSec: number | NodeRepr_t, decaySec: number | NodeRepr_t, sustain: number | NodeRepr_t, releaseSec: number | NodeRepr_t, gate: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode): t;
adsr(attackSec: ElemNode, decaySec: ElemNode, sustain: ElemNode, releaseSec: ElemNode, gate: ElemNode): t;
adsr(props: {
key?: string;
}, attackSec: number | NodeRepr_t, decaySec: number | NodeRepr_t, sustain: number | NodeRepr_t, releaseSec: number | NodeRepr_t, gate: number | NodeRepr_t): NodeRepr_t;
compress(attackMs: number | NodeRepr_t, releaseMs: number | NodeRepr_t, threshold: number | NodeRepr_t, ratio: number | NodeRepr_t, sidechain: number | NodeRepr_t, xn: number | NodeRepr_t): NodeRepr_t;
}, attackSec: ElemNode, decaySec: ElemNode, sustain: ElemNode, releaseSec: ElemNode, gate: ElemNode): t;
compress(attackMs: ElemNode, releaseMs: ElemNode, threshold: ElemNode, ratio: ElemNode, sidechain: ElemNode, xn: ElemNode): t;
compress(props: {
key?: string;
}, attackMs: number | NodeRepr_t, releaseMs: number | NodeRepr_t, threshold: number | NodeRepr_t, ratio: number | NodeRepr_t, sidechain: number | NodeRepr_t, xn: number | NodeRepr_t): NodeRepr_t;
}, attackMs: ElemNode, releaseMs: ElemNode, threshold: ElemNode, ratio: ElemNode, sidechain: ElemNode, xn: ElemNode): t;
constant(props: {
key?: string;
value: number;
}): NodeRepr_t;
sr(): NodeRepr_t;
time(): NodeRepr_t;
counter(gate: number | NodeRepr_t): NodeRepr_t;
}): t;
sr(): t;
time(): t;
counter(gate: ElemNode): t;
counter(props: {
key?: string;
}, gate: number | NodeRepr_t): NodeRepr_t;
accum(xn: number | NodeRepr_t, reset: number | NodeRepr_t): NodeRepr_t;
}, gate: ElemNode): t;
accum(xn: ElemNode, reset: ElemNode): t;
accum(props: {
key?: string;
}, xn: number | NodeRepr_t, reset: number | NodeRepr_t): NodeRepr_t;
phasor(rate: number | NodeRepr_t, reset: number | NodeRepr_t): NodeRepr_t;
}, xn: ElemNode, reset: ElemNode): t;
phasor(rate: ElemNode): t;
phasor(props: {
key?: string;
}, rate: number | NodeRepr_t, reset: number | NodeRepr_t): NodeRepr_t;
latch(t: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, rate: ElemNode): t;
syncphasor(rate: ElemNode, reset: ElemNode): t;
syncphasor(props: {
key?: string;
}, rate: ElemNode, reset: ElemNode): t;
latch(t: ElemNode, x: ElemNode): t;
latch(props: {
key?: string;
}, t: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
maxhold(x: number | NodeRepr_t, reset: number | NodeRepr_t): NodeRepr_t;
}, t: ElemNode, x: ElemNode): t;
maxhold(x: ElemNode, reset: ElemNode): t;
maxhold(props: {
key?: string;
hold?: number;
}, x: number | NodeRepr_t, reset: number | NodeRepr_t): NodeRepr_t;
once(x: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode, reset: ElemNode): t;
once(x: ElemNode): t;
once(props: {
key?: string;
arm?: boolean;
}, x: number | NodeRepr_t): NodeRepr_t;
rand(): NodeRepr_t;
}, x: ElemNode): t;
rand(): t;
rand(props: {
key?: string;
seed?: number;
}): NodeRepr_t;
metro(): NodeRepr_t;
}): t;
metro(): t;
metro(props: {
key?: string;
interval?: number;
}): NodeRepr_t;
}): t;
sample(props: {

@@ -402,11 +379,11 @@ key?: string;

stopOffset?: number;
}, trigger: number | NodeRepr_t, rate: number | NodeRepr_t): NodeRepr_t;
}, trigger: ElemNode, rate: ElemNode): t;
table(props: {
key?: string;
path?: string;
}, t: number | NodeRepr_t): NodeRepr_t;
}, t: ElemNode): t;
convolve(props: {
key?: string;
path?: string;
}, x: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode): t;
seq(props: {

@@ -418,3 +395,3 @@ key?: string;

loop?: boolean;
}, trigger: number | NodeRepr_t, reset: number | NodeRepr_t): NodeRepr_t;
}, trigger: ElemNode, reset: ElemNode): t;
seq2(props: {

@@ -426,3 +403,3 @@ key?: string;

loop?: boolean;
}, trigger: number | NodeRepr_t, reset: number | NodeRepr_t): NodeRepr_t;
}, trigger: ElemNode, reset: ElemNode): t;
sparseq(props: {

@@ -439,54 +416,67 @@ key?: string;

tickInterval?: number;
}, trigger: number | NodeRepr_t, reset: number | NodeRepr_t): NodeRepr_t;
pole(p: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, trigger: ElemNode, reset: ElemNode): t;
sparseq2(props: {
key?: string;
seq?: {
value: number;
time: number;
}[];
}, time: ElemNode): t;
pole(p: ElemNode, x: ElemNode): t;
pole(props: {
key?: string;
}, p: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
env(atkPole: number | NodeRepr_t, relPole: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, p: ElemNode, x: ElemNode): t;
env(atkPole: ElemNode, relPole: ElemNode, x: ElemNode): t;
env(props: {
key?: string;
}, atkPole: number | NodeRepr_t, relPole: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
z(x: number | NodeRepr_t): NodeRepr_t;
}, atkPole: ElemNode, relPole: ElemNode, x: ElemNode): t;
z(x: ElemNode): t;
z(props: {
key?: string;
}, x: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode): t;
delay(props: {
key?: string;
size: number;
}, len: number | NodeRepr_t, fb: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, len: ElemNode, fb: ElemNode, x: ElemNode): t;
sdelay(props: {
key?: string;
size: number;
}, x: number | NodeRepr_t): NodeRepr_t;
svf(fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode): t;
prewarp(fc: ElemNode): t;
mm1p(fc: ElemNode, x: ElemNode): t;
mm1p(props: {
key?: string;
mode?: string;
}, fc: ElemNode, x: ElemNode): t;
svf(fc: ElemNode, q: ElemNode, x: ElemNode): t;
svf(props: {
key?: string;
mode?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
svfshelf(fc: number | NodeRepr_t, q: number | NodeRepr_t, gainDecibels: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, x: ElemNode): t;
svfshelf(fc: ElemNode, q: ElemNode, gainDecibels: ElemNode, x: ElemNode): t;
svfshelf(props: {
key?: string;
mode?: string;
}, fc: number | NodeRepr_t, q: number | NodeRepr_t, gainDecibels: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
biquad(b0: number | NodeRepr_t, b1: number | NodeRepr_t, b2: number | NodeRepr_t, a1: number | NodeRepr_t, a2: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, fc: ElemNode, q: ElemNode, gainDecibels: ElemNode, x: ElemNode): t;
biquad(b0: ElemNode, b1: ElemNode, b2: ElemNode, a1: ElemNode, a2: ElemNode, x: ElemNode): t;
biquad(props: {
key?: string;
}, b0: number | NodeRepr_t, b1: number | NodeRepr_t, b2: number | NodeRepr_t, a1: number | NodeRepr_t, a2: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, b0: ElemNode, b1: ElemNode, b2: ElemNode, a1: ElemNode, a2: ElemNode, x: ElemNode): t;
tapIn(props: {
name: string;
}): NodeRepr_t;
}): t;
tapOut(props: {
name: string;
}, x: number | NodeRepr_t): NodeRepr_t;
meter(x: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode): t;
meter(x: ElemNode): t;
meter(props: {
key?: string;
name?: string;
}, x: number | NodeRepr_t): NodeRepr_t;
snapshot(trigger: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode): t;
snapshot(trigger: ElemNode, x: ElemNode): t;
snapshot(props: {
key?: string;
name?: string;
}, trigger: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
scope(...args: (number | NodeRepr_t)[]): NodeRepr_t;
}, trigger: ElemNode, x: ElemNode): t;
scope(...args: ElemNode[]): t;
scope(props: {

@@ -497,4 +487,4 @@ key?: string;

channels?: number;
}, ...args: (number | NodeRepr_t)[]): NodeRepr_t;
fft(x: number | NodeRepr_t): NodeRepr_t;
}, ...args: ElemNode[]): t;
fft(x: ElemNode): t;
fft(props: {

@@ -504,12 +494,35 @@ key?: string;

size?: number;
}, x: number | NodeRepr_t): NodeRepr_t;
capture(g: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, x: ElemNode): t;
capture(g: ElemNode, x: ElemNode): t;
capture(props: {
key?: string;
size?: number;
}, g: number | NodeRepr_t, x: number | NodeRepr_t): NodeRepr_t;
}, g: ElemNode, x: ElemNode): t;
};
declare class Delegate {
nodesAdded: number;
nodesRemoved: number;
edgesAdded: number;
propsWritten: number;
nodeMap: Map<number, any>;
private currentActiveRoots;
private batch;
constructor();
clear(): void;
getNodeMap(): Map<number, any>;
getTerminalGeneration(): number;
createNode(hash: any, type: any): void;
deleteNode(hash: any): void;
appendChild(parentHash: any, childHash: any): void;
setProperty(hash: any, key: any, value: any): void;
activateRoots(roots: any): void;
commitUpdates(): void;
getPackedInstructions(): any[];
}
declare class Renderer {
private _delegate;
constructor(sampleRate: any, sendMessage: any);
private _sendMessage;
private _nextRefId;
constructor(sendMessage: any);
createRef(kind: any, props: any, children: any): (t | ((newProps: any) => void))[];
render(...args: any[]): {

@@ -523,2 +536,2 @@ nodesAdded: number;

export { EventEmitter, NodeRepr_t, Renderer, createNode, stdlib as el, isNode, renderWithDelegate, resolve, stdlib, stepGarbageCollector };
export { Delegate, ElemNode, EventEmitter, t as NodeRepr_t, Renderer, createNode, stdlib as el, isNode, renderWithDelegate, resolve, stdlib, stepGarbageCollector };

@@ -554,3 +554,2 @@ var __defProp = Object.defineProperty;

$$Set: () => $$Set,
NodeRepr: () => NodeRepr,
RenderDelegate: () => RenderDelegate,

@@ -563,6 +562,10 @@ mount: () => mount,

// node_modules/rescript/lib/es6/js_exn.js
function raiseError(str) {
throw new Error(str);
}
// src/NodeRepr.bs.js
var NodeRepr_bs_exports = {};
__export(NodeRepr_bs_exports, {
create: () => create,
isNode: () => isNode,
shallowCopy: () => shallowCopy,
symbol: () => symbol
});

@@ -638,2 +641,15 @@ // node_modules/rescript/lib/es6/js_types.js

// node_modules/rescript/lib/es6/caml_option.js
function some(x) {
if (x === void 0) {
return {
BS_PRIVATE_NESTED_SOME_NONE: 0
};
} else if (x !== null && x.BS_PRIVATE_NESTED_SOME_NONE !== void 0) {
return {
BS_PRIVATE_NESTED_SOME_NONE: x.BS_PRIVATE_NESTED_SOME_NONE + 1 | 0
};
} else {
return x;
}
}
function valFromOption(x) {

@@ -836,19 +852,2 @@ if (!(x !== null && x.BS_PRIVATE_NESTED_SOME_NONE !== void 0)) {

}
function everyU(_xs, p) {
while (true) {
var xs = _xs;
if (!xs) {
return true;
}
if (!p(xs.hd)) {
return false;
}
_xs = xs.tl;
continue;
}
;
}
function every(xs, p) {
return everyU(xs, __1(p));
}

@@ -868,2 +867,3 @@ // src/Hash.ts

renderer.setProperty(hash, key, value);
prevProps[key] = value;
}

@@ -874,2 +874,9 @@ }

// node_modules/rescript/lib/es6/js_dict.js
function get(dict, k) {
if (k in dict) {
return some(dict[k]);
}
}
// node_modules/rescript/lib/es6/js_option.js

@@ -899,35 +906,22 @@ function getExn(x) {

var r = hashString(-2128831035, kind);
var r2 = test(props.key, 4) ? hashString(r, props.key) : hashString(r, getExn(JSON.stringify(props)));
var k = get(props, "key");
var r2 = k !== void 0 && test(k, 4) ? hashString(r, k) : hashString(r, getExn(JSON.stringify(props)));
return reduceU(children, r2, mixNumber) & 2147483647;
}
// src/Reconciler.bs.js
var symbol = Symbol.for("ELEM_NODE");
function createPrimitive(kind, props, children) {
// src/NodeRepr.bs.js
var symbol = "__ELEM_NODE__";
function create(kind, props, children) {
var childrenList = fromArray(children);
var childHashes = map(childrenList, function(n) {
return n.hash;
});
return {
symbol,
kind: {
NAME: "Primitive",
VAL: kind
},
hash: hashNode(kind, props, childHashes),
kind,
props,
children: fromArray(children)
children: childrenList
};
}
function createComposite(fn, props, children) {
return {
symbol,
kind: {
NAME: "Composite",
VAL: [
{
contents: void 0
},
fn
]
},
props,
children: fromArray(children)
};
}
function isNode(a) {

@@ -942,3 +936,3 @@ var match = classify(a);

var s = classify(a.symbol);
if (typeof s === "number" || s.TAG !== 4) {
if (typeof s === "number" || s.TAG !== 1) {
return false;

@@ -949,34 +943,15 @@ } else {

}
function getHashUnchecked(n) {
var x = n.hash;
if (x !== void 0) {
return x;
} else {
return raiseError("Missing hash property");
}
}
function shallowCopy(node) {
var match = node.kind;
if (match.NAME === "Composite") {
return raiseError("Attempting to shallow copy a composite node");
} else {
return {
symbol,
hash: getHashUnchecked(node),
kind: match.VAL,
props: Object.assign({}, node.props),
generation: {
contents: 0
}
};
}
return {
symbol: node.symbol,
hash: node.hash,
kind: node.kind,
props: Object.assign({}, node.props),
generation: {
contents: 0
}
};
}
var NodeRepr = {
symbol,
createPrimitive,
createComposite,
isNode,
getHashUnchecked,
shallowCopy
};
// src/Reconciler.bs.js
function valuesArray(m) {

@@ -990,16 +965,16 @@ return Array.from(m.values());

var RenderDelegate = {};
function mount(delegate, node, kind, hash, childHashes) {
function mount(delegate, node) {
var nodeMap = delegate.getNodeMap();
if (nodeMap.has(hash)) {
var existing = nodeMap.get(hash);
updateNodeProps2(delegate, hash, existing.props, node.props);
nodeMap.set(hash, shallowCopy(node));
if (nodeMap.has(node.hash)) {
var existing = nodeMap.get(node.hash);
updateNodeProps2(delegate, existing.hash, existing.props, node.props);
existing.generation.contents = 0;
return;
}
delegate.createNode(hash, kind);
updateNodeProps2(delegate, hash, {}, node.props);
forEach(childHashes, function(ch) {
delegate.appendChild(hash, ch);
delegate.createNode(node.hash, node.kind);
updateNodeProps2(delegate, node.hash, {}, node.props);
forEach(node.children, function(child) {
delegate.appendChild(node.hash, child.hash);
});
nodeMap.set(hash, shallowCopy(node));
nodeMap.set(node.hash, shallowCopy(node));
}

@@ -1009,4 +984,4 @@ function visit(delegate, visitSet, _ns) {

var ns = _ns;
var visited = function(x) {
return visitSet.has(x);
var markVisited = function(n2) {
visitSet.add(n2.hash);
};

@@ -1018,41 +993,9 @@ if (!ns) {

var n = ns.hd;
if (visitSet.has(n)) {
if (visitSet.has(n.hash)) {
_ns = rest;
continue;
}
var childrenVisited = every(n.children, visited);
if (childrenVisited) {
var childHashes = map(n.children, function(child) {
return getExn(child.hash);
});
var match = n.kind;
if (match.NAME === "Composite") {
var match$1 = match.VAL;
var res = match$1[0];
var context = delegate.getRenderContext();
var n$1 = res.contents;
var resolved = n$1 !== void 0 ? n$1 : _1(match$1[1], {
context,
props: n.props,
children: toArray(n.children)
});
res.contents = resolved;
if (visitSet.has(resolved)) {
n.hash = getExn(resolved.hash);
visitSet.add(n);
_ns = rest;
continue;
}
_ns = add(add(rest, n), resolved);
continue;
}
var k = match.VAL;
var hash = hashNode(k, n.props, childHashes);
n.hash = hash;
mount(delegate, n, k, hash, childHashes);
visitSet.add(n);
_ns = rest;
continue;
}
_ns = concat(n.children, ns);
markVisited(n);
mount(delegate, n);
_ns = concat(n.children, rest);
continue;

@@ -1065,3 +1008,3 @@ }

var roots = mapWithIndex(fromArray(graphs), function(i, g) {
return createPrimitive("root", {
return create("root", {
channel: i

@@ -1071,3 +1014,5 @@ }, [g]);

visit(delegate, visitSet, roots);
delegate.activateRoots(toArray(map(roots, getHashUnchecked)));
delegate.activateRoots(toArray(map(roots, function(r) {
return r.hash;
})));
delegate.commitUpdates();

@@ -1098,13 +1043,2 @@ }

var ReconcilerBS = Reconciler_bs_exports;
var NodeRepr_createPrimitive = function(Arg1, Arg2, Arg3) {
const result = Curry._3(ReconcilerBS.NodeRepr.createPrimitive, Arg1, Arg2, Arg3);
return result;
};
var NodeRepr_createComposite = function(Arg1, Arg2, Arg3) {
const result = Curry._3(ReconcilerBS.NodeRepr.createComposite, Arg1, Arg2, Arg3);
return result;
};
var NodeRepr_isNode = ReconcilerBS.NodeRepr.isNode;
var NodeRepr_getHashUnchecked = ReconcilerBS.NodeRepr.getHashUnchecked;
var NodeRepr_shallowCopy = ReconcilerBS.NodeRepr.shallowCopy;
var renderWithDelegate2 = function(Arg1, Arg2) {

@@ -1116,2 +1050,12 @@ const result = Curry._2(ReconcilerBS.renderWithDelegate, Arg1, Arg2);

// src/NodeRepr.gen.ts
var Curry2 = curry_exports;
var NodeReprBS = NodeRepr_bs_exports;
var create2 = function(Arg1, Arg2, Arg3) {
const result = Curry2._3(NodeReprBS.create, Arg1, Arg2, Arg3);
return result;
};
var isNode2 = NodeReprBS.isNode;
var shallowCopy2 = NodeReprBS.shallowCopy;
// nodeUtils.ts

@@ -1121,22 +1065,13 @@ import invariant from "invariant";

if (typeof n === "number")
return NodeRepr_createPrimitive("const", { value: n }, []);
invariant(isNode2(n), `Whoops, expecting a Node type here! Got: ${typeof n}`);
return create2("const", { value: n }, []);
invariant(isNode3(n), `Whoops, expecting a Node type here! Got: ${typeof n}`);
return n;
}
function isNode2(n) {
return NodeRepr_isNode(n);
function isNode3(n) {
return isNode2(n);
}
function createNode(kind, props, children) {
if (typeof kind === "string") {
return NodeRepr_createPrimitive(kind, props, children.map(resolve));
}
console.warn("WARNING: Support for composite nodes are deprecated as of v2.1.0, and will be removed in v3");
return NodeRepr_createComposite(kind, props, children.map(resolve));
return create2(kind, props, children.map(resolve));
}
// src/Events.ts
import events from "events";
var EventEmitter = class extends events.EventEmitter {
};
// lib/core.ts

@@ -1158,5 +1093,7 @@ var core_exports = {};

metro: () => metro,
mm1p: () => mm1p,
once: () => once,
phasor: () => phasor,
pole: () => pole,
prewarp: () => prewarp,
rand: () => rand,

@@ -1170,5 +1107,7 @@ sample: () => sample,

sparseq: () => sparseq,
sparseq2: () => sparseq2,
sr: () => sr,
svf: () => svf,
svfshelf: () => svfshelf,
syncphasor: () => syncphasor,
table: () => table,

@@ -1190,3 +1129,3 @@ tapIn: () => tapIn,

function counter(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("counter", {}, [resolve(a)]);

@@ -1197,3 +1136,3 @@ }

function accum(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("accum", {}, [resolve(a), resolve(b)]);

@@ -1203,10 +1142,16 @@ }

}
function phasor(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
return createNode("phasor", {}, [resolve(a), resolve(b)]);
function phasor(a, b) {
if (typeof a === "number" || isNode3(a)) {
return createNode("phasor", {}, [resolve(a)]);
}
return createNode("phasor", a, [resolve(b), resolve(c)]);
return createNode("phasor", a, [resolve(b)]);
}
function syncphasor(a, b, c) {
if (typeof a === "number" || isNode3(a)) {
return createNode("sphasor", {}, [resolve(a), resolve(b)]);
}
return createNode("sphasor", a, [resolve(b), resolve(c)]);
}
function latch(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("latch", {}, [resolve(a), resolve(b)]);

@@ -1217,3 +1162,3 @@ }

function maxhold(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("maxhold", {}, [resolve(a), resolve(b)]);

@@ -1224,3 +1169,3 @@ }

function once(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("once", {}, [resolve(a)]);

@@ -1260,4 +1205,7 @@ }

}
function sparseq2(props, time2) {
return createNode("sparseq2", props, [resolve(time2)]);
}
function pole(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("pole", {}, [resolve(a), resolve(b)]);

@@ -1268,3 +1216,3 @@ }

function env(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("env", {}, [resolve(a), resolve(b), resolve(c)]);

@@ -1275,3 +1223,3 @@ }

function z(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("z", {}, [resolve(a)]);

@@ -1282,3 +1230,3 @@ }

function delay(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("delay", {}, [resolve(a), resolve(b), resolve(c)]);

@@ -1291,4 +1239,19 @@ }

}
function prewarp(fc) {
return createNode("prewarp", {}, [fc]);
}
function mm1p(a, b, c) {
if (typeof a === "number" || isNode3(a)) {
return createNode("mm1p", {}, [
resolve(a),
resolve(b)
]);
}
return createNode("mm1p", a, [
resolve(b),
resolve(c)
]);
}
function svf(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("svf", {}, [

@@ -1307,3 +1270,3 @@ resolve(a),

function svfshelf(a, b, c, d, e) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("svfshelf", {}, [

@@ -1324,3 +1287,3 @@ resolve(a),

function biquad(a, b, c, d, e, f, g) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("biquad", {}, [

@@ -1351,3 +1314,3 @@ resolve(a),

function meter(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("meter", {}, [resolve(a)]);

@@ -1358,3 +1321,3 @@ }

function snapshot(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("snapshot", {}, [resolve(a), resolve(b)]);

@@ -1365,3 +1328,3 @@ }

function scope(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("scope", {}, [a, ...bs].map(resolve));

@@ -1372,3 +1335,3 @@ }

function fft(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("fft", {}, [resolve(a)]);

@@ -1379,3 +1342,3 @@ }

function capture(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("capture", {}, [resolve(a), resolve(b)]);

@@ -1426,45 +1389,45 @@ }

function identity(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("in", {}, [resolve(a)]) : typeof b === "number" || isNode2(b) ? createNode("in", a, [resolve(b)]) : createNode("in", a, []);
return typeof a === "number" || isNode3(a) ? createNode("in", {}, [resolve(a)]) : typeof b === "number" || isNode3(b) ? createNode("in", a, [resolve(b)]) : createNode("in", a, []);
}
function sin(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("sin", {}, [resolve(a)]) : createNode("sin", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("sin", {}, [resolve(a)]) : createNode("sin", a, [resolve(b)]);
}
function cos(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("cos", {}, [resolve(a)]) : createNode("cos", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("cos", {}, [resolve(a)]) : createNode("cos", a, [resolve(b)]);
}
function tan(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("tan", {}, [resolve(a)]) : createNode("tan", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("tan", {}, [resolve(a)]) : createNode("tan", a, [resolve(b)]);
}
function tanh(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("tanh", {}, [resolve(a)]) : createNode("tanh", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("tanh", {}, [resolve(a)]) : createNode("tanh", a, [resolve(b)]);
}
function asinh(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("asinh", {}, [resolve(a)]) : createNode("asinh", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("asinh", {}, [resolve(a)]) : createNode("asinh", a, [resolve(b)]);
}
function ln(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("ln", {}, [resolve(a)]) : createNode("ln", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("ln", {}, [resolve(a)]) : createNode("ln", a, [resolve(b)]);
}
function log(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("log", {}, [resolve(a)]) : createNode("log", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("log", {}, [resolve(a)]) : createNode("log", a, [resolve(b)]);
}
function log2(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("log2", {}, [resolve(a)]) : createNode("log2", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("log2", {}, [resolve(a)]) : createNode("log2", a, [resolve(b)]);
}
function ceil(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("ceil", {}, [resolve(a)]) : createNode("ceil", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("ceil", {}, [resolve(a)]) : createNode("ceil", a, [resolve(b)]);
}
function floor(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("floor", {}, [resolve(a)]) : createNode("floor", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("floor", {}, [resolve(a)]) : createNode("floor", a, [resolve(b)]);
}
function sqrt(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("sqrt", {}, [resolve(a)]) : createNode("sqrt", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("sqrt", {}, [resolve(a)]) : createNode("sqrt", a, [resolve(b)]);
}
function exp(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("exp", {}, [resolve(a)]) : createNode("exp", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("exp", {}, [resolve(a)]) : createNode("exp", a, [resolve(b)]);
}
function abs(a, b) {
return typeof a === "number" || isNode2(a) ? createNode("abs", {}, [resolve(a)]) : createNode("abs", a, [resolve(b)]);
return typeof a === "number" || isNode3(a) ? createNode("abs", {}, [resolve(a)]) : createNode("abs", a, [resolve(b)]);
}
function le(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("le", {}, [resolve(a), resolve(b)]);

@@ -1475,3 +1438,3 @@ }

function leq(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("leq", {}, [resolve(a), resolve(b)]);

@@ -1482,3 +1445,3 @@ }

function ge(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("ge", {}, [resolve(a), resolve(b)]);

@@ -1489,3 +1452,3 @@ }

function geq(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("geq", {}, [resolve(a), resolve(b)]);

@@ -1496,3 +1459,3 @@ }

function pow(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("pow", {}, [resolve(a), resolve(b)]);

@@ -1503,3 +1466,3 @@ }

function eq(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("eq", {}, [resolve(a), resolve(b)]);

@@ -1510,3 +1473,3 @@ }

function and(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("and", {}, [resolve(a), resolve(b)]);

@@ -1517,3 +1480,3 @@ }

function or(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("or", {}, [resolve(a), resolve(b)]);

@@ -1524,3 +1487,3 @@ }

function add2(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("add", {}, [a, ...bs].map(resolve));

@@ -1531,3 +1494,3 @@ }

function sub2(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("sub", {}, [a, ...bs].map(resolve));

@@ -1538,3 +1501,3 @@ }

function mul(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("mul", {}, [a, ...bs].map(resolve));

@@ -1545,3 +1508,3 @@ }

function div(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("div", {}, [a, ...bs].map(resolve));

@@ -1552,3 +1515,3 @@ }

function mod(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("mod", {}, [a, ...bs].map(resolve));

@@ -1559,3 +1522,3 @@ }

function min2(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("min", {}, [a, ...bs].map(resolve));

@@ -1566,3 +1529,3 @@ }

function max2(a, ...bs) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return createNode("max", {}, [a, ...bs].map(resolve));

@@ -1606,3 +1569,3 @@ }

function compress(a_, b_, c_, d_, e_, f_, g_) {
let children = typeof a_ === "number" || isNode2(a_) ? [a_, b_, c_, d_, e_, f_] : [b_, c_, d_, e_, f_, g_];
let children = typeof a_ === "number" || isNode3(a_) ? [a_, b_, c_, d_, e_, f_] : [b_, c_, d_, e_, f_, g_];
const [atkMs, relMs, threshold, ratio, sidechain, xn] = children;

@@ -1642,3 +1605,3 @@ const env2 = el2.env(el2.tau2pole(el2.mul(1e-3, atkMs)), el2.tau2pole(el2.mul(1e-3, relMs)), sidechain);

function smooth(a, b, c) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.pole(a, el3.mul(el3.sub(1, a), b));

@@ -1649,3 +1612,3 @@ }

function sm(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return smooth(el3.tau2pole(0.02), a);

@@ -1656,15 +1619,15 @@ }

function zero(a, b, c, d) {
let [b0, b1, x] = typeof a === "number" || isNode2(a) ? [a, b, c] : [b, c, d];
let [b0, b1, x] = typeof a === "number" || isNode3(a) ? [a, b, c] : [b, c, d];
return el3.sub(el3.mul(b0, x), el3.mul(b1, el3.z(x)));
}
function dcblock(a, b) {
let x = typeof a === "number" || isNode2(a) ? a : b;
let x = typeof a === "number" || isNode3(a) ? a : b;
return el3.pole(0.995, zero(1, 1, x));
}
function df11(a, b, c, d, e) {
let [b0, b1, a1, x] = typeof a === "number" || isNode2(a) ? [a, b, c, d] : [b, c, d, e];
let [b0, b1, a1, x] = typeof a === "number" || isNode3(a) ? [a, b, c, d] : [b, c, d, e];
return el3.pole(a1, zero(b0, b1, x));
}
function lowpass(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "lowpass" }, a, b, c);

@@ -1675,3 +1638,3 @@ }

function highpass(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "highpass" }, a, b, c);

@@ -1682,3 +1645,3 @@ }

function bandpass(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "bandpass" }, a, b, c);

@@ -1689,3 +1652,3 @@ }

function notch(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "notch" }, a, b, c);

@@ -1696,3 +1659,3 @@ }

function allpass(a, b, c, d) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svf({ mode: "allpass" }, a, b, c);

@@ -1703,3 +1666,3 @@ }

function peak(a, b, c, d, e) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svfshelf({ mode: "peak" }, a, b, c, d);

@@ -1710,3 +1673,3 @@ }

function lowshelf(a, b, c, d, e) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svfshelf({ mode: "lowshelf" }, a, b, c, d);

@@ -1717,3 +1680,3 @@ }

function highshelf(a, b, c, d, e) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el3.svfshelf({ mode: "highshelf" }, a, b, c, d);

@@ -1724,3 +1687,3 @@ }

function pink(a, b) {
let x = typeof a === "number" || isNode2(a) ? a : b;
let x = typeof a === "number" || isNode3(a) ? a : b;
let clip = (min3, max3, x2) => el3.min(max3, el3.max(min3, x2));

@@ -1733,3 +1696,3 @@ return clip(-1, 1, el3.mul(el3.db2gain(-30), el3.add(el3.pole(0.99765, el3.mul(x, 0.099046)), el3.pole(0.963, el3.mul(x, 0.2965164)), el3.pole(0.57, el3.mul(x, 1.0526913)), el3.mul(0.1848, x))));

function adsr(a_, b_, c_, d_, e_, f_) {
let children = typeof a_ === "number" || isNode2(a_) ? [a_, b_, c_, d_, e_] : [b_, c_, d_, e_, f_];
let children = typeof a_ === "number" || isNode3(a_) ? [a_, b_, c_, d_, e_] : [b_, c_, d_, e_, f_];
let [a, d, s, r, g] = children;

@@ -1760,3 +1723,3 @@ let atkSamps = el4.mul(a, el4.sr());

function train(a, b) {
if (typeof a === "number" || isNode2(a)) {
if (typeof a === "number" || isNode3(a)) {
return el5.le(el5.phasor(a, 0), 0.5);

@@ -1767,12 +1730,12 @@ }

function cycle(a, b) {
return typeof a === "number" || isNode2(a) ? el5.sin(el5.mul(2 * Math.PI, el5.phasor(a, 0))) : el5.sin(el5.mul(2 * Math.PI, el5.phasor(a, b, 0)));
return typeof a === "number" || isNode3(a) ? el5.sin(el5.mul(2 * Math.PI, el5.phasor(a, 0))) : el5.sin(el5.mul(2 * Math.PI, el5.phasor(a, b, 0)));
}
function saw(a, b) {
return typeof a === "number" || isNode2(a) ? el5.sub(el5.mul(2, el5.phasor(a, 0)), 1) : el5.sub(el5.mul(2, el5.phasor(a, b, 0)), 1);
return typeof a === "number" || isNode3(a) ? el5.sub(el5.mul(2, el5.phasor(a, 0)), 1) : el5.sub(el5.mul(2, el5.phasor(a, b, 0)), 1);
}
function square(a, b) {
return typeof a === "number" || isNode2(a) ? el5.sub(el5.mul(2, train(a)), 1) : el5.sub(el5.mul(2, train(a, b)), 1);
return typeof a === "number" || isNode3(a) ? el5.sub(el5.mul(2, train(a)), 1) : el5.sub(el5.mul(2, train(a, b)), 1);
}
function triangle(a, b) {
return typeof a === "number" || isNode2(a) ? el5.mul(2, el5.sub(0.5, el5.abs(saw(a)))) : el5.mul(2, el5.sub(0.5, el5.abs(saw(a, b))));
return typeof a === "number" || isNode3(a) ? el5.mul(2, el5.sub(0.5, el5.abs(saw(a)))) : el5.mul(2, el5.sub(0.5, el5.abs(saw(a, b))));
}

@@ -1787,3 +1750,3 @@ function polyblep(step, phase) {

function blepsaw(a, b) {
let hasProps = !(typeof a === "number" || isNode2(a));
let hasProps = !(typeof a === "number" || isNode3(a));
let props = hasProps ? a : {};

@@ -1797,3 +1760,3 @@ let rate = hasProps ? b : a;

function blepsquare(a, b) {
let hasProps = !(typeof a === "number" || isNode2(a));
let hasProps = !(typeof a === "number" || isNode3(a));
let props = hasProps ? a : {};

@@ -1810,3 +1773,3 @@ let rate = hasProps ? b : a;

function bleptriangle(a, b) {
let hasProps = !(typeof a === "number" || isNode2(a));
let hasProps = !(typeof a === "number" || isNode3(a));
let props = hasProps ? a : {};

@@ -1830,2 +1793,7 @@ let rate = hasProps ? b : a;

// src/Events.ts
import events from "events";
var EventEmitter = class extends events.EventEmitter {
};
// index.ts

@@ -1845,3 +1813,8 @@ var stdlib = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, core_exports), dynamics_exports), envelopes_exports), filters_exports), math_exports), oscillators_exports), signals_exports), {

var Delegate = class {
constructor(sampleRate, batchHandler) {
constructor() {
this.nodeMap = /* @__PURE__ */ new Map();
this.currentActiveRoots = /* @__PURE__ */ new Set();
this.clear();
}
clear() {
this.nodesAdded = 0;

@@ -1851,12 +1824,10 @@ this.nodesRemoved = 0;

this.propsWritten = 0;
this.nodeMap = /* @__PURE__ */ new Map();
this.currentActiveRoots = /* @__PURE__ */ new Set();
this.renderContext = {
sampleRate,
blockSize: 512,
numInputs: 1,
numOutputs: 1
this.batch = {
createNode: [],
deleteNode: [],
appendChild: [],
setProperty: [],
activateRoots: [],
commitUpdates: []
};
this.batch = [];
this.batchHandler = batchHandler;
}

@@ -1869,20 +1840,17 @@ getNodeMap() {

}
getRenderContext() {
return this.renderContext;
}
createNode(hash, type) {
this.nodesAdded++;
this.batch.push([InstructionTypes.CREATE_NODE, hash, type]);
this.batch.createNode.push([InstructionTypes.CREATE_NODE, hash, type]);
}
deleteNode(hash) {
this.nodesRemoved++;
this.batch.push([InstructionTypes.DELETE_NODE, hash]);
this.batch.deleteNode.push([InstructionTypes.DELETE_NODE, hash]);
}
appendChild(parentHash, childHash) {
this.edgesAdded++;
this.batch.push([InstructionTypes.APPEND_CHILD, parentHash, childHash]);
this.batch.appendChild.push([InstructionTypes.APPEND_CHILD, parentHash, childHash]);
}
setProperty(hash, key, value) {
this.propsWritten++;
this.batch.push([InstructionTypes.SET_PROPERTY, hash, key, value]);
this.batch.setProperty.push([InstructionTypes.SET_PROPERTY, hash, key, value]);
}

@@ -1892,3 +1860,3 @@ activateRoots(roots) {

if (!alreadyActive) {
this.batch.push([InstructionTypes.ACTIVATE_ROOTS, roots]);
this.batch.activateRoots.push([InstructionTypes.ACTIVATE_ROOTS, roots]);
this.currentActiveRoots = new Set(roots);

@@ -1898,6 +1866,14 @@ }

commitUpdates() {
this.batch.push([InstructionTypes.COMMIT_UPDATES]);
this.batchHandler(this.batch);
this.batch = [];
this.batch.commitUpdates.push([InstructionTypes.COMMIT_UPDATES]);
}
getPackedInstructions() {
return [
...this.batch.createNode,
...this.batch.deleteNode,
...this.batch.appendChild,
...this.batch.setProperty,
...this.batch.activateRoots,
...this.batch.commitUpdates
];
}
};

@@ -1911,15 +1887,28 @@ function now() {

var Renderer = class {
constructor(sampleRate, sendMessage) {
this._delegate = new Delegate(sampleRate, (batch) => {
sendMessage(batch);
});
constructor(sendMessage) {
this._delegate = new Delegate();
this._sendMessage = sendMessage;
this._nextRefId = 0;
}
createRef(kind, props, children) {
let key = `__refKey:${this._nextRefId++}`;
let node = createNode(kind, Object.assign({ key }, props), children);
let setter = (newProps) => {
if (!this._delegate.nodeMap.has(node.hash)) {
throw new Error("Cannot update a ref that has not been mounted; make sure you render your node first");
}
const nodeMapCopy = this._delegate.nodeMap.get(node.hash);
this._delegate.clear();
updateNodeProps(this._delegate, node.hash, nodeMapCopy.props, newProps);
this._delegate.commitUpdates();
this._sendMessage(this._delegate.getPackedInstructions());
};
return [node, setter];
}
render(...args) {
const t0 = now();
this._delegate.nodesAdded = 0;
this._delegate.nodesRemoved = 0;
this._delegate.edgesAdded = 0;
this._delegate.propsWritten = 0;
this._delegate.clear();
renderWithDelegate2(this._delegate, args.map(resolve));
const t1 = now();
this._sendMessage(this._delegate.getPackedInstructions());
return {

@@ -1934,2 +1923,3 @@ nodesAdded: this._delegate.nodesAdded,

export {
Delegate,
EventEmitter,

@@ -1939,3 +1929,3 @@ Renderer,

stdlib as el,
isNode2 as isNode,
isNode3 as isNode,
renderWithDelegate2 as renderWithDelegate,

@@ -1942,0 +1932,0 @@ resolve,

{
"name": "@elemaudio/core",
"version": "2.1.0",
"version": "3.0.0-alpha.0",
"type": "module",

@@ -51,3 +51,3 @@ "description": "Official Elementary Audio core package",

"gentype": "^4.5.0",
"jest": "^27.5.1",
"jest": "^29.6.4",
"rescript": "^10.0.0",

@@ -61,3 +61,3 @@ "tsup": "^6.0.1"

},
"gitHead": "39ae7ec006744d522ed7b3d684e86a30488bc77a"
"gitHead": "00fd3b19c7be238e39d3d02700aea59c5f1acbbd"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc