mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-05 20:34:27 +01:00
- firmware (editor.c): INFO tags 'D' 1 board (SMK-37 Pro / Elite, a computer, the MPC Sample, the MPC plugin) and, FELUCCA_HOST_POWER only, 'H' 2 caps slots, both before 'Y'; on the big CPUs DESC / SET / TRACK_PARAM name the values beyond EDIT by the track's engine (hp_xdesc) and send enum names by value (DRUM-X's SLOT 112..). The FM-1 binary is byte for byte as before (cmp build/felucca.bin, .fwsc), regress 0 golden changes. - ports/core: the editor's SysEx (jiant_sysex, jiant_sysex_out, jiant_editor_poll, jiant_editor_host) through the firmware's own handler; felucca_hp.wasm leaves it out. JUCE standalone: SysEx in, replies out of its MIDI output (producesMidi only for the standalone; the plugins' buses unchanged); tests/sysex_check.cpp. - web/editor.html: the device shown (tag, else port name), SMK-37 / MPC Sample port names, the structured layout for P_COUNT 123 (it showed a plain list) with a FILTER section, SAMPLE's TRIG REC, GRAIN's TRAVEL SOURCE PITCH and DRUM-X's SAMPLES pages on a device with 'H', SAMPLE sounds kept on such a device; the mock as a big CPU (?hp=1) or an SMK-37 (?board=1), its tables generated from and compared with descdump built with FELUCCA_HOST_POWER=1. - tests: editor_test with FELUCCA_HOST_POWER, core_test, test_web devices section, web/editor_browser_test.mjs. - docs: EDITOR_PROTOCOL.md "Device and big CPUs"; MPC Sample README: why its app does not answer the editor yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UVqsRpEnNJfjWWrH3C4opq
82 lines
4.2 KiB
JavaScript
82 lines
4.2 KiB
JavaScript
// SPDX-License-Identifier: GPL-3.0-only
|
|
// Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
|
|
// (SMK-37, ports/) the editor in a real browser (Playwright's Chromium) on its mock device (?mock=1: Web MIDI faked by
|
|
// the page itself):
|
|
// node web/editor_browser_test.mjs [out-dir-for-screenshots]
|
|
// An FM-1 (no 'D' / 'H' tags): "FM-1" shown, no SAMPLE / GRAIN offered, no sample pages on DRUM. An SMK-37 ('D' 1 1):
|
|
// its name. A big CPU (?hp=1: 'D' 1 3, 'H' 2 15 16): SAMPLE and GRAIN offered, their pages (SAMPLE WARP TRIG REC,
|
|
// GRAIN CLOUD TRAVEL SOURCE PITCH) and DRUM-X's SAMPLES; the FILTER section of P_COUNT 123 firmware.
|
|
import path from "path";
|
|
import { createRequire } from "module";
|
|
const require = createRequire(import.meta.url);
|
|
const { chromium } = require("playwright");
|
|
|
|
const HERE = path.dirname(new URL(import.meta.url).pathname);
|
|
const OUT = process.argv[2] || null;
|
|
const page0 = "file://" + path.join(HERE, "editor.html");
|
|
let fails = 0;
|
|
const check = (what, ok, extra = "") => { console.log(`editor (browser): ${what.padEnd(70)} ${ok ? "ok" : "FAIL"} ${extra}`); if (!ok) fails++; };
|
|
|
|
const b = await chromium.launch();
|
|
async function open(qs) {
|
|
const p = await b.newPage({ viewport: { width: 1280, height: 900 }, deviceScaleFactor: 2 });
|
|
p.on("pageerror", (e) => { console.log("pageerror:", e.message); fails++; });
|
|
await p.goto(`${page0}?mock=1${qs}`);
|
|
await p.click("#connect");
|
|
await p.waitForFunction(() => /·/.test(document.querySelector("#version").textContent), null, { timeout: 60000 });
|
|
return p;
|
|
}
|
|
const heads = (p) => p.$$eval("#groups h2, #groups h3", (a) => a.map((x) => x.textContent.replace(/[^\x20-\x7e]/g, "").trim())); /* (an icon's glyph out) */
|
|
const engines = (p) => p.$$eval("#engine option", (a) => a.map((x) => x.textContent));
|
|
/* the controls are rebuilt as the replies come: wait until the headings hold what is expected (or 20 s) */
|
|
async function settle(p, want = []) {
|
|
let last = "", same = 0;
|
|
for (let i = 0; i < 200 && same < 10; i++) {
|
|
await p.waitForTimeout(100);
|
|
const h = await heads(p), now = JSON.stringify(h);
|
|
same = now === last && want.every((x) => h.includes(x)) ? same + 1 : 0;
|
|
last = now;
|
|
}
|
|
}
|
|
async function engine(p, e, want) {
|
|
await p.selectOption("#engine", String(e));
|
|
await settle(p, want);
|
|
}
|
|
|
|
{
|
|
const p = await open("");
|
|
await settle(p, ["FILTER"]);
|
|
const h = await heads(p), en = await engines(p);
|
|
check("FM-1: its name, the structured layout (ENV .. FILTER)", (await p.textContent("#version")).startsWith("FM-1 ·") &&
|
|
h.includes("ENV") && h.includes("FILTER"));
|
|
check("FM-1: no SAMPLE / GRAIN to pick", !en.includes("SAMPLE") && !en.includes("GRAIN"));
|
|
await engine(p, 10, ["EDIT DRUM"]);
|
|
check("FM-1: DRUM without the sample pages", !(await heads(p)).includes("SAMPLES"));
|
|
await p.close();
|
|
}
|
|
{
|
|
const p = await open("&board=1&port=JIANT%20SMK-37");
|
|
check("SMK-37: shown by its tag", (await p.textContent("#version")).startsWith("SMK-37 Pro ·"));
|
|
await p.close();
|
|
}
|
|
{
|
|
const p = await open("&hp=1");
|
|
check("big CPU: shown, SAMPLE and GRAIN offered", (await p.textContent("#version")).startsWith("JIANT FM app / plugin ·") &&
|
|
(await engines(p)).slice(-2).join() === "SAMPLE,GRAIN");
|
|
for (const [e, name, want] of [[4, "sample", ["EDIT SAMPLE", "SAMPLE", "WARP", "TRIG", "REC"]],
|
|
[8, "grain", ["EDIT GRAIN", "GRAIN", "CLOUD", "TRAVEL", "SOURCE", "PITCH"]], [10, "drum", ["EDIT DRUM", "SAMPLES", "SAMPLES 2"]]]) {
|
|
await engine(p, e, want);
|
|
const h = await heads(p);
|
|
check(`big CPU: ${name.toUpperCase()}'s pages (${want.slice(1).join(" ")})`, want.every((x) => h.includes(x)), want.filter((x) => !h.includes(x)).join());
|
|
if (OUT) await p.screenshot({ path: path.join(OUT, `editor-${name}.png`), fullPage: true });
|
|
}
|
|
const labels = await p.$$eval("#groups .row", (a) => a.map((x) => x.textContent));
|
|
check("big CPU: DRUM-X's SMORPH BLEND SLOT MAP SLEVEL", ["SMORPH", "BLEND", "MAP", "SLEVEL"].every((l) => labels.some((t) => t.startsWith(l))));
|
|
await engine(p, 0, ["EDIT ANALOG"]);
|
|
check("big CPU: ANALOG without them", !(await heads(p)).some((x) => ["TRIG", "TRAVEL", "SAMPLES"].includes(x)));
|
|
await p.close();
|
|
}
|
|
await b.close();
|
|
console.log(fails ? `EDITOR BROWSER TEST FAILED (${fails})` : "editor browser test passed");
|
|
process.exit(fails ? 1 : 0);
|