From c1fa3bbf864b0a47dc838086d88e2e645dac0601 Mon Sep 17 00:00:00 2001 From: Yisheng Jiang Date: Tue, 21 Mar 2023 22:55:17 -0700 Subject: [PATCH] psp --- e2e.html | 9 ++++- e2e.js | 78 ++++++++++++++++++--------------------- index.html | 17 +++++++-- sf2-service | 2 +- src/createChannel.js | 18 +++++++-- src/index.js | 85 ++++++++++++++++++++++++++++++++++--------- src/keyboard/like.jsx | 2 +- src/ui.js | 4 +- style.css | 8 ++++ 9 files changed, 149 insertions(+), 74 deletions(-) diff --git a/e2e.html b/e2e.html index 7171dd23..b42f9f1f 100644 --- a/e2e.html +++ b/e2e.html @@ -5,7 +5,14 @@ Document - + diff --git a/e2e.js b/e2e.js index cc10349c..fd4b9a91 100644 --- a/e2e.js +++ b/e2e.js @@ -1,7 +1,7 @@ import { mkcanvas, chart } from "https://unpkg.com/mk-60fps@1.1.0/chart.js"; import { mkdiv } from "https://unpkg.com/mkdiv@3.1.0/mkdiv.js"; import { SpinNode } from "./spin/spin.js"; -import mkpath from "./src/path.js"; +import { mkpath } from "./src/path.js"; import SF2Service from "./sf2-service/index.js"; const sf2url = "file.sf2"; @@ -12,26 +12,6 @@ let program, spinner, zref, presetId; renderMain(); window.addEventListener("hashchange", renderMain); - -window.addEventListener("click", start, { once: true }); - -async function start() { - const ctx = new AudioContext(); - if (ctx.state == "suspended") { - await ctx.resume(); - } - spinner = (await mkpath(ctx)).spinner; - spinner.shipProgram(program, presetId); - const zones = p.filterKV(key, vel).filter((z) => z.SampleId !== 0); - let i = 0; - while (zones.length) { - spinner.keyOn(0, zones.shift(), i + 50, i + 30); - spinner.KeyOff(9, i + 50, i + 70); - console.log(zones.length); - i++; - } -} - async function renderMain() { await loadWait; document.body.innerHTML = ""; @@ -64,17 +44,18 @@ async function renderMain() { mkdiv("div", { class: "col note-viewer" }), ]; const main = mkdiv("div", { class: "main" }, [leftNav, rightPanel]); - document.location.hash.substring(1).split("|"); + const presetId = document.location.hash.substring(1).split("|"); const intpre = parseInt(presetId); const pid = intpre; const bid = 0; program = sf2file.loadProgram(pid, bid); - if (!zref) zref = program.filterKV(55, 55)[0].zref; + console.log(program.zMap); + if (!zref) zref = program.filterKV(55, 55)[0]?.zref; const kRangeList = program.zMap.map( (z) => `