Add audio test tab with test generator, test fader and output mutes
- switch the DSP's test generator (pink/white noise, sine 20 Hz-20 kHz, command 0x39) - entering lowers all outputs to -50 dB before the generator starts; one test fader raises them together; mute buttons for every output - presets cannot be stored, recalled, imported or exported while the test runs - leaving switches the generator off first, then restores every output gain - a DSP found playing a test signal on connect goes straight into the audio test; saved gains survive an app restart (config.json) - simulator and memory-image support for the test signal Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
61400df667
commit
66f988cf08
12 files changed
+280
-12
No files matched your search
+79
-6
@@ -520,7 +520,7 @@ function renderTabs() {
|
||||
title: paused ? t("Disconnected while demo mode is on") : d.demo ? t("Demo mode – simulated DSP") : `${d.name} · ${where(d)}`,
|
||||
disabled: paused, onclick: () => { S.cur = id; S.settings = false; store.set("dsp.cur", id); render(); } },
|
||||
h("span", { class: "dot " + d.status }), h("span", { class: "dn" }, d.name),
|
||||
d.demo ? h("small", { class: "demo-badge" }, "DEMO") : model ? h("small", {}, model) : null);
|
||||
testOn(d) ? h("small", { class: "test-badge" }, "TEST") : d.demo ? h("small", { class: "demo-badge" }, "DEMO") : model ? h("small", {}, model) : null);
|
||||
}));
|
||||
$("#btn-settings").classList.toggle("on", S.settings);
|
||||
document.querySelectorAll("#viewtabs button").forEach(b => b.classList.toggle("active", !S.settings && b.dataset.view === S.view));
|
||||
@@ -712,6 +712,8 @@ function renderStatus() {
|
||||
const presetSel = h("select", { "aria-label": t("Recall preset") },
|
||||
h("option", { value: "" }, t("Recall preset…")),
|
||||
d.presets.map((p, i) => h("option", { value: i, disabled: !p }, `U${String(i + 1).padStart(2, "0")} ${p || "—"}`)));
|
||||
const testing = testOn(d);
|
||||
presetSel.disabled = testing;
|
||||
presetSel.addEventListener("change", async () => {
|
||||
if (presetSel.value === "") return;
|
||||
const i = +presetSel.value;
|
||||
@@ -724,8 +726,8 @@ function renderStatus() {
|
||||
});
|
||||
bar.replaceChildren(
|
||||
h("div", { class: "preset" }, h("small", {}, d.demo ? t("Demo mode · simulated DSP") : `${d.info || d.name} · ${where(d)}`), h("b", {}, d.state.preset_name || "—")),
|
||||
h("div", { class: "presetrow" }, presetSel, h("button", { onclick: () => storePresetDialog(d) }, t("Save")),
|
||||
h("button", { onclick: () => presetFileDialog(d), title: t("Export / import preset"), "data-view-ok": "" }, t("File…"))));
|
||||
h("div", { class: "presetrow" }, presetSel, h("button", { disabled: testing, title: testing ? t("Not possible during the audio test") : "", onclick: () => storePresetDialog(d) }, t("Save")),
|
||||
h("button", { disabled: testing, onclick: () => presetFileDialog(d), title: testing ? t("Not possible during the audio test") : t("Export / import preset"), "data-view-ok": "" }, t("File…"))));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ mixer
|
||||
@@ -1396,6 +1398,68 @@ function viewLimiter(d) {
|
||||
];
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ audio test (test generator of the DSP)
|
||||
|
||||
const testOn = d => !!(d && d.state && d.state.test && d.state.test.source);
|
||||
const TEST_SRC = () => [[0, t("Analog input"), t("normal operation")], [1, t("Pink noise"), ""], [2, t("White noise"), ""], [3, t("Sine"), ""]];
|
||||
const LVL_MIN = -60, LVL_MAX = 0; // test fader range in dB (all outputs at the same level)
|
||||
|
||||
async function setTestSignal(d, source, freq) {
|
||||
try { await api("POST", `/api/devices/${d.id}/test`, { source, freq: freq ?? d.state.test.freq }); }
|
||||
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
|
||||
}
|
||||
|
||||
// one request in flight at a time, always ending with the latest fader position
|
||||
function sendTestLevel(d, db) {
|
||||
sendTestLevel.next = db;
|
||||
if (sendTestLevel.busy) return;
|
||||
sendTestLevel.busy = true;
|
||||
(async () => {
|
||||
while (sendTestLevel.next != null) {
|
||||
const v = sendTestLevel.next;
|
||||
sendTestLevel.next = null;
|
||||
try { await api("POST", `/api/devices/${d.id}/testlevel`, { db: v }); } catch (e) { toast(trMsg(e.message)); }
|
||||
}
|
||||
sendTestLevel.busy = false;
|
||||
})();
|
||||
}
|
||||
|
||||
function viewTest(d) {
|
||||
const on = testOn(d), test = d.state.test;
|
||||
const freqSel = h("select", { "aria-label": t("Sine frequency"), onchange: () => setTestSignal(d, 3, +freqSel.value) },
|
||||
GEQ_FREQS.map((f, i) => h("option", { value: i, selected: i === test.freq }, f.endsWith("k") ? `${f.slice(0, -1)} kHz` : `${f} Hz`)));
|
||||
const signalCard = h("div", { class: "card" },
|
||||
h("h3", {}, t("Input signal")),
|
||||
h("div", { class: "srcgrid" }, TEST_SRC().map(([v, label, sub]) =>
|
||||
h("button", { class: "src" + (test.source === v ? " on" : "") + (v ? " noise" : ""), "aria-pressed": String(test.source === v),
|
||||
onclick: () => test.source !== v && setTestSignal(d, v, v === 3 ? +freqSel.value : test.freq) },
|
||||
h("b", {}, label), sub ? h("small", {}, sub) : null))),
|
||||
h("label", { class: "row sinefreq" + (test.source === 3 ? "" : " dim") }, h("span", { class: "grow" }, t("Sine frequency")), freqSel),
|
||||
h("p", { class: "info" }, t("The test signal replaces the analog inputs of the DSP. When it is switched on, all outputs are lowered to −50 dB first – raise them slowly with the test fader.")));
|
||||
|
||||
const lvl = d.test_level ?? -50;
|
||||
const val = h("div", { class: "testval" }, on ? `${lvl.toFixed(1)} dB` : "—");
|
||||
const f = fader({ min: 0, max: (LVL_MAX - LVL_MIN) * 2, value: Math.round((lvl - LVL_MIN) * 2), label: t("Test fader"),
|
||||
ticks: [-60, -50, -40, -30, -20, -10, 0].map(db => [(db - LVL_MIN) * 2, String(db)]),
|
||||
onInput: v => { const db = LVL_MIN + v / 2; d.test_level = db; val.textContent = `${db.toFixed(1)} dB`; sendTestLevel(d, db); } });
|
||||
const outs = chans(d, "out").map((ch, i) => {
|
||||
const m = h("div", { class: "tmeter" + (ch.mute ? " muted" : "") }, ledMeter(d.id, "out", i), h("small", {}, chLabel("out", i)), limLed(d.id, i));
|
||||
m.append(toggleBtn("MUTE", "out", i, "mute", "mute small", v => m.classList.toggle("muted", v)));
|
||||
return m;
|
||||
});
|
||||
const faderCard = h("div", { class: "card testfader" + (on ? "" : " off") },
|
||||
h("h3", {}, t("Test fader"), h("span", { class: "info" }, t("all outputs"))),
|
||||
h("div", { class: "testbody" }, h("div", { class: "tf" }, f, val), h("div", { class: "tmeters" }, outs)),
|
||||
on ? h("button", { class: "danger-on wide", onclick: () => setTestSignal(d, 0) }, t("Stop test – back to the analog input")) : null,
|
||||
h("p", { class: "info" }, on
|
||||
? t("Saving and recalling presets is blocked during the test. Stopping it switches the noise off first and then puts every fader back where it was.")
|
||||
: t("Choose a test signal above to start.")));
|
||||
return [
|
||||
on ? h("div", { class: "testbanner" }, t("Audio test running – the DSP plays {signal} instead of its inputs.", { signal: TEST_SRC()[test.source][1] })) : null,
|
||||
h("div", { class: "cards testcards" }, signalCard, faderCard),
|
||||
];
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ settings
|
||||
|
||||
function deviceForm(d) {
|
||||
@@ -1616,7 +1680,7 @@ function render() {
|
||||
: d.status === "locked" ? h("div", {}, h("p", {}, t("This DSP is locked with a code.")),
|
||||
h("button", { class: "on", onclick: () => unlockDialog(d) }, t("Enter code")))
|
||||
: S.demo.enabled && !d.demo ? t("Disconnected while demo mode is on") : t("Not connected."));
|
||||
else content = ({ mixer: viewMixer, channel: viewChannel, routing: viewRouting, link: viewLink, limiter: viewLimiter }[S.view] || viewMixer)(d);
|
||||
else content = ({ mixer: viewMixer, channel: viewChannel, routing: viewRouting, link: viewLink, limiter: viewLimiter, test: viewTest }[S.view] || viewMixer)(d);
|
||||
main.replaceChildren(...[content].flat().filter(Boolean));
|
||||
main.querySelectorAll(H_SCROLL).forEach((e, i) => { if (xs[i]) e.scrollLeft = xs[i]; });
|
||||
window.scrollTo(0, y);
|
||||
@@ -1709,10 +1773,18 @@ function connectEvents() {
|
||||
S.order.forEach(id => maybeAskUnlock(S.devices[id]));
|
||||
if (!S.order.length) S.settings = true;
|
||||
render(); break;
|
||||
case "device":
|
||||
case "device": {
|
||||
if (!S.devices[ev.device]) S.order.push(ev.device);
|
||||
const was = testOn(S.devices[ev.device]);
|
||||
S.devices[ev.device] = ev.data;
|
||||
if (!was && testOn(ev.data) && ev.device === S.cur && !S.settings) S.view = "test"; // e.g. DSP found playing noise
|
||||
render(); break;
|
||||
}
|
||||
case "test": {
|
||||
const d = S.devices[ev.device];
|
||||
if (d && d.state) { d.state.test = ev.test; render(); }
|
||||
break;
|
||||
}
|
||||
case "removed":
|
||||
delete S.devices[ev.device]; S.order = S.order.filter(id => id !== ev.device);
|
||||
render(); break;
|
||||
@@ -1736,7 +1808,8 @@ function connectEvents() {
|
||||
if (JSON.stringify(getPath(ch, ev.param)) === JSON.stringify(ev.value)) break;
|
||||
setPath(ch, ev.param, ev.value);
|
||||
showLive(`${ev.device}|${ev.kind}|${ev.idx}|${ev.param}`, ev.value); // even while a fader is held
|
||||
if (ev.device === S.cur && !S.settings) render();
|
||||
// the test fader moves every output: the audio test view only shows meters, no need to redraw
|
||||
if (ev.device === S.cur && !S.settings && !(S.view === "test" && ev.param === "gain")) render();
|
||||
break;
|
||||
}
|
||||
case "lock":
|
||||
|
||||
@@ -321,6 +321,25 @@ const DE = {
|
||||
"Try everything with a simulated DSP – nothing is sent to real devices. While demo mode is on, the real DSPs are disconnected.": "Alles gefahrlos mit einem simulierten DSP ausprobieren – an echte Geräte wird nichts gesendet. Solange der Demo-Modus aktiv ist, sind die echten DSPs getrennt.",
|
||||
"Not available for the demo device": "Für das Demo-Gerät nicht verfügbar",
|
||||
"Demo mode is on – switch it off to connect the real DSPs": "Der Demo-Modus ist aktiv – zum Verbinden der echten DSPs bitte ausschalten",
|
||||
// audio test
|
||||
"Audio test": "Audiotest",
|
||||
"Analog input": "Analog-Eingang",
|
||||
"normal operation": "Normalbetrieb",
|
||||
"Pink noise": "Rosa Rauschen",
|
||||
"White noise": "Weißes Rauschen",
|
||||
"Sine": "Sinus",
|
||||
"Sine frequency": "Sinus-Frequenz",
|
||||
"Input signal": "Eingangssignal",
|
||||
"Test fader": "Testfader",
|
||||
"all outputs": "alle Ausgänge",
|
||||
"Audio test running – the DSP plays {signal} instead of its inputs.": "Audiotest läuft – der DSP spielt {signal} statt seiner Eingänge.",
|
||||
"Choose a test signal above to start.": "Zum Starten oben ein Testsignal wählen.",
|
||||
"Not possible during the audio test": "Während des Audiotests nicht möglich",
|
||||
"Saving and recalling presets is blocked during the test. Stopping it switches the noise off first and then puts every fader back where it was.": "Presets speichern und laden ist während des Tests gesperrt. Beim Beenden wird zuerst das Rauschen abgeschaltet, danach gehen alle Fader zurück auf ihren ursprünglichen Wert.",
|
||||
"Stop test – back to the analog input": "Test beenden – zurück zum Analog-Eingang",
|
||||
"The test signal replaces the analog inputs of the DSP. When it is switched on, all outputs are lowered to −50 dB first – raise them slowly with the test fader.": "Das Testsignal ersetzt die Analog-Eingänge des DSP. Beim Einschalten werden zuerst alle Ausgänge auf −50 dB abgesenkt – mit dem Testfader langsam hochziehen.",
|
||||
"Audio test is on – switch it off first": "Der Audiotest läuft – bitte zuerst beenden",
|
||||
"Audio test is off": "Der Audiotest ist aus",
|
||||
};
|
||||
|
||||
const DE_PATTERNS = [
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<button data-view="routing"><svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16M8 3v18M16 3v18"/><circle cx="8" cy="6" r="2.2" class="f"/><circle cx="16" cy="12" r="2.2" class="f"/><circle cx="8" cy="18" r="2.2" class="f"/></svg><span>Routing</span></button>
|
||||
<button data-view="link"><svg viewBox="0 0 24 24"><path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/></svg><span>Link</span></button>
|
||||
<button data-view="limiter"><svg viewBox="0 0 24 24"><path d="M2 7h20" stroke-dasharray="2.5 2.5"/><path d="M2 14c2 0 3-7 5-7h3c2 0 3 11 6 11s3-5 6-5"/></svg><span>Limiter</span></button>
|
||||
<button data-view="test"><svg viewBox="0 0 24 24"><path d="M4 9v6h4l5 4V5L8 9z"/><path d="M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12"/></svg><span data-t="Audio test">Audio test</span></button>
|
||||
</nav>
|
||||
<button id="btn-lock" class="icon" hidden aria-label="Lock" title="Lock"></button>
|
||||
<button id="btn-settings" class="icon" aria-label="Settings" title="Settings" data-t-label="Settings">
|
||||
|
||||
@@ -462,3 +462,31 @@ input.code { width: 7.5em; text-align: center; font-family: ui-monospace, Menlo,
|
||||
.dialog label.chk input { width: 20px; height: 20px; }
|
||||
.dialog .err { text-align: center; }
|
||||
.lockbox input.code { flex: none; width: 7.5em; }
|
||||
|
||||
/* ---- audio test */
|
||||
.test-badge { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #fff !important;
|
||||
background: var(--bad) !important; border-radius: 5px; padding: 1px 6px; }
|
||||
.testbanner { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font-weight: 600;
|
||||
background: color-mix(in srgb, var(--bad) 18%, transparent); border: 1px solid var(--bad); }
|
||||
.cards.testcards { grid-template-columns: minmax(0, 1fr); }
|
||||
.srcgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
|
||||
.srcgrid .src { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; text-align: left;
|
||||
text-transform: none; letter-spacing: 0; min-height: 58px; }
|
||||
.srcgrid .src small { color: var(--dim); font-weight: 400; }
|
||||
.srcgrid .src.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
|
||||
.srcgrid .src.noise.on { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--panel)); }
|
||||
.sinefreq { margin-top: 12px; align-items: center; gap: 10px; }
|
||||
.sinefreq.dim { opacity: .5; }
|
||||
.testfader.off .tf { opacity: .35; pointer-events: none; }
|
||||
.testbody { display: flex; gap: 18px; align-items: flex-start; min-width: 0; }
|
||||
.tf { display: flex; flex-direction: column; align-items: center; gap: 8px; }
|
||||
.tf .fader { height: 300px; }
|
||||
.testval { white-space: nowrap; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
|
||||
.tmeters { display: flex; gap: 6px; overflow-x: auto; min-width: 0; padding-bottom: 4px; }
|
||||
.tmeter { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
|
||||
.tmeter .led { height: 300px; }
|
||||
.testfader h3 .info { margin-left: 8px; text-transform: none; letter-spacing: 0; font-weight: 400; }
|
||||
.tmeter small { font-size: 11px; color: var(--dim); }
|
||||
button.wide { width: 100%; margin-top: 14px; }
|
||||
.tmeter button.mute { padding: 6px 8px; font-size: 11px; min-width: 52px; }
|
||||
.tmeter.muted .led { opacity: .35; }
|
||||
Reference in new issue
Block a user