Runde 7: Stream-Deck-Tasten zeigen Zeichen und Zustand, MIDI-Pads bekommen Note an/aus, Saal-Fenster öffnet mit Zocken starten (mit Spende, Tipp-Runde, Zuschauerzahl); mess-zocken mit eigenem Handy-Zugang

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-05 15:26:19 +01:00
co-authored by Claude Opus 5.5
parent 8d93cc24ec
commit b5698eb2a1
59 changed files with 1000 additions and 848 deletions
+25 -1
View File
@@ -206,12 +206,14 @@ seite.on("console", (m) => { if (m.type() === "error" && !/compute-pressure|yout
Tasten ab Byte 3). */
await seite.addInitScript(() => {
const geraet = { vendorId: 0x0fd9, productId: 0x0080, productName: "Stream Deck MK.2", opened: false, h: [],
async open() { this.opened = true; }, addEventListener(a, f) { if (a === "inputreport") this.h.push(f); }, removeEventListener(a, f) { this.h = this.h.filter((x) => x !== f); } };
async open() { this.opened = true; }, berichte: [], async sendReport(id, daten) { this.berichte.push({ id, d: Array.from(daten.slice(0, 7)), jpeg: daten[7] === 0xff && daten[8] === 0xd8 }); }, addEventListener(a, f) { if (a === "inputreport") this.h.push(f); }, removeEventListener(a, f) { this.h = this.h.filter((x) => x !== f); } };
window.__sd = geraet;
window.__sdDruck = (taste) => {
const bytes = new Uint8Array(3 + 15); bytes[0] = 0; bytes[1] = 15; if (taste >= 0) bytes[3 + taste] = 1;
for (const f of geraet.h) f({ reportId: 1, device: geraet, data: new DataView(bytes.buffer) });
};
window.__midiAus = [];
navigator.requestMIDIAccess = async () => ({ inputs: new Map(), outputs: new Map([["o1", { name: "RØDECaster", send: (b) => window.__midiAus.push(Array.from(b)) }]]), onstatechange: null });
Object.defineProperty(navigator, "hid", { configurable: true, value: { requestDevice: async () => [geraet], getDevices: async () => [geraet] } });
window.__tasten = [];
document.addEventListener("keydown", (e) => { if (!e.isTrusted) window.__tasten.push(e.key); }, true);
@@ -255,6 +257,28 @@ const z2 = await seite.evaluate(() => window.Pads.zuordnung());
ok(z2["sd:1:2"] === "band" && !Object.values(z2).includes("moment"), `eine Taste, eine Funktion: Taste 3 ist jetzt nur noch „Band“ (${JSON.stringify(z2)})`);
const sagt = await seite.evaluate(() => document.getElementById("pads-sagt").textContent);
ok(/Stream Deck · Taste 3 war „Moment merken“/.test(sagt), `und das wird gesagt („${sagt}“)`);
/* Rückmeldung (Runde 7): Taste 3 bekommt ihr Bild (JPEG in 1016er-Stücken, Bericht 2). */
await warte(1500);
const bilder = await seite.evaluate(() => window.__sd.berichte.filter((b) => b.d[1] === 2));
ok(bilder.length >= 1 && bilder[0].id === 2 && bilder[0].d[0] === 0x07 && bilder[0].jpeg && bilder.at(-1).d[2] === 1, `Taste 3 bekommt ihr Zeichen als Bild (${bilder.length} Stück, JPEG, letztes markiert)`);
/* Mikro stumm → das Bild der Mikro-Taste wechselt auf „aus“ */
await seite.evaluate(() => { window.Pads.zuordnen("mikro", "sd:1:7"); window.Pads.zuordnen("kamera", "note:1:36"); });
await warte(1500);
const vorStumm = await seite.evaluate(() => window.__sd.berichte.filter((b) => b.d[1] === 7).length);
await seite.evaluate(() => { const m = document.getElementById("s-mikro"); m.setAttribute("aria-pressed", "true"); });
await warte(1500);
const nachStumm = await seite.evaluate(() => window.__sd.berichte.filter((b) => b.d[1] === 7).length);
ok(vorStumm >= 1 && nachStumm > vorStumm, `Mikro stumm: die Mikro-Taste bekommt ein neues Bild (${vorStumm} → ${nachStumm} Berichte)`);
await seite.evaluate(() => document.getElementById("s-mikro").setAttribute("aria-pressed", "false"));
/* MIDI: ein Pad bekommt Note an/aus für seinen Zustand – erst nach dem Verbinden */
await seite.evaluate(() => window.Pads.verbinden());
await warte(1500);
const m1 = await seite.evaluate(() => window.__midiAus.slice());
await seite.evaluate(() => document.getElementById("s-kamera").setAttribute("aria-pressed", "true"));
await warte(1500);
const m2 = await seite.evaluate(() => window.__midiAus.slice());
await seite.evaluate(() => document.getElementById("s-kamera").setAttribute("aria-pressed", "false"));
ok(m1.some((x) => x[0] === 0x90 && x[1] === 36 && x[2] === 127) && m2.some((x) => x[0] === 0x90 && x[1] === 36 && x[2] === 0), `das Kamera-Pad bekommt Note 36 an (127) und bei „Kamera aus“ aus (0): ${JSON.stringify(m2.slice(-2))}`);
if (BILDER) await seite.locator("#pads").screenshot({ path: `${BILDER}/streamdeck-1440.png` });
ok(!konsole.length, `keine Fehler in der Konsole (${konsole.slice(0, 3).join(" | ")})`);
await browser.close();