react-hifi
Version:
A set of react components wich provides simple abstraption to manipulate HTML5 AudioContext API (Equalizer, visualisation, stereo, basic controls)
33 lines • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var plugin_factory_1 = require("../_lib/plugin-factory");
var BiQuadPlugin = /** @class */ (function () {
function BiQuadPlugin() {
}
BiQuadPlugin.prototype.shouldNotUpdate = function (prevProps, nextProps) {
return prevProps.value === nextProps.value && prevProps.q === nextProps.q;
};
BiQuadPlugin.prototype.createNode = function (audioContext, _a) {
var value = _a.value, freq = _a.freq, type = _a.type, q = _a.q;
var filter = new BiquadFilterNode(audioContext);
filter.frequency.value = freq;
filter.gain.value = value;
filter.type = type;
if (q) {
filter.Q.value = q;
}
return filter;
};
BiQuadPlugin.prototype.updateNode = function (_a, _b) {
var gain = _a.gain, Q = _a.Q;
var value = _b.value, q = _b.q;
gain.value = value;
if (q) {
Q.value = q;
}
};
return BiQuadPlugin;
}());
exports.BiQuadPlugin = BiQuadPlugin;
exports.default = plugin_factory_1.pluginFactory(new BiQuadPlugin());
//# sourceMappingURL=index.js.map