react-hifi
Version:
A set of react components wich provides simple abstraption to manipulate HTML5 AudioContext API (Equalizer, visualisation, stereo, basic controls)
24 lines • 917 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var plugin_factory_1 = require("../_lib/plugin-factory");
var VolumePlugin = /** @class */ (function () {
function VolumePlugin() {
this.createNode = this.createNode.bind(this);
}
VolumePlugin.prototype.shouldNotUpdate = function (prevProps, nextProps) {
return prevProps.value === nextProps.value;
};
VolumePlugin.prototype.createNode = function (audioContext, props) {
var gainNode = audioContext.createGain();
this.updateNode(gainNode, props);
return gainNode;
};
VolumePlugin.prototype.updateNode = function (node, _a) {
var value = _a.value;
node.gain.value = value / 100;
};
return VolumePlugin;
}());
exports.VolumePlugin = VolumePlugin;
exports.default = plugin_factory_1.pluginFactory(new VolumePlugin());
//# sourceMappingURL=index.js.map