"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Functional_1 = require("../../../../../../Class/Functional");
const AudioNode_1 = require("../../../../../../wrap/AudioNode");
const _ids_1 = require("../../../../../_ids");
class MixerNode extends Functional_1.Functional {
    constructor(system) {
        super({
            i: ['a', 'b'],
            o: ['node'],
        }, {
            input: {
                a: {
                    ref: true,
                },
                b: {
                    ref: true,
                },
            },
            output: {
                node: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_MIXER_NODE);
    }
    f({ a, b }, done) {
        let _node;
        const context = a.getContext();
        _node = context.createGain();
        this._node = _node;
        this._a = a;
        this._b = b;
        a.connect(_node);
        b.connect(_node);
        const node = (0, AudioNode_1.wrapAudioNode)(_node, this.__system);
        done({
            node,
        });
    }
    d() {
        if (this._node) {
            this._a.disconnect(this._node);
            this._b.disconnect(this._node);
            this._b = undefined;
            this._a = undefined;
            this._node = undefined;
        }
    }
}
exports.default = MixerNode;
//# sourceMappingURL=index.js.map