DJ Brake: choose which limiters count, horizontal distance to the limiter
Outputs can be left out per device, muted outputs never count. The page also shows how far the closest watched output is from its limiter threshold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e56524a8cd
commit
8919f0016c
7 files changed
+136
-30
No files matched your search
+21
-3
@@ -2384,7 +2384,25 @@ function djBrakeCard() {
|
||||
try { await navigator.clipboard.writeText(url); toast(t("Address copied")); } catch { toast(url); }
|
||||
} }, t("Copy"))) : null,
|
||||
S.djbrake && !url ? h("p", { class: "info djwarn" }, t("Switch on remote access below so other devices can reach it.")) : null,
|
||||
S.djbrake ? h("p", { class: "info" }, t("Anyone in your network can open it without a PIN. It shows only the light, watches all outputs of all connected DSPs and changes nothing.")) : null);
|
||||
S.djbrake ? djLimiters() : null,
|
||||
S.djbrake ? h("p", { class: "info" }, t("Anyone in your network can open it without a PIN. It shows only the light and the distance to the limiter and changes nothing.")) : null);
|
||||
}
|
||||
|
||||
function djLimiters() {
|
||||
const devs = S.order.map(id => S.devices[id]).filter(d => d.state && !d.demo);
|
||||
const toggle = async (id, i) => {
|
||||
const cur = S.djIgnore[id] || [];
|
||||
const ignore = { ...S.djIgnore, [id]: cur.includes(i) ? cur.filter(x => x !== i) : [...cur, i] };
|
||||
try { S.djIgnore = (await api("PUT", "/api/djbrake", { ignore })).ignore; render(); }
|
||||
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
|
||||
};
|
||||
return h("div", { class: "djlim" }, h("b", {}, t("Limiters that count")),
|
||||
devs.length ? devs.map(d => h("div", { class: "djdev" }, devs.length > 1 ? h("small", {}, d.name) : null,
|
||||
h("div", { class: "djchs" }, chans(d, "out").map((c, i) => {
|
||||
const on = !(S.djIgnore[d.id] || []).includes(i);
|
||||
return h("button", { class: "djch" + (on ? " on" : ""), "aria-pressed": String(on), onclick: () => toggle(d.id, i) },
|
||||
chLabel("out", i), c.name ? h("small", {}, c.name) : null);
|
||||
})))) : h("p", { class: "info" }, t("Connect a DSP to choose.")));
|
||||
}
|
||||
|
||||
function langCard() {
|
||||
@@ -2637,7 +2655,7 @@ function connectEvents() {
|
||||
if (ev.muteall) { S.muteAll = ev.muteall.active; showMuteAll(); }
|
||||
if (ev.soundfield) S.sf = ev.soundfield;
|
||||
if ("dashboard" in ev) S.dash = ev.dashboard && ev.dashboard.modules;
|
||||
S.djbrake = !!ev.djbrake;
|
||||
S.djbrake = !!ev.djbrake; S.djIgnore = ev.dj_ignore || {};
|
||||
if ("logo" in ev) { S.logo = ev.logo; showLogo(); }
|
||||
if (S.demo.enabled && S.devices.demo && !S.devices[S.cur]?.demo) S.cur = "demo";
|
||||
S.order.forEach(id => maybeAskUnlock(S.devices[id]));
|
||||
@@ -2673,7 +2691,7 @@ function connectEvents() {
|
||||
case "dashboard":
|
||||
dashRemote(ev.data); break;
|
||||
case "djbrake":
|
||||
S.djbrake = ev.enabled; if (S.settings) render(); break;
|
||||
S.djbrake = ev.enabled; S.djIgnore = ev.ignore; if (S.settings && !S.busy) render(); break;
|
||||
case "logo":
|
||||
S.logo = ev.data; showLogo(); if (S.settings) render(); break;
|
||||
case "muteall":
|
||||
|
||||
+48
-11
@@ -16,14 +16,26 @@
|
||||
body.on #wash, body.on #halo, body.on #core { transition: opacity .09s ease-out; opacity: 1; }
|
||||
|
||||
#wash { position: fixed; inset: 0; background: radial-gradient(circle at 50% 46%, #6e0a0a 0%, #2a0505 42%, #050608 78%); }
|
||||
#lamp { position: relative; width: 66vmin; height: 66vmin; display: grid; place-items: center; }
|
||||
#lamp { position: relative; width: 52vmin; height: 52vmin; display: grid; place-items: center; }
|
||||
#halo, #core, #glass, #ring { position: absolute; inset: 0; border-radius: 50%; }
|
||||
#glass { background: radial-gradient(circle at 50% 38%, #171a20, #0b0d11 70%); box-shadow: inset 0 0 0 1px #ffffff14; }
|
||||
#core { background: radial-gradient(circle at 50% 36%, #ff6a5c 0%, #f4201c 46%, #b80c0f 100%); box-shadow: inset 0 0 0 1px #ffb3a8, inset 0 -3vmin 7vmin #5e000380; }
|
||||
#halo { inset: -7vmin; background: radial-gradient(circle, #ff2a1f 44%, #ff2a1f00 70%); filter: blur(3vmin); }
|
||||
#ring { border: .5vmin solid #ff5a4c; opacity: 0; pointer-events: none; }
|
||||
#word { position: relative; font-size: 10.5vmin; font-weight: 800; letter-spacing: .03em; line-height: 1; color: #4b5260; transition: color .5s; }
|
||||
#sub { position: relative; min-height: 1.3em; font-size: 4.4vmin; font-weight: 500; color: #6b7280; transition: color .5s; }
|
||||
#word { position: relative; font-size: 8.6vmin; font-weight: 800; letter-spacing: .03em; line-height: 1; color: #4b5260; transition: color .5s; }
|
||||
#sub { position: relative; min-height: 1.3em; font-size: 4.4vmin; font-weight: 500; color: #8b93a1; transition: color .5s; font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* distance to the limiter: the colours belong to the scale, the dark cover shows what is still left */
|
||||
#gauge { position: relative; width: min(88vw, 130vmin); }
|
||||
#track { position: relative; height: 3.6vmin; border-radius: 1.8vmin; overflow: hidden; box-shadow: 0 0 0 1px #ffffff1c;
|
||||
background: linear-gradient(90deg, #17a34a 0%, #22c55e 55%, #eab308 78%, #f97316 90%, #ef2b24 100%); }
|
||||
#cover { position: absolute; top: 0; right: 0; bottom: 0; width: 100%; background: #12151a; }
|
||||
#ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 2px), #050608b0 calc(20% - 2px) 20%); }
|
||||
#scale { position: relative; height: 3vmin; margin-top: 1vmin; font-size: 2.3vmin; color: #6b7280; font-variant-numeric: tabular-nums; }
|
||||
#scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
|
||||
#scale span:first-child { transform: none; }
|
||||
#scale span:last-child { transform: translateX(-100%); }
|
||||
body.on #scale { color: #ffc9c4; }
|
||||
body.on #word { color: #fff; transition: color .09s; }
|
||||
body.on #sub { color: #ffd9d4; transition: color .09s; }
|
||||
|
||||
@@ -44,6 +56,10 @@
|
||||
<div id="core"></div>
|
||||
<div id="word">—</div>
|
||||
</div>
|
||||
<div id="gauge">
|
||||
<div id="track"><div id="cover"></div><div id="ticks"></div></div>
|
||||
<div id="scale"><span style="left:0">−30</span><span style="left:20%">−24</span><span style="left:40%">−18</span><span style="left:60%">−12</span><span style="left:80%">−6</span><span style="left:100%">0 dB</span></div>
|
||||
</div>
|
||||
<div id="sub"></div>
|
||||
<script>
|
||||
// Red light for the DJ: comes on while a limiter of a connected DSP is working.
|
||||
@@ -51,25 +67,46 @@
|
||||
(function () {
|
||||
var de = /^de/i.test(navigator.language || "");
|
||||
var text = de
|
||||
? { on: "LIMITER", more: "Mehr Gas bringt nichts", lost: "Keine Verbindung", none: "Kein DSP verbunden" }
|
||||
: { on: "LIMITER", more: "More gain won't help", lost: "No connection", none: "No DSP connected" };
|
||||
var word = document.getElementById("word"), sub = document.getElementById("sub");
|
||||
? { on: "LIMITER", more: "Mehr Gas bringt nichts", lost: "Keine Verbindung", none: "Kein Limiter überwacht", quiet: "Kein Signal", left: " dB bis zum Limiter" }
|
||||
: { on: "LIMITER", more: "More gain won't help", lost: "No connection", none: "No limiter being watched", quiet: "No signal", left: " dB to the limiter" };
|
||||
var word = document.getElementById("word"), sub = document.getElementById("sub"), cover = document.getElementById("cover");
|
||||
var RANGE = 30, gap = 100, state = null, closest = null;
|
||||
document.documentElement.lang = de ? "de" : "en";
|
||||
|
||||
// rises at once, falls slowly, like a level meter
|
||||
function bar(room) {
|
||||
var next = room == null ? 100 : Math.min(100, room / RANGE * 100);
|
||||
cover.style.transition = "width " + (next < gap ? ".08s" : ".6s") + " ease-out";
|
||||
cover.style.width = next + "%";
|
||||
gap = next;
|
||||
}
|
||||
|
||||
function show(on, main, small) {
|
||||
document.body.className = on ? "on" : "";
|
||||
word.textContent = main;
|
||||
sub.textContent = small;
|
||||
}
|
||||
|
||||
function draw() {
|
||||
var s = state;
|
||||
if (!s) return;
|
||||
if (s.on) show(true, text.on, text.more);
|
||||
else if (s.ready) show(false, "OK", closest == null ? text.quiet : closest.toFixed(1) + text.left);
|
||||
else show(false, "—", text.none);
|
||||
closest = s.room;
|
||||
}
|
||||
|
||||
var es = new EventSource("/djbrake/state");
|
||||
es.onmessage = function (e) {
|
||||
var s = JSON.parse(e.data);
|
||||
if (s.on) show(true, text.on, text.more);
|
||||
else if (s.ready) show(false, "OK", "");
|
||||
else show(false, "—", text.none);
|
||||
var s = JSON.parse(e.data), was = state && state.on;
|
||||
state = s;
|
||||
bar(s.on ? 0 : s.room);
|
||||
if (s.room != null && (closest == null || s.room < closest)) closest = s.room;
|
||||
if (s.on !== was || !s.ready) draw();
|
||||
};
|
||||
es.onerror = function () { show(false, "—", text.lost); };
|
||||
es.onerror = function () { state = null; bar(null); show(false, "—", text.lost); };
|
||||
// the number shows the closest value of the last moment: a figure jumping ten times a second can't be read
|
||||
setInterval(draw, 500);
|
||||
|
||||
// keep the screen on where the browser allows it
|
||||
function awake() { if (navigator.wakeLock) navigator.wakeLock.request("screen").catch(function () {}); }
|
||||
|
||||
+3
-1
@@ -678,7 +678,9 @@ const DE = {
|
||||
"Share the page /djbrake": "Seite /djbrake freigeben",
|
||||
"Address copied": "Adresse kopiert",
|
||||
"Switch on remote access below so other devices can reach it.": "Schalte unten den Fernzugriff ein, damit andere Geräte sie erreichen.",
|
||||
"Anyone in your network can open it without a PIN. It shows only the light, watches all outputs of all connected DSPs and changes nothing.": "Jeder in deinem Netzwerk kann sie ohne PIN öffnen. Sie zeigt nur das Licht, beobachtet alle Ausgänge aller verbundenen DSPs und ändert nichts.",
|
||||
"Anyone in your network can open it without a PIN. It shows only the light and the distance to the limiter and changes nothing.": "Jeder in deinem Netzwerk kann sie ohne PIN öffnen. Sie zeigt nur das Licht und den Abstand zum Limiter und ändert nichts.",
|
||||
"Limiters that count": "Diese Limiter zählen",
|
||||
"Connect a DSP to choose.": "Verbinde einen DSP, um auszuwählen.",
|
||||
};
|
||||
|
||||
const DE_PATTERNS = [
|
||||
|
||||
+8
-1
@@ -983,4 +983,11 @@ body.dashonly .dlink { cursor: default; }
|
||||
.djurl { margin-top: 8px; align-items: center; flex-wrap: nowrap; }
|
||||
.djurl code { flex: 1; min-width: 0; padding: 5px 8px; border-radius: 6px; background: var(--bg2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.djwarn { color: var(--warn); }
|
||||
.djurl button { flex: none; }
|
||||
.djurl button { flex: none; width: auto; }
|
||||
.djlim { margin: 12px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
|
||||
.djdev { margin-top: 8px; }
|
||||
.djdev > small { display: block; margin-bottom: 4px; color: var(--dim); }
|
||||
.djchs { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.djch { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 5px 8px; line-height: 1.2; opacity: .55; }
|
||||
.djch small { font-size: 10px; color: var(--dim); }
|
||||
.djch.on { opacity: 1; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
|
||||
Reference in new issue
Block a user