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
@@ -58,7 +58,7 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
|
|||||||
* **Sound Lab / REW** (`static/rew.js`, handbooks in `static/docs.js`, `rew_call` in `server.py`) – the server talks to REW's API on `127.0.0.1:4735`, which only answers on
|
* **Sound Lab / REW** (`static/rew.js`, handbooks in `static/docs.js`, `rew_call` in `server.py`) – the server talks to REW's API on `127.0.0.1:4735`, which only answers on
|
||||||
REW's own computer; so Sound Lab is only in the desktop apps (`S.isApp`, the server refuses `/api/rew/` otherwise). Only checked against a fake server built from its OpenAPI spec.
|
REW's own computer; so Sound Lab is only in the desktop apps (`S.isApp`, the server refuses `/api/rew/` otherwise). Only checked against a fake server built from its OpenAPI spec.
|
||||||
* **DJ Brake** (`static/djbrake.html`, `App.dj_stream`) – the only page without a login, off by default. It may only ever learn
|
* **DJ Brake** (`static/djbrake.html`, `App.dj_stream`) – the only page without a login, off by default. It may only ever learn
|
||||||
`{on, ready}` from `/djbrake/state`: never add device data or controls there. On its own on purpose, without `app.js`.
|
`{on, ready, room}` from `/djbrake/state`: never add device data or controls there. On its own on purpose, without `app.js`.
|
||||||
* **Network search** – `App.scan_network` probes the local /24 networks on TCP 9761 (handshake + device info),
|
* **Network search** – `App.scan_network` probes the local /24 networks on TCP 9761 (handshake + device info),
|
||||||
skipping DSPs this app is connected to.
|
skipping DSPs this app is connected to.
|
||||||
* **Copy settings / mute all** – `App.copy_settings` (`POST /api/copy`, groups level/filters/eq/dynamics/routing) and
|
* **Copy settings / mute all** – `App.copy_settings` (`POST /api/copy`, groups level/filters/eq/dynamics/routing) and
|
||||||
@@ -136,6 +136,8 @@ Not verified yet – ask for a log (`python server.py -v`) from real hardware be
|
|||||||
only; whether the generator is pre or post input gain is unknown (the app therefore only lowers the outputs)
|
only; whether the generator is pre or post input gain is unknown (the app therefore only lowers the outputs)
|
||||||
* Device lock (`0x2C` byte 5, `0x2D`, `0x2F`, `0x11`) – implemented from the control software's behaviour and
|
* Device lock (`0x2C` byte 5, `0x2D`, `0x2F`, `0x11`) – implemented from the control software's behaviour and
|
||||||
tested against the simulator only; no command to remove a lock is known
|
tested against the simulator only; no command to remove a lock is known
|
||||||
|
* DJ Brake distance to the limiter: output meter dB minus threshold dB, assumes both share one reference (only the
|
||||||
|
light, from the limiter-active bits, is certain)
|
||||||
* Limiter calculator reference level (assumes limiter 0 dB = 0 dBu at the output; adjustable per device)
|
* Limiter calculator reference level (assumes limiter 0 dB = 0 dBu at the output; adjustable per device)
|
||||||
* Pi Writer: raw write to a real SD card and first boot on a real Pi (only tested with an image file)
|
* Pi Writer: raw write to a real SD card and first boot on a real Pi (only tested with an image file)
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ Control both devices at the same time from your phone, tablet or computer – ov
|
|||||||
* **Read-only switch** – on phones and tablets the web UI starts read-only; a small switch at the top allows changes
|
* **Read-only switch** – on phones and tablets the web UI starts read-only; a small switch at the top allows changes
|
||||||
* **Sound Lab** (Windows and macOS apps) – together with REW (Room EQ Wizard): take the filters of a measurement or a REW filter file onto a channel,
|
* **Sound Lab** (Windows and macOS apps) – together with REW (Room EQ Wizard): take the filters of a measurement or a REW filter file onto a channel,
|
||||||
compare before applying, send a channel's curve or filters back to REW. Handbook with real cases here and in SoundField
|
compare before applying, send a channel's curve or filters back to REW. Handbook with real cases here and in SoundField
|
||||||
* **DJ Brake** – optional page `/djbrake` for a tablet at the DJ booth: a big red light while a limiter is working. Needs no PIN
|
* **DJ Brake** – optional page `/djbrake` for a tablet at the DJ booth: a big red light while a limiter is working and a horizontal
|
||||||
and shows nothing else
|
bar with the distance to the limiter. You choose which limiters count (a monitor can be left out). Needs no PIN and shows
|
||||||
|
nothing else
|
||||||
* **Mixer** – faders, mute and live meters for all inputs and outputs, limiter LED on every output (status read
|
* **Mixer** – faders, mute and live meters for all inputs and outputs, limiter LED on every output (status read
|
||||||
from the DSP)
|
from the DSP)
|
||||||
* **Channel** – name, gain, delay, polarity, high/low pass, 8/9-band PEQ with a draggable curve; the curve shows
|
* **Channel** – name, gain, delay, polarity, high/low pass, 8/9-band PEQ with a draggable curve; the curve shows
|
||||||
|
|||||||
@@ -213,6 +213,17 @@ def rew_send_curve(body: dict):
|
|||||||
|
|
||||||
|
|
||||||
DJ_HOLD = 0.8 # s the light of /djbrake stays on after a limiter acted, so short hits are seen
|
DJ_HOLD = 0.8 # s the light of /djbrake stays on after a limiter acted, so short hits are seen
|
||||||
|
|
||||||
|
|
||||||
|
def clean_dj_ignore(data) -> dict:
|
||||||
|
"""Outputs the DJ Brake does not watch, per device id. Everything else is watched, so new DSPs count by default."""
|
||||||
|
if not isinstance(data, dict):
|
||||||
|
return {}
|
||||||
|
out = {str(k)[:64]: sorted({i for i in v if type(i) is int and 0 <= i < 16})
|
||||||
|
for k, v in list(data.items())[:64] if isinstance(v, list)}
|
||||||
|
return {k: v for k, v in out.items() if v}
|
||||||
|
|
||||||
|
|
||||||
DASH_TYPES = ("status", "meters", "mixer", "curve", "channel", "limiter", "routing", "delays", "fir", "notes")
|
DASH_TYPES = ("status", "meters", "mixer", "curve", "channel", "limiter", "routing", "delays", "fir", "notes")
|
||||||
|
|
||||||
|
|
||||||
@@ -294,7 +305,9 @@ class App:
|
|||||||
self.soundfield: dict = clean_soundfield({})
|
self.soundfield: dict = clean_soundfield({})
|
||||||
self.dashboard: dict | None = None
|
self.dashboard: dict | None = None
|
||||||
self.djbrake = False # page /djbrake for the DJ: without PIN, shows only whether a limiter acts
|
self.djbrake = False # page /djbrake for the DJ: without PIN, shows only whether a limiter acts
|
||||||
|
self.dj_ignore: dict = {} # device id -> outputs not watched
|
||||||
self.dj_hit = 0.0 # when a limiter was last seen acting
|
self.dj_hit = 0.0 # when a limiter was last seen acting
|
||||||
|
self.dj_rooms: dict = {} # device id -> dB left to the nearest watched limiter, False = nothing watched
|
||||||
self.dj_streams = 0
|
self.dj_streams = 0
|
||||||
self.logo = ""
|
self.logo = ""
|
||||||
# desktop app: its own window logs in with a one-time token, other devices need the PIN
|
# desktop app: its own window logs in with a one-time token, other devices need the PIN
|
||||||
@@ -345,6 +358,7 @@ class App:
|
|||||||
if "dashboard" in cfg:
|
if "dashboard" in cfg:
|
||||||
self.dashboard = clean_dashboard(cfg.get("dashboard"))
|
self.dashboard = clean_dashboard(cfg.get("dashboard"))
|
||||||
self.djbrake = bool(cfg.get("djbrake"))
|
self.djbrake = bool(cfg.get("djbrake"))
|
||||||
|
self.dj_ignore = clean_dj_ignore(cfg.get("dj_ignore"))
|
||||||
if "logo" in cfg:
|
if "logo" in cfg:
|
||||||
self.logo = clean_logo(cfg.get("logo"))
|
self.logo = clean_logo(cfg.get("logo"))
|
||||||
r = cfg.get("remote") or {}
|
r = cfg.get("remote") or {}
|
||||||
@@ -361,7 +375,7 @@ class App:
|
|||||||
return {"format": CONFIG_FORMAT, "version": 1, "exported": time.strftime("%Y-%m-%dT%H:%M:%S"),
|
return {"format": CONFIG_FORMAT, "version": 1, "exported": time.strftime("%Y-%m-%dT%H:%M:%S"),
|
||||||
"devices": [d.config() for d in self.real_devices()], "auth": self.auth,
|
"devices": [d.config() for d in self.real_devices()], "auth": self.auth,
|
||||||
"limiter": self.limiter, "remote": self.remote, "soundfield": self.soundfield, "logo": self.logo,
|
"limiter": self.limiter, "remote": self.remote, "soundfield": self.soundfield, "logo": self.logo,
|
||||||
"dashboard": self.dashboard, "djbrake": self.djbrake}
|
"dashboard": self.dashboard, "djbrake": self.djbrake, "dj_ignore": self.dj_ignore}
|
||||||
|
|
||||||
async def restore_config(self, doc: dict, session: str):
|
async def restore_config(self, doc: dict, session: str):
|
||||||
if not isinstance(doc, dict) or doc.get("format") != CONFIG_FORMAT:
|
if not isinstance(doc, dict) or doc.get("format") != CONFIG_FORMAT:
|
||||||
@@ -419,7 +433,7 @@ class App:
|
|||||||
sessions = {k: v for k, v in self.sessions.items() if k not in self.app_sessions}
|
sessions = {k: v for k, v in self.sessions.items() if k not in self.app_sessions}
|
||||||
cfg = {"devices": [d.config() for d in self.real_devices()], "auth": self.auth,
|
cfg = {"devices": [d.config() for d in self.real_devices()], "auth": self.auth,
|
||||||
"sessions": sessions, "limiter": self.limiter, "remote": self.remote, "locked": self.locked, "lock_dash": self.lock_dash,
|
"sessions": sessions, "limiter": self.limiter, "remote": self.remote, "locked": self.locked, "lock_dash": self.lock_dash,
|
||||||
"soundfield": self.soundfield, "logo": self.logo, "dashboard": self.dashboard, "djbrake": self.djbrake,
|
"soundfield": self.soundfield, "logo": self.logo, "dashboard": self.dashboard, "djbrake": self.djbrake, "dj_ignore": self.dj_ignore,
|
||||||
"mute_all": {"active": self.mute_all["active"],
|
"mute_all": {"active": self.mute_all["active"],
|
||||||
"restore": {k: v for k, v in self.mute_all["restore"].items() if k != "demo"}}}
|
"restore": {k: v for k, v in self.mute_all["restore"].items() if k != "demo"}}}
|
||||||
if self.lang:
|
if self.lang:
|
||||||
@@ -875,9 +889,27 @@ class App:
|
|||||||
|
|
||||||
# ------------------------------------------------------------ events
|
# ------------------------------------------------------------ events
|
||||||
|
|
||||||
def broadcast(self, ev: dict):
|
def dj_note(self, ev: dict):
|
||||||
if ev.get("type") == "meters" and any(ev.get("limit") or ()):
|
"""Keeps the state of the /djbrake page. A muted output is not watched: nobody hears it."""
|
||||||
|
dev = self.devices.get(ev["device"])
|
||||||
|
if not dev or not dev.state:
|
||||||
|
return
|
||||||
|
room, ignore = False, self.dj_ignore.get(dev.id, ())
|
||||||
|
for i, (level, limit) in enumerate(zip(ev["out"], ev["limit"])):
|
||||||
|
ch = dev.state["outputs"][i]
|
||||||
|
if i in ignore or ch["mute"]:
|
||||||
|
continue
|
||||||
|
if limit:
|
||||||
self.dj_hit = time.monotonic()
|
self.dj_hit = time.monotonic()
|
||||||
|
left = 0.0 if limit else None
|
||||||
|
if not limit and level > 0:
|
||||||
|
left = max(0.0, P.threshold_to_db(ch["limit"]["threshold"]) - 20 * math.log10(level))
|
||||||
|
room = left if room is False or room is None else room if left is None else min(room, left)
|
||||||
|
self.dj_rooms[dev.id] = room
|
||||||
|
|
||||||
|
def broadcast(self, ev: dict):
|
||||||
|
if ev["type"] == "meters":
|
||||||
|
self.dj_note(ev)
|
||||||
msg = json.dumps(ev, separators=(",", ":"))
|
msg = json.dumps(ev, separators=(",", ":"))
|
||||||
for q in list(self.clients):
|
for q in list(self.clients):
|
||||||
if ev["type"] == "meters" and q.qsize() > 50:
|
if ev["type"] == "meters" and q.qsize() > 50:
|
||||||
@@ -901,10 +933,14 @@ class App:
|
|||||||
if path == "/api/logo":
|
if path == "/api/logo":
|
||||||
return {"logo": self.logo}
|
return {"logo": self.logo}
|
||||||
if path == "/api/djbrake" and method == "PUT":
|
if path == "/api/djbrake" and method == "PUT":
|
||||||
self.djbrake = bool(body.get("enabled"))
|
if "enabled" in body:
|
||||||
|
self.djbrake = bool(body["enabled"])
|
||||||
|
if "ignore" in body:
|
||||||
|
self.dj_ignore = clean_dj_ignore(body["ignore"])
|
||||||
self.save()
|
self.save()
|
||||||
self.broadcast({"type": "djbrake", "enabled": self.djbrake})
|
ans = {"enabled": self.djbrake, "ignore": self.dj_ignore}
|
||||||
return {"enabled": self.djbrake}
|
self.broadcast({"type": "djbrake", **ans})
|
||||||
|
return ans
|
||||||
if path == "/api/dashboard" and method == "PUT":
|
if path == "/api/dashboard" and method == "PUT":
|
||||||
self.dashboard = clean_dashboard(body)
|
self.dashboard = clean_dashboard(body)
|
||||||
self.save()
|
self.save()
|
||||||
@@ -1246,7 +1282,7 @@ class App:
|
|||||||
await self.respond(writer, 200, f.read_bytes(), ctype)
|
await self.respond(writer, 200, f.read_bytes(), ctype)
|
||||||
|
|
||||||
async def dj_stream(self, writer):
|
async def dj_stream(self, writer):
|
||||||
"""The one thing /djbrake may know, without a login: is a limiter acting. Nothing else leaves here."""
|
"""All /djbrake may know, without a login: is a limiter acting and how far away is it. Nothing else leaves here."""
|
||||||
if not self.djbrake or self.dj_streams >= 20:
|
if not self.djbrake or self.dj_streams >= 20:
|
||||||
await self.respond(writer, 404, b"not found", "text/plain")
|
await self.respond(writer, 404, b"not found", "text/plain")
|
||||||
return
|
return
|
||||||
@@ -1257,8 +1293,11 @@ class App:
|
|||||||
try:
|
try:
|
||||||
while self.djbrake:
|
while self.djbrake:
|
||||||
now = time.monotonic()
|
now = time.monotonic()
|
||||||
state = {"on": now - self.dj_hit < DJ_HOLD,
|
rooms = [self.dj_rooms.get(d.id, False) for d in self.devices.values() if d.status == "online"]
|
||||||
"ready": any(d.status == "online" for d in self.devices.values())}
|
rooms = [r for r in rooms if r is not False]
|
||||||
|
known = [r for r in rooms if r is not None]
|
||||||
|
state = {"on": now - self.dj_hit < DJ_HOLD, "ready": bool(rooms),
|
||||||
|
"room": round(min(known) * 2) / 2 if known else None}
|
||||||
if state != last:
|
if state != last:
|
||||||
writer.write(f"data: {json.dumps(state)}\n\n".encode())
|
writer.write(f"data: {json.dumps(state)}\n\n".encode())
|
||||||
last, idle = state, 0.0
|
last, idle = state, 0.0
|
||||||
@@ -1279,7 +1318,7 @@ class App:
|
|||||||
try:
|
try:
|
||||||
hello = {"type": "hello", "devices": [d.snapshot() for d in self.devices.values()], "limiter": self.limiter,
|
hello = {"type": "hello", "devices": [d.snapshot() for d in self.devices.values()], "limiter": self.limiter,
|
||||||
"demo": self.demo_info(), "muteall": self.mute_all_info(), "soundfield": self.soundfield, "logo": self.logo,
|
"demo": self.demo_info(), "muteall": self.mute_all_info(), "soundfield": self.soundfield, "logo": self.logo,
|
||||||
"dashboard": self.dashboard, "djbrake": self.djbrake}
|
"dashboard": self.dashboard, "djbrake": self.djbrake, "dj_ignore": self.dj_ignore}
|
||||||
writer.write(f"data: {json.dumps(hello)}\n\n".encode())
|
writer.write(f"data: {json.dumps(hello)}\n\n".encode())
|
||||||
await writer.drain()
|
await writer.drain()
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
+21
-3
@@ -2384,7 +2384,25 @@ function djBrakeCard() {
|
|||||||
try { await navigator.clipboard.writeText(url); toast(t("Address copied")); } catch { toast(url); }
|
try { await navigator.clipboard.writeText(url); toast(t("Address copied")); } catch { toast(url); }
|
||||||
} }, t("Copy"))) : null,
|
} }, 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 && !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() {
|
function langCard() {
|
||||||
@@ -2637,7 +2655,7 @@ function connectEvents() {
|
|||||||
if (ev.muteall) { S.muteAll = ev.muteall.active; showMuteAll(); }
|
if (ev.muteall) { S.muteAll = ev.muteall.active; showMuteAll(); }
|
||||||
if (ev.soundfield) S.sf = ev.soundfield;
|
if (ev.soundfield) S.sf = ev.soundfield;
|
||||||
if ("dashboard" in ev) S.dash = ev.dashboard && ev.dashboard.modules;
|
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 ("logo" in ev) { S.logo = ev.logo; showLogo(); }
|
||||||
if (S.demo.enabled && S.devices.demo && !S.devices[S.cur]?.demo) S.cur = "demo";
|
if (S.demo.enabled && S.devices.demo && !S.devices[S.cur]?.demo) S.cur = "demo";
|
||||||
S.order.forEach(id => maybeAskUnlock(S.devices[id]));
|
S.order.forEach(id => maybeAskUnlock(S.devices[id]));
|
||||||
@@ -2673,7 +2691,7 @@ function connectEvents() {
|
|||||||
case "dashboard":
|
case "dashboard":
|
||||||
dashRemote(ev.data); break;
|
dashRemote(ev.data); break;
|
||||||
case "djbrake":
|
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":
|
case "logo":
|
||||||
S.logo = ev.data; showLogo(); if (S.settings) render(); break;
|
S.logo = ev.data; showLogo(); if (S.settings) render(); break;
|
||||||
case "muteall":
|
case "muteall":
|
||||||
|
|||||||
+48
-11
@@ -16,14 +16,26 @@
|
|||||||
body.on #wash, body.on #halo, body.on #core { transition: opacity .09s ease-out; opacity: 1; }
|
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%); }
|
#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%; }
|
#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; }
|
#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; }
|
#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); }
|
#halo { inset: -7vmin; background: radial-gradient(circle, #ff2a1f 44%, #ff2a1f00 70%); filter: blur(3vmin); }
|
||||||
#ring { border: .5vmin solid #ff5a4c; opacity: 0; pointer-events: none; }
|
#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; }
|
#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: #6b7280; 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 #word { color: #fff; transition: color .09s; }
|
||||||
body.on #sub { color: #ffd9d4; transition: color .09s; }
|
body.on #sub { color: #ffd9d4; transition: color .09s; }
|
||||||
|
|
||||||
@@ -44,6 +56,10 @@
|
|||||||
<div id="core"></div>
|
<div id="core"></div>
|
||||||
<div id="word">—</div>
|
<div id="word">—</div>
|
||||||
</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>
|
<div id="sub"></div>
|
||||||
<script>
|
<script>
|
||||||
// Red light for the DJ: comes on while a limiter of a connected DSP is working.
|
// Red light for the DJ: comes on while a limiter of a connected DSP is working.
|
||||||
@@ -51,25 +67,46 @@
|
|||||||
(function () {
|
(function () {
|
||||||
var de = /^de/i.test(navigator.language || "");
|
var de = /^de/i.test(navigator.language || "");
|
||||||
var text = de
|
var text = de
|
||||||
? { on: "LIMITER", more: "Mehr Gas bringt nichts", lost: "Keine Verbindung", none: "Kein DSP verbunden" }
|
? { 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 DSP connected" };
|
: { 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");
|
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";
|
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) {
|
function show(on, main, small) {
|
||||||
document.body.className = on ? "on" : "";
|
document.body.className = on ? "on" : "";
|
||||||
word.textContent = main;
|
word.textContent = main;
|
||||||
sub.textContent = small;
|
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");
|
var es = new EventSource("/djbrake/state");
|
||||||
es.onmessage = function (e) {
|
es.onmessage = function (e) {
|
||||||
var s = JSON.parse(e.data);
|
var s = JSON.parse(e.data), was = state && state.on;
|
||||||
if (s.on) show(true, text.on, text.more);
|
state = s;
|
||||||
else if (s.ready) show(false, "OK", "");
|
bar(s.on ? 0 : s.room);
|
||||||
else show(false, "—", text.none);
|
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
|
// keep the screen on where the browser allows it
|
||||||
function awake() { if (navigator.wakeLock) navigator.wakeLock.request("screen").catch(function () {}); }
|
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",
|
"Share the page /djbrake": "Seite /djbrake freigeben",
|
||||||
"Address copied": "Adresse kopiert",
|
"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.",
|
"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 = [
|
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 { 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; }
|
.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); }
|
.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