Skip to content

Commit

Permalink
prog
Browse files Browse the repository at this point in the history
  • Loading branch information
Yisheng Jiang committed Dec 23, 2023
1 parent bc6d42d commit c6e7d5b
Show file tree
Hide file tree
Showing 2,169 changed files with 5,252 additions and 439,130 deletions.
4 changes: 2 additions & 2 deletions dist/sequence.js

Large diffs are not rendered by default.

51 changes: 27 additions & 24 deletions e2e.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {mkcanvas, chart} from "./chart/chart.js";
import { mkcanvas, chart } from "./chart/chart.js";
import { mkdiv } from "https://unpkg.com/[email protected]/mkdiv.js";
import { mkpath } from "./src/mkpath.js";
import SF2Service from "./sf2-service/index.js";
Expand All @@ -22,6 +22,7 @@ let program,

renderMain().then(() => {
if (document.hash != "") rendProgram();
rendProgram();
});

window.addEventListener("hashchange", rendProgram);
Expand All @@ -32,7 +33,7 @@ async function renderMain() {

document.body.innerHTML = "";
mkdiv("nav", [
(volMeters = mkdiv("div", {id: "volmeter", style: "min-height:2em"})),
(volMeters = mkdiv("div", { id: "volmeter", style: "min-height:2em" })),
mkdiv("div", [
mkdiv(
"button",
Expand All @@ -54,16 +55,16 @@ async function renderMain() {
]).attachTo(document.body);
const progList = mkdiv(
"ul",
{class: "notes-list"},
{ class: "notes-list" },
sf2file.programNames.map((n, presetId) =>
mkdiv(
"div",
{class: "menu-link"},
mkdiv("a", {href: `#${presetId}`}, n)
{ class: "menu-link" },
mkdiv("a", { href: `#${presetId}` }, n)
)
)
);
rightPanel = mkdiv("div", {class: "col note-viewer"}, []);
rightPanel = mkdiv("div", { class: "col note-viewer" }, []);
const leftNav = mkdiv(
"section",
{
Expand All @@ -72,14 +73,14 @@ async function renderMain() {
[
mkdiv(
"section",
{class: "sidebar-header"},
{ class: "sidebar-header" },
sf2file.url.split("/").pop()
),
mkdiv("nav", {}, progList),
]
);
const vrPanel = mkdiv("div", {class: "col"});
main = mkdiv("div", {class: "main"}, [leftNav, rightPanel, vrPanel]);
const vrPanel = mkdiv("div", { class: "col" });
main = mkdiv("div", { class: "main" }, [leftNav, rightPanel, vrPanel]);
document.body.append(main);
}

Expand All @@ -98,16 +99,18 @@ async function rendProgram() {

const kRangeList = program.zMap.map(
(z) =>
`<option value=${z.ref} ${z.ref + "" == zone?.ref ? "selected" : ""}>${z.Unused1 + "|" + z.Unused2
} ${"key " +
`<option value=${z.ref} ${z.ref + "" == zone?.ref ? "selected" : ""}>${
z.Unused1 + "|" + z.Unused2
} ${
"key " +
[z.KeyRange.lo, z.KeyRange.hi].join("-") +
" vel " +
[z.VelRange.lo, z.VelRange.hi].join("-")
}</option>`
);
const articleHeader = mkdiv(
"div",
{class: "note-header"},
{ class: "note-header" },

mkdiv(
"select",
Expand All @@ -120,7 +123,7 @@ async function rendProgram() {
kRangeList
)
);
articleMain = mkdiv("div", {class: "note-preview"}, [
articleMain = mkdiv("div", { class: "note-preview" }, [
mkdiv(
"div",
{
Expand All @@ -130,13 +133,13 @@ async function rendProgram() {
[]
),
]);
const mainRight = mkdiv("div", {class: "note"}, [
mkdiv("div", {class: "note-title"}, [sf2file.programNames[hashId]]),
const mainRight = mkdiv("div", { class: "note" }, [
mkdiv("div", { class: "note-title" }, [sf2file.programNames[hashId]]),
articleHeader,
]);
rightPanel.replaceChildren(mainRight, articleMain);

canvas = mkcanvas({container: articleHeader});
canvas = mkcanvas({ container: articleHeader });
await spinner.shipProgram(program);
if (zone) renderZ(zone);
}
Expand Down Expand Up @@ -183,15 +186,15 @@ function renderSampleView(zoneSelect) {
//drawEV(zone.arr.slice(33, 39), volEGCanvas);
function min_max_vals(k) {
if (k.includes("Sustain")) {
return {min: 0, max: 1000, step: 10};
return { min: 0, max: 1000, step: 10 };
} else
return {
min: -12000,
max: 5000,
step: 10,
};
}
function renderLPFView(zone) { }
function renderLPFView(zone) {}
function renderArticle(keyword, zone) {
let canvas;
const zoneObj = newSFZone(zone);
Expand All @@ -218,9 +221,9 @@ function renderArticle(keyword, zone) {
)
);
const details = mkdiv("div");
const article = mkdiv("article", {class: "article"}, [attrVals, details]);
const article = mkdiv("article", { class: "article" }, [attrVals, details]);
if (keyword === "VolEnv") {
canvas = mkcanvas({container: details, title: "amp eg"});
canvas = mkcanvas({ container: details, title: "amp eg" });
drawEV(zoneObj, canvas);
}
return article;
Expand All @@ -232,7 +235,7 @@ async function startSpinner() {
await audioPath.startAudio();
spinner = audioPath.spinner;

spinner.port.onmessage = ({data}) => {
spinner.port.onmessage = ({ data }) => {
if (data.currentFrame) {
volMeters.innerHTML = data.currentFrame;
}
Expand All @@ -248,11 +251,11 @@ async function rendSample(e, zoneObj) {
if (ctx.state !== "running") await ctx.resume();
if (!zoneObj) return;
if (!spinner) startSpinner();
const {arr, ref} = zoneObj;
const { arr, ref } = zoneObj;
if (zoneObj.isDirty) {
spinner.port.postMessage({
cmd: "newZone",
zone: {arr, ref},
zone: { arr, ref },
});
zoneObj.lastSync = new Date();
}
Expand All @@ -271,7 +274,7 @@ async function rendSample(e, zoneObj) {
spinner.port.postMessage([0x80, 0, 123]);
e.target.innerText = "play";
},
{once: true}
{ once: true }
);
}
const drawEV = async (zone, target) => {
Expand Down
165 changes: 0 additions & 165 deletions fontawesome/LICENSE.txt

This file was deleted.

Loading

0 comments on commit c6e7d5b

Please sign in to comment.