Skip to content

Commit

Permalink
Revamped SC with refs from DearHoney & Nuked SC.
Browse files Browse the repository at this point in the history
* The lingered peak value pool in Octavia SC now uses unsigned 16-bit values instead of unsigned 8-bit values.
* Tweaked pixel blurring and peak value falling parameters in Octavia SC to better match the references.
* Added a keep value pool in Octavia SC for the lingered peak to match the references.
* Added four overridden system reset prompts in Octavia SC for GM, GS, XG and GM2.
* Channel indexes in Octavia SC are no longer forced to be 2-digits.
* Fixed one instance of SC not considered as GS in Octavia SC.
  • Loading branch information
PoneyClairDeLune committed Jun 16, 2024
1 parent dcda33f commit ad90dc4
Showing 1 changed file with 37 additions and 8 deletions.
45 changes: 37 additions & 8 deletions src/disp/disp_sc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ let ScDisplay = class extends RootDisplay {
#tmdb = new Uint8Array(665); // Text display
#pmdb = new Uint8Array(735); // Param display
#bmdb = new Uint8Array(256); // Bitmap display
#linger = new Uint8Array(128);
#linger = new Uint16Array(128);
#keep = new Uint8Array(128);
#ch = 0;
#lastBg = 0;
#countBg = 0;
Expand All @@ -55,6 +56,22 @@ let ScDisplay = class extends RootDisplay {
upThis.#sysMsg = ` Mode 1`;
break;
};
case "gm": {
upThis.#sysMsg = `GM System On`;
break;
};
case "g2": {
upThis.#sysMsg = `GM2 System On`;
break;
};
case "gs": {
upThis.#sysMsg = `GS Reset`;
break;
};
case "xg": {
upThis.#sysMsg = `XG System On`;
break;
};
default: {
upThis.#sysMsg = `Sys:${{"?":"Init","g2":"GM2","mt32":"MT-32","ag10":"AG-10","05rw":"05R/W","k11":"GMega","krs":"KROSS 2","s90es":"S90 ES","motif":"Motif ES"}[ev.data]||ev.data.toUpperCase()}`;
};
Expand Down Expand Up @@ -97,7 +114,7 @@ let ScDisplay = class extends RootDisplay {
ctx.fillText("MIDI CH", 154, 233);
ctx.textAlign = "center";
for (let c = 1; c <= 16; c ++) {
ctx.fillText(`${c}`.padStart(2, "0"), 308 + cmpHeightX * c, 300);
ctx.fillText(`${c}`, 308 + cmpHeightX * c, 300);
};
ctx.lineWidth = 1;
ctx.strokeStyle = "#000";
Expand Down Expand Up @@ -226,7 +243,16 @@ let ScDisplay = class extends RootDisplay {
break;
};
default: {
infoTxt += upThis.device.getMode() == "gs" ? " " : "+";
switch (upThis.device.getMode()) {
case "gs":
case "sc": {
infoTxt += " ";
break;
};
default: {
infoTxt += "+";
};
};
};
};
break;
Expand Down Expand Up @@ -315,10 +341,13 @@ let ScDisplay = class extends RootDisplay {
rendPos = 0;
// Strength calculation
sum.velo.forEach(function (e, i) {
if (e >= upThis.#linger[i]) {
upThis.#linger[i] = ((e >> 4) << 4) + 15;
if (e > upThis.#linger[i] >> 8) {
upThis.#linger[i] = (((e >> 4) << 4) + 15) << 8;
upThis.#keep[i] = 56;
} else if (upThis.#keep[i] > 16) {
upThis.#keep[i] --;
} else {
let val = upThis.#linger[i] - 2;
let val = upThis.#linger[i] - (384 << rendMode);
if (val < 0) {
val = 0;
};
Expand All @@ -337,7 +366,7 @@ let ScDisplay = class extends RootDisplay {
for (let c = minCh; c <= maxCh; c ++) {
let rendPart = rendPos >> 4;
let strSmooth = sum.strength[c] >> (4 + rendMode),
lingered = upThis.#linger[c] >> (4 + rendMode);
lingered = upThis.#linger[c] >> (12 + rendMode);
if (rendMode == 2) {
let offY = 4 * (3 - rendPart);
for (let d = 3 - strSmooth; d < 4; d ++) {
Expand All @@ -363,7 +392,7 @@ let ScDisplay = class extends RootDisplay {
if (upThis.#dmdb[i] != e) {
if (upThis.useBlur) {
let diff = e - upThis.#dmdb[i],
cap = 48;
cap = 72;
if (Math.abs(diff) > cap) {
upThis.#dmdb[i] += Math.sign(diff) * cap;
} else {
Expand Down

0 comments on commit ad90dc4

Please sign in to comment.