"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Sound = void 0; var Sound = /** @class */ (function () { function Sound(Main) { this.volumeInput = document.querySelector('.ntsh_soundsettings-volume'); this.eqLowInput = document.querySelector('.ntsh_soundsettings-eqlow'); this.eqMidInput = document.querySelector('.ntsh_soundsettings-eqmid'); this.eqHighInput = document.querySelector('.ntsh_soundsettings-eqhigh'); this._Main = Main; this.registerListeners(); } Sound.prototype.update = function (state) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; if (((_a = state === null || state === void 0 ? void 0 : state.parameters) === null || _a === void 0 ? void 0 : _a.dataSliders) == null) return; var volumeSliderIndex = (_b = state.parameters) === null || _b === void 0 ? void 0 : _b.dataSliders.findIndex(function (slider) { return slider.sliderName === 'Volume'; }); var volumeSlider = (_c = state.parameters) === null || _c === void 0 ? void 0 : _c.dataSliders[volumeSliderIndex !== null && volumeSliderIndex !== void 0 ? volumeSliderIndex : -1]; var eqLowSliderIndex = (_d = state.parameters) === null || _d === void 0 ? void 0 : _d.dataSliders.findIndex(function (slider) { return slider.sliderName === 'EQ_Low'; }); var eqLowSlider = (_e = state.parameters) === null || _e === void 0 ? void 0 : _e.dataSliders[eqLowSliderIndex !== null && eqLowSliderIndex !== void 0 ? eqLowSliderIndex : -1]; var eqMidSliderIndex = (_f = state.parameters) === null || _f === void 0 ? void 0 : _f.dataSliders.findIndex(function (slider) { return slider.sliderName === 'EQ_Mid'; }); var eqMidSlider = (_g = state.parameters) === null || _g === void 0 ? void 0 : _g.dataSliders[eqMidSliderIndex !== null && eqMidSliderIndex !== void 0 ? eqMidSliderIndex : -1]; var eqHighSliderIndex = (_h = state.parameters) === null || _h === void 0 ? void 0 : _h.dataSliders.findIndex(function (slider) { return slider.sliderName === 'EQ_High'; }); var eqHighSlider = (_j = state.parameters) === null || _j === void 0 ? void 0 : _j.dataSliders[eqHighSliderIndex !== null && eqHighSliderIndex !== void 0 ? eqHighSliderIndex : -1]; this.volumeInput.valueAsNumber = (_k = volumeSlider === null || volumeSlider === void 0 ? void 0 : volumeSlider.outputValue) !== null && _k !== void 0 ? _k : this.volumeInput.valueAsNumber; this.eqLowInput.valueAsNumber = (_l = eqLowSlider === null || eqLowSlider === void 0 ? void 0 : eqLowSlider.outputValue) !== null && _l !== void 0 ? _l : this.eqLowInput.valueAsNumber; this.eqMidInput.valueAsNumber = (_m = eqMidSlider === null || eqMidSlider === void 0 ? void 0 : eqMidSlider.outputValue) !== null && _m !== void 0 ? _m : this.eqMidInput.valueAsNumber; this.eqHighInput.valueAsNumber = (_o = eqHighSlider === null || eqHighSlider === void 0 ? void 0 : eqHighSlider.outputValue) !== null && _o !== void 0 ? _o : this.eqHighInput.valueAsNumber; this.volumeInput.setAttribute('index', (_p = volumeSliderIndex === null || volumeSliderIndex === void 0 ? void 0 : volumeSliderIndex.toString()) !== null && _p !== void 0 ? _p : '-1'); this.eqLowInput.setAttribute('index', (_q = eqLowSliderIndex === null || eqLowSliderIndex === void 0 ? void 0 : eqLowSliderIndex.toString()) !== null && _q !== void 0 ? _q : '-1'); this.eqMidInput.setAttribute('index', (_r = eqMidSliderIndex === null || eqMidSliderIndex === void 0 ? void 0 : eqMidSliderIndex.toString()) !== null && _r !== void 0 ? _r : '-1'); this.eqHighInput.setAttribute('index', (_s = eqHighSliderIndex === null || eqHighSliderIndex === void 0 ? void 0 : eqHighSliderIndex.toString()) !== null && _s !== void 0 ? _s : '-1'); }; Sound.prototype.registerListeners = function () { var _this = this; this.volumeInput.onchange = function () { var _a; _this._Main.socket.emit('unityWebSocket', 'dataParameterValue', parseInt((_a = _this.volumeInput.getAttribute('index')) !== null && _a !== void 0 ? _a : '-1'), _this.volumeInput.valueAsNumber); }; this.eqLowInput.onchange = function () { var _a; _this._Main.socket.emit('unityWebSocket', 'dataParameterValue', parseInt((_a = _this.eqLowInput.getAttribute('index')) !== null && _a !== void 0 ? _a : '-1'), _this.eqLowInput.valueAsNumber); }; this.eqMidInput.onchange = function () { var _a; _this._Main.socket.emit('unityWebSocket', 'dataParameterValue', parseInt((_a = _this.eqMidInput.getAttribute('index')) !== null && _a !== void 0 ? _a : '-1'), _this.eqMidInput.valueAsNumber); }; this.eqHighInput.onchange = function () { var _a; _this._Main.socket.emit('unityWebSocket', 'dataParameterValue', parseInt((_a = _this.eqHighInput.getAttribute('index')) !== null && _a !== void 0 ? _a : '-1'), _this.eqHighInput.valueAsNumber); }; }; return Sound; }()); exports.Sound = Sound; //# sourceMappingURL=sound.js.map