diff --git a/poc/common/virtual-webaudio.js b/poc/common/virtual-webaudio.js index 66bb221..fc2d1bf 100644 --- a/poc/common/virtual-webaudio.js +++ b/poc/common/virtual-webaudio.js @@ -4091,7 +4091,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _con /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ \"./src/constants.js\");\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ \"./src/helpers.js\");\n/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ramda */ \"./node_modules/ramda/es/index.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n\n\n\n\nvar VirtualAudioParam =\n/*#__PURE__*/\nfunction () {\n function VirtualAudioParam(nodeId, ctx, name, defaultValue) {\n _classCallCheck(this, VirtualAudioParam);\n\n this._ = {\n nodeId: nodeId,\n ctx: ctx,\n name: name,\n defaultValue: defaultValue\n };\n }\n\n _createClass(VirtualAudioParam, [{\n key: \"setValueAtTime\",\n value: function setValueAtTime() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'setValueAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(1, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"linearRampToValueAtTime\",\n value: function linearRampToValueAtTime() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'linearRampToValueAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(1, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"exponentialRampToValueAtTime\",\n value: function exponentialRampToValueAtTime() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'exponentialRampToValueAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(1, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"setTargetAtTime\",\n value: function setTargetAtTime() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'setTargetAtTime'], this._.nodeId, this._.ctx.currentTime, args);\n }\n }, {\n key: \"setValueCurveAtTime\",\n value: function setValueCurveAtTime() {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'setValueCurveAtTime'], this._.nodeId, this._.ctx.currentTime, args);\n }\n }, {\n key: \"cancelScheduledValues\",\n value: function cancelScheduledValues() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'cancelScheduledValues'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(0, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"cancelAndHoldAtTime\",\n value: function cancelAndHoldAtTime() {\n for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'cancelAndHoldAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(0, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"value\",\n get: function get() {\n return this._.defaultValue;\n },\n set: function set(newValue) {\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].UPDATE, this._.name, this._.nodeId, this._.ctx.currentTime, [newValue]);\n }\n }]);\n\n return VirtualAudioParam;\n}();\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (VirtualAudioParam);\n\n//# sourceURL=webpack://virtualWebaudio/./src/VirtualAudioParam.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ \"./src/constants.js\");\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ \"./src/helpers.js\");\n/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ramda */ \"./node_modules/ramda/es/index.js\");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n\n\n\n\nvar VirtualAudioParam =\n/*#__PURE__*/\nfunction () {\n function VirtualAudioParam(nodeId, ctx, name, defaultValue) {\n _classCallCheck(this, VirtualAudioParam);\n\n this._ = {\n nodeId: nodeId,\n ctx: ctx,\n name: name,\n defaultValue: defaultValue\n };\n }\n\n _createClass(VirtualAudioParam, [{\n key: \"setValueAtTime\",\n value: function setValueAtTime() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'setValueAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(1, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"linearRampToValueAtTime\",\n value: function linearRampToValueAtTime() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'linearRampToValueAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(1, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"exponentialRampToValueAtTime\",\n value: function exponentialRampToValueAtTime() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'exponentialRampToValueAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(1, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"setTargetAtTime\",\n value: function setTargetAtTime() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'setTargetAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(1, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"setValueCurveAtTime\",\n value: function setValueCurveAtTime() {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'setValueCurveAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(1, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"cancelScheduledValues\",\n value: function cancelScheduledValues() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'cancelScheduledValues'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(0, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"cancelAndHoldAtTime\",\n value: function cancelAndHoldAtTime() {\n for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].CALL, [this._.name, 'cancelAndHoldAtTime'], this._.nodeId, this._.ctx.currentTime, Object(ramda__WEBPACK_IMPORTED_MODULE_2__[\"adjust\"])(0, _helpers__WEBPACK_IMPORTED_MODULE_1__[\"markTimeArg\"], args));\n }\n }, {\n key: \"value\",\n get: function get() {\n return this._.defaultValue;\n },\n set: function set(newValue) {\n this._.ctx._.events.add(_constants__WEBPACK_IMPORTED_MODULE_0__[\"EVENTS\"].UPDATE, this._.name, this._.nodeId, this._.ctx.currentTime, [newValue]);\n }\n }]);\n\n return VirtualAudioParam;\n}();\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (VirtualAudioParam);\n\n//# sourceURL=webpack://virtualWebaudio/./src/VirtualAudioParam.js?"); /***/ }), @@ -4151,7 +4151,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"invertEvent\", function() { return invertEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getNodeById\", function() { return getNodeById; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setNodeById\", function() { return setNodeById; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"removeNodeById\", function() { return removeNodeById; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"markTimeArg\", function() { return markTimeArg; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"parseTimeArg\", function() { return parseTimeArg; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyEventToContext\", function() { return applyEventToContext; });\n/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ramda */ \"./node_modules/ramda/es/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"./src/constants.js\");\n/* harmony import */ var _VirtualPeriodicWave__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./VirtualPeriodicWave */ \"./src/VirtualPeriodicWave.js\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\nvar invertEvent = Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"cond\"])([[Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CREATE), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].REMOVE)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].UPDATE), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].NOP)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CONNECT), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].DISCONNECT)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].DISCONNECT), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CONNECT)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].SET), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].NOP)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CALL), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"cond\"])([[Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"equals\"])('start'), ramda__WEBPACK_IMPORTED_MODULE_0__[\"last\"], Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"prop\"])('param')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"evolve\"])({\n param: Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"update\"])(-1, 'stop')\n})], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"equals\"])('stop'), ramda__WEBPACK_IMPORTED_MODULE_0__[\"last\"], Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"prop\"])('param')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"evolve\"])({\n param: Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"update\"])(-1, 'start')\n})], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"contains\"])(ramda__WEBPACK_IMPORTED_MODULE_0__[\"__\"], ['setPeriodicWave', 'cancelScheduledValues', 'cancelAndHoldAtTime']), ramda__WEBPACK_IMPORTED_MODULE_0__[\"last\"], Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"prop\"])('param')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].NOP)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"contains\"])(ramda__WEBPACK_IMPORTED_MODULE_0__[\"__\"], ['setValueAtTime', 'linearRampToValueAtTime', 'exponentialRampToValueAtTime']), ramda__WEBPACK_IMPORTED_MODULE_0__[\"last\"], Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"prop\"])('param')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"evolve\"])({\n param: Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"update\"])(-1, 'cancelAndHoldAtTime'),\n args: function args() {\n return [markTimeArg(-1)];\n }\n})], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"contains\"])(ramda__WEBPACK_IMPORTED_MODULE_0__[\"__\"], ['setTargetAtTime', 'setValueCurveAtTime']), ramda__WEBPACK_IMPORTED_MODULE_0__[\"last\"], Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"prop\"])('param')), function (_ref) {\n var param = _ref.param;\n console.warn(\"inverting: inversion has not yet been implemented for \".concat(param));\n}], [ramda__WEBPACK_IMPORTED_MODULE_0__[\"T\"], function (_ref2) {\n var param = _ref2.param;\n console.error(\"inverting: unknown command \".concat(param));\n}]])], [ramda__WEBPACK_IMPORTED_MODULE_0__[\"T\"], function (_ref3) {\n var eventName = _ref3.eventName;\n console.error(\"inverting: unknown event \".concat(eventName));\n}]]);\n\nvar getNodeById = function getNodeById(id, ctx) {\n return ctx._nodes[id];\n};\n\nvar setNodeById = function setNodeById(id, node, ctx) {\n if (!ctx._nodes) {\n ctx._nodes = {};\n }\n\n ctx._nodes[id] = node;\n};\n\nvar removeNodeById = function removeNodeById(id, ctx) {\n delete ctx._nodes[id];\n};\n\nvar TIME_MARK = '{{currentTime}}';\n\nvar markTimeArg = function markTimeArg(arg) {\n return TIME_MARK + ' + ' + arg;\n};\n\nvar parseTimeArg = Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"curry\"])(function (time, arg) {\n return Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"both\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"is\"])(String), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"startsWith\"])(TIME_MARK + ' + ')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"lt\"])(ramda__WEBPACK_IMPORTED_MODULE_0__[\"__\"], 0), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"always\"])(0)), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"add\"])(time), parseFloat, Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"replace\"])(TIME_MARK + ' + ', '')))(arg);\n});\nvar applyEventToContext = Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"curry\"])(function (_ref4, ctx) {\n var targetId = _ref4.targetId,\n eventName = _ref4.eventName,\n param = _ref4.param,\n time = _ref4.time,\n args = _ref4.args;\n\n // TODO: how to deal with time?\n switch (eventName) {\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CREATE:\n switch (param) {\n case 'oscillator':\n {\n var node = ctx.createOscillator();\n setNodeById(targetId, node, ctx);\n }\n break;\n\n case 'gain':\n {\n var _node = ctx.createGain();\n\n setNodeById(targetId, _node, ctx);\n }\n break;\n\n case 'periodicWave':\n {\n var _node2 = Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"apply\"])(ctx.createPeriodicWave.bind(ctx), args);\n\n setNodeById(targetId, _node2, ctx);\n }\n break;\n\n default:\n {\n console.error('unknown node type', param);\n }\n }\n\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].UPDATE:\n {\n var _node3 = getNodeById(targetId, ctx);\n\n _node3[param].value = args[0];\n }\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].SET:\n {\n var _node4 = getNodeById(targetId, ctx);\n\n _node4[param] = args[0];\n }\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CONNECT:\n {\n var _node5 = getNodeById(targetId, ctx);\n\n switch (param.length) {\n case 1:\n {\n var target = param[0] === _constants__WEBPACK_IMPORTED_MODULE_1__[\"CTX_DESTINATION\"] ? ctx.destination : getNodeById(param[0], ctx);\n\n _node5.connect(target);\n }\n break;\n\n case 2:\n {\n var _target = getNodeById(param[0], ctx);\n\n var property = _target[param[1]];\n\n _node5.connect(property);\n }\n }\n }\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CALL:\n {\n var _node6 = getNodeById(targetId, ctx);\n\n switch (Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"length\"])(param)) {\n case 1:\n {\n var _param = _slicedToArray(param, 1),\n command = _param[0];\n\n switch (command) {\n case 'start':\n case 'stop':\n Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"apply\"])(_node6[command].bind(_node6), args);\n break;\n\n case 'setPeriodicWave':\n if (args[0] instanceof _VirtualPeriodicWave__WEBPACK_IMPORTED_MODULE_2__[\"default\"]) {\n var nodeId = args[0]._.id; // args[0] is a VirtualPeriodicWave, but we need the real one\n\n var argNode = getNodeById(nodeId, ctx);\n\n _node6[command](argNode);\n } else {\n _node6[command](args[0]);\n }\n\n break;\n\n default:\n {\n console.error('unknown command', command);\n }\n }\n }\n break;\n\n case 2:\n {\n var _param2 = _slicedToArray(param, 2),\n paramName = _param2[0],\n _command = _param2[1];\n\n switch (_command) {\n case 'setValueAtTime':\n case 'linearRampToValueAtTime':\n case 'exponentialRampToValueAtTime':\n case 'setTargetAtTime':\n case 'setValueCurveAtTime':\n case 'cancelScheduledValues':\n case 'cancelAndHoldAtTime':\n Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"apply\"])(_node6[paramName][_command].bind(_node6[paramName]), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"map\"])(parseTimeArg(time), args));\n break;\n\n default:\n {\n console.error('unknown command', _command);\n }\n }\n }\n break;\n }\n }\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].REMOVE:\n removeNodeById(targetId, ctx);\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].DISCONNECT:\n {\n var _node7 = getNodeById(targetId, ctx);\n\n switch (param.length) {\n case 0:\n _node7.disconnect();\n\n break;\n\n case 1:\n {\n var _target2 = param[0] === _constants__WEBPACK_IMPORTED_MODULE_1__[\"CTX_DESTINATION\"] ? ctx.destination : getNodeById(param[0], ctx);\n\n _node7.disconnect(_target2);\n }\n break;\n\n case 2:\n {\n var _target3 = getNodeById(param[0], ctx);\n\n var _property = _target3[param[1]];\n\n _node7.disconnect(_property);\n }\n }\n }\n break;\n\n default:\n {\n console.error('unknown event', eventName);\n }\n }\n});\n\n\n//# sourceURL=webpack://virtualWebaudio/./src/helpers.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"invertEvent\", function() { return invertEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getNodeById\", function() { return getNodeById; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"setNodeById\", function() { return setNodeById; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"removeNodeById\", function() { return removeNodeById; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"markTimeArg\", function() { return markTimeArg; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"parseTimeArg\", function() { return parseTimeArg; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"applyEventToContext\", function() { return applyEventToContext; });\n/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ramda */ \"./node_modules/ramda/es/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ \"./src/constants.js\");\n/* harmony import */ var _VirtualPeriodicWave__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./VirtualPeriodicWave */ \"./src/VirtualPeriodicWave.js\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\nvar invertEvent = Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"cond\"])([[Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CREATE), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].REMOVE)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].UPDATE), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].NOP)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CONNECT), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].DISCONNECT)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].DISCONNECT), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CONNECT)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].SET), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].NOP)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"propEq\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CALL), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"cond\"])([[Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"equals\"])('start'), ramda__WEBPACK_IMPORTED_MODULE_0__[\"last\"], Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"prop\"])('param')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"evolve\"])({\n param: Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"update\"])(-1, 'stop')\n})], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"equals\"])('stop'), ramda__WEBPACK_IMPORTED_MODULE_0__[\"last\"], Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"prop\"])('param')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"evolve\"])({\n param: Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"update\"])(-1, 'start')\n})], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"contains\"])(ramda__WEBPACK_IMPORTED_MODULE_0__[\"__\"], ['setPeriodicWave', 'cancelScheduledValues', 'cancelAndHoldAtTime']), ramda__WEBPACK_IMPORTED_MODULE_0__[\"last\"], Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"prop\"])('param')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"assoc\"])('eventName', _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].NOP)], [Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"contains\"])(ramda__WEBPACK_IMPORTED_MODULE_0__[\"__\"], ['setValueAtTime', 'linearRampToValueAtTime', 'exponentialRampToValueAtTime', 'setTargetAtTime', 'setValueCurveAtTime']), ramda__WEBPACK_IMPORTED_MODULE_0__[\"last\"], Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"prop\"])('param')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"evolve\"])({\n param: Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"update\"])(-1, 'cancelAndHoldAtTime'),\n args: function args() {\n return [markTimeArg(-1)];\n }\n})], [ramda__WEBPACK_IMPORTED_MODULE_0__[\"T\"], function (_ref) {\n var param = _ref.param;\n console.error(\"inverting: unknown command \".concat(param));\n}]])], [ramda__WEBPACK_IMPORTED_MODULE_0__[\"T\"], function (_ref2) {\n var eventName = _ref2.eventName;\n console.error(\"inverting: unknown event \".concat(eventName));\n}]]);\n\nvar getNodeById = function getNodeById(id, ctx) {\n return ctx._nodes[id];\n};\n\nvar setNodeById = function setNodeById(id, node, ctx) {\n if (!ctx._nodes) {\n ctx._nodes = {};\n }\n\n ctx._nodes[id] = node;\n};\n\nvar removeNodeById = function removeNodeById(id, ctx) {\n delete ctx._nodes[id];\n};\n\nvar TIME_MARK = '{{currentTime}}';\n\nvar markTimeArg = function markTimeArg(arg) {\n return TIME_MARK + ' + ' + arg;\n};\n\nvar parseTimeArg = Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"curry\"])(function (time, arg) {\n return Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"both\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"is\"])(String), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"startsWith\"])(TIME_MARK + ' + ')), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"compose\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"when\"])(Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"lt\"])(ramda__WEBPACK_IMPORTED_MODULE_0__[\"__\"], 0), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"always\"])(0)), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"add\"])(time), parseFloat, Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"replace\"])(TIME_MARK + ' + ', '')))(arg);\n});\nvar applyEventToContext = Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"curry\"])(function (_ref3, ctx) {\n var targetId = _ref3.targetId,\n eventName = _ref3.eventName,\n param = _ref3.param,\n time = _ref3.time,\n args = _ref3.args;\n\n // TODO: how to deal with time?\n switch (eventName) {\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CREATE:\n switch (param) {\n case 'oscillator':\n {\n var node = ctx.createOscillator();\n setNodeById(targetId, node, ctx);\n }\n break;\n\n case 'gain':\n {\n var _node = ctx.createGain();\n\n setNodeById(targetId, _node, ctx);\n }\n break;\n\n case 'periodicWave':\n {\n var _node2 = Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"apply\"])(ctx.createPeriodicWave.bind(ctx), args);\n\n setNodeById(targetId, _node2, ctx);\n }\n break;\n\n default:\n {\n console.error('unknown node type', param);\n }\n }\n\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].UPDATE:\n {\n var _node3 = getNodeById(targetId, ctx);\n\n _node3[param].value = args[0];\n }\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].SET:\n {\n var _node4 = getNodeById(targetId, ctx);\n\n _node4[param] = args[0];\n }\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CONNECT:\n {\n var _node5 = getNodeById(targetId, ctx);\n\n switch (param.length) {\n case 1:\n {\n var target = param[0] === _constants__WEBPACK_IMPORTED_MODULE_1__[\"CTX_DESTINATION\"] ? ctx.destination : getNodeById(param[0], ctx);\n\n _node5.connect(target);\n }\n break;\n\n case 2:\n {\n var _target = getNodeById(param[0], ctx);\n\n var property = _target[param[1]];\n\n _node5.connect(property);\n }\n }\n }\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].CALL:\n {\n var _node6 = getNodeById(targetId, ctx);\n\n switch (Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"length\"])(param)) {\n case 1:\n {\n var _param = _slicedToArray(param, 1),\n command = _param[0];\n\n switch (command) {\n case 'start':\n case 'stop':\n Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"apply\"])(_node6[command].bind(_node6), args);\n break;\n\n case 'setPeriodicWave':\n if (args[0] instanceof _VirtualPeriodicWave__WEBPACK_IMPORTED_MODULE_2__[\"default\"]) {\n var nodeId = args[0]._.id; // args[0] is a VirtualPeriodicWave, but we need the real one\n\n var argNode = getNodeById(nodeId, ctx);\n\n _node6[command](argNode);\n } else {\n _node6[command](args[0]);\n }\n\n break;\n\n default:\n {\n console.error('unknown command', command);\n }\n }\n }\n break;\n\n case 2:\n {\n var _param2 = _slicedToArray(param, 2),\n paramName = _param2[0],\n _command = _param2[1];\n\n switch (_command) {\n case 'setValueAtTime':\n case 'linearRampToValueAtTime':\n case 'exponentialRampToValueAtTime':\n case 'setTargetAtTime':\n case 'setValueCurveAtTime':\n case 'cancelScheduledValues':\n case 'cancelAndHoldAtTime':\n Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"apply\"])(_node6[paramName][_command].bind(_node6[paramName]), Object(ramda__WEBPACK_IMPORTED_MODULE_0__[\"map\"])(parseTimeArg(time), args));\n break;\n\n default:\n {\n console.error('unknown command', _command);\n }\n }\n }\n break;\n }\n }\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].REMOVE:\n removeNodeById(targetId, ctx);\n break;\n\n case _constants__WEBPACK_IMPORTED_MODULE_1__[\"EVENTS\"].DISCONNECT:\n {\n var _node7 = getNodeById(targetId, ctx);\n\n switch (param.length) {\n case 0:\n _node7.disconnect();\n\n break;\n\n case 1:\n {\n var _target2 = param[0] === _constants__WEBPACK_IMPORTED_MODULE_1__[\"CTX_DESTINATION\"] ? ctx.destination : getNodeById(param[0], ctx);\n\n _node7.disconnect(_target2);\n }\n break;\n\n case 2:\n {\n var _target3 = getNodeById(param[0], ctx);\n\n var _property = _target3[param[1]];\n\n _node7.disconnect(_property);\n }\n }\n }\n break;\n\n default:\n {\n console.error('unknown event', eventName);\n }\n }\n});\n\n\n//# sourceURL=webpack://virtualWebaudio/./src/helpers.js?"); /***/ }), diff --git a/src/VirtualAudioParam.js b/src/VirtualAudioParam.js index bba9fad..b479acb 100644 --- a/src/VirtualAudioParam.js +++ b/src/VirtualAudioParam.js @@ -28,10 +28,10 @@ class VirtualAudioParam { this._.ctx._.events.add(EVENTS.CALL, [this._.name, 'exponentialRampToValueAtTime'], this._.nodeId, this._.ctx.currentTime, adjust(1, markTimeArg, args)) } setTargetAtTime (...args) { - this._.ctx._.events.add(EVENTS.CALL, [this._.name, 'setTargetAtTime'], this._.nodeId, this._.ctx.currentTime, args) + this._.ctx._.events.add(EVENTS.CALL, [this._.name, 'setTargetAtTime'], this._.nodeId, this._.ctx.currentTime, adjust(1, markTimeArg, args)) } setValueCurveAtTime (...args) { - this._.ctx._.events.add(EVENTS.CALL, [this._.name, 'setValueCurveAtTime'], this._.nodeId, this._.ctx.currentTime, args) + this._.ctx._.events.add(EVENTS.CALL, [this._.name, 'setValueCurveAtTime'], this._.nodeId, this._.ctx.currentTime, adjust(1, markTimeArg, args)) } cancelScheduledValues (...args) { this._.ctx._.events.add(EVENTS.CALL, [this._.name, 'cancelScheduledValues'], this._.nodeId, this._.ctx.currentTime, adjust(0, markTimeArg, args)) diff --git a/src/helpers.js b/src/helpers.js index 83deaf7..8d6bd7e 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -45,17 +45,13 @@ const invertEvent = cond([ [compose(contains(__, [ 'setValueAtTime', 'linearRampToValueAtTime', - 'exponentialRampToValueAtTime' + 'exponentialRampToValueAtTime', + 'setTargetAtTime', + 'setValueCurveAtTime' ]), last, prop('param')), evolve({ param: update(-1, 'cancelAndHoldAtTime'), args: () => [markTimeArg(-1)] })], - [compose(contains(__, [ - 'setTargetAtTime', - 'setValueCurveAtTime' - ]), last, prop('param')), ({ param }) => { - console.warn(`inverting: inversion has not yet been implemented for ${param}`) - }], [T, ({ param }) => { console.error(`inverting: unknown command ${param}`) }]