"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapAudioNode = wrapAudioNode;
exports.wrapAudioNodeClass = wrapAudioNodeClass;
exports.wrapAudioAnalyserNode = wrapAudioAnalyserNode;
const _1 = require("../Class/$");
function wrapAudioNode(audioNode, system) {
    return new (class Node extends _1.$ {
        constructor() {
            super(...arguments);
            this.__ = ['AN'];
        }
        getContext() {
            return audioNode.context;
        }
        connect(targetAudioNode) {
            audioNode.connect(targetAudioNode);
        }
        disconnect(targetAudioNode) {
            audioNode.disconnect(targetAudioNode);
        }
    })(system);
}
function wrapAudioNodeClass(audioNode, system) {
    return class Node extends _1.$ {
        constructor() {
            super(...arguments);
            this.__ = ['AN'];
        }
        getContext() {
            return audioNode.context;
        }
        connect(targetAudioNode) {
            audioNode.connect(targetAudioNode);
        }
        disconnect() {
            audioNode.disconnect();
        }
    };
}
function wrapAudioAnalyserNode(audioNode, system) {
    const AudioNodeClass = wrapAudioNodeClass(audioNode, system);
    // @ts-ignore
    return new (class Node extends AudioNodeClass {
        constructor() {
            super(...arguments);
            this.__ = ['AN'];
            // @ts-ignore
        }
        getFFTSize() {
            return audioNode.fftSize;
        }
        getByteTimeDomainData(dataArray) {
            return audioNode.getByteTimeDomainData(dataArray);
        }
        getByteFrequencyData(dataArray) {
            return audioNode.getByteFrequencyData(dataArray);
        }
    })(system);
}
//# sourceMappingURL=AudioNode.js.map