From d70981cdd1a03448c35a5d247ee9a0221d1ac209 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 17 Jun 2021 00:29:14 +0200 Subject: [PATCH] fix eq param input --- copyparty/web/browser.css | 9 ++++++++- copyparty/web/browser.js | 24 +++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index fe6ea191..b0b1c17f 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -484,14 +484,21 @@ html.light #ggrid a.sel { margin: .5em; } .opview input[type=text] { - color: #fff; background: #383838; + color: #fff; border: none; box-shadow: 0 0 .3em #222; border-bottom: 1px solid #fc5; border-radius: .2em; padding: .2em .3em; } +.opview input.err { + background: #a20; + border-color: #f00; + box-shadow: 0 0 .7em #f00; + text-shadow: 1px 1px 0 #500; + outline: none; +} input[type="checkbox"]+label { color: #f5a; } diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 2bcdc6c3..278f12ec 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -648,14 +648,16 @@ var audio_eq = (function () { fi.type = a == 0 ? 'lowshelf' : a == cfg.length - 1 ? 'highshelf' : 'peaking'; r.filters.push(fi); } - for (var a = r.filters.length - 1; a >= 0; a--) { - r.filters[a].connect(a > 0 ? r.filters[a - 1] : mp.ac.destination); - } + + // pregain, keep first in chain fi = mp.ac.createGain(); fi.gain.value = r.amp + 0.94; // +.137 dB measured; now -.25 dB and almost bitperfect - mp.acs.connect(fi); - fi.connect(r.filters[r.filters.length - 1]); r.filters.push(fi); + + for (var a = r.filters.length - 1; a >= 0; a--) + r.filters[a].connect(a > 0 ? r.filters[a - 1] : mp.ac.destination); + + mp.acs.connect(r.filters[r.filters.length - 1]); } function eq_step(e) { @@ -672,22 +674,26 @@ var audio_eq = (function () { } function adj_band(that, step) { + var err = false; try { var band = parseInt(that.getAttribute('band')), - v = parseFloat(that.value); + vs = that.value, + v = parseFloat(vs); - if (isNaN(v)) + if (isNaN(v) || v + '' != vs) throw 42; if (isNaN(band)) r.amp = Math.round((v + step * 0.2) * 100) / 100; else r.gains[band] = v + step; + + r.apply(); } catch (ex) { - return; + err = true; } - r.apply(); + clmod(that, 'err', err); } function eq_mod(e) {