Skip to content

Commit

Permalink
EFX! At least with basic support...
Browse files Browse the repository at this point in the history
  • Loading branch information
PoneyClairDeLune committed Aug 31, 2023
1 parent 5599b63 commit 59862ea
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 73 deletions.
68 changes: 34 additions & 34 deletions data/misc/efxId.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ MSB LSB Name
06 00 XG Delay LR
07 00 XG Echo
08 00 XG Cross Delay
09 00 XG Early Reflection 1
09 01 XG Early Reflection 2
09 00 XG Early Reflect 1
09 01 XG Early Reflect 2
0a 00 XG Gate
0b 00 XG Reverse Gate
10 00 XG White Room
Expand Down Expand Up @@ -60,25 +60,25 @@ MSB LSB Name
21 51 GS Mod Delay
21 52 GS 3-tap Delay
21 53 GS 4-tap Delay
21 54 GS Tremelo Control Delay
21 54 GS Tremelo C Delay
21 55 GS Reverb
21 56 GS Gate
21 57 GS 3D Delay
21 60 GS 2 Pitch Shifter
21 61 GS Feedback Pitch Shifter
21 61 GS Feedback P Shift
21 70 GS 3D Auto
21 71 GS 3D Manual
21 72 GS Lo-Fi
21 73 GS Lo-Fi 2
22 00 GS Overdrive+Chorus
22 01 GS Overdrive+Flanger
22 02 GS Overdrive+Delay
22 03 GS Distortion+Chorus
22 04 GS Distortion+Flanger
22 05 GS Distortion+Delay
22 06 GS Enhancer+Chorus
22 07 GS Enhancer+Flanger
22 08 GS Enhancer+Delay
22 00 GS OvrDrv+Chorus
22 01 GS OvrDrv+Flanger
22 02 GS OvrDrv+Delay
22 03 GS Distort+Chorus
22 04 GS Distort+Flanger
22 05 GS Distort+Delay
22 06 GS Enhance+Chorus
22 07 GS Enhance+Flanger
22 08 GS Enhance+Delay
22 09 GS Chorus+Delay
22 0a GS Flanger+Delay
22 0b GS Chorus+Flanger
Expand All @@ -87,8 +87,8 @@ MSB LSB Name
24 00 GS Guitar Multi
24 01 GS Guitar Multi 2
24 02 GS Guitar Multi 3
24 03 GS Clean Guitar Multi
24 04 GS Clean Guitar Multi 2
24 03 GS Cln Gtr Multi
24 04 GS Cln Gtr Multi 2
24 05 GS Bass Multi
24 06 GS Rhodes Multi
25 00 GS Keyboard Multi
Expand All @@ -107,7 +107,7 @@ MSB LSB Name
28 14 GS Feedback Chorus
28 15 GS Flanger
28 16 GS Short Delay
28 17 GS Feedback Short Delay
28 17 GS Feedback S Delay
28 20 GS Delay 1
28 21 GS Delay 2
28 22 GS Delay 3
Expand All @@ -128,9 +128,9 @@ MSB LSB Name
2c 07 AI Wet Plate
2c 08 AI Dry Plate
2c 09 AI Spring
2c 0a AI Early Reflection 1
2c 0b AI Early Reflection 2
2c 0c AI Early Reflection 3
2c 0a AI Early Reflect 1
2c 0b AI Early Reflect 2
2c 0c AI Early Reflect 3
2c 0d AI Stereo Delay
2c 0e AI Cross Delay
2c 0f AI Dual Delay
Expand Down Expand Up @@ -172,7 +172,7 @@ MSB LSB Name
31 03 GS Double Overdrive
31 04 GS Overdrive/Rotary
31 05 GS Overdrive/Phaser
31 06 GS Overdrive/Auto Wah
31 06 GS OvrDrv/Auto Wah
31 07 GS Phaser/Rotary
31 08 GS Phaser/Auto Wah
40 00 XG Through
Expand All @@ -195,25 +195,25 @@ MSB LSB Name
43 08 XG Flanger 3
44 00 XG Symphonic
45 00 XG Rotary
45 01 XG Distortion+Rotary
45 01 XG Distort+Rotary
45 02 XG Overdrive+Rotary
45 03 XG Amp Sim+Rotary
46 00 XG Tremelo
47 00 XG Auto Pan
48 00 XG Phaser 1
48 08 XG Phaser 2
49 00 XG Distortion
49 01 XG Compressor+Distortion
49 08 XG Stereo Distortion
49 01 XG Compress+Distort
49 08 XG Stereo Distort
4a 00 XG Overdrive
4a 08 XG Stereo Overdrive
4b 00 XG Amp Simulator
4b 08 XG Stereo Amp Sim
4c 00 XG 3-band EQ
4d 00 XG 2-band EQ
4e 00 XG Auto Wah
4e 01 XG Auto Wah+Distortion
4e 02 XG Auto Wah+Overdrive
4e 01 XG Auto Wah+Dist
4e 02 XG Auto Wah+OvrDrv
50 00 XG Pitch Shifter
50 01 XG Pitch Shifter 2
51 00 XG Enhancer
Expand All @@ -225,22 +225,22 @@ MSB LSB Name
54 00 XG Noise Gate
55 00 XG Voice Cancel
56 00 XG 2-way Rotary
56 01 XG 2-way Rotary+Distortion
56 02 XG 2-way Rotary+Overdrive
56 03 XG 2-way Rotary+Amp Sim
56 01 XG 2-way Rot+Dist
56 02 XG 2-way Rot+OvrDrv
56 03 XG 2-way Rot+Amp
57 00 XG Ensemble Detune
58 00 XG Ambience
5d 00 XG Talking Mod
5e 00 XG Lo-Fi
5f 00 XG Delay+Distortion
5f 01 XG Delay+Overdrive
60 00 XG Comp+Dist+Delay
60 01 XG Comp+OvrDrv+Delay
60 01 XG Comp+Ovdr+Dly
61 00 XG Wah+Dist+Delay
61 01 XG Wah+OvrDrv+Delay
62 00 XG Vintage Hard Dist
62 01 XG Vintage Hard Dist+Delay
62 02 XG Vintage Soft Dist
62 03 XG Vintage Soft Dist+Delay
61 01 XG Wah+Ovdr+Delay
62 00 XG Vin Hard Dist
62 01 XG Vin Hard Dst+Dly
62 02 XG Vin Soft Dist
62 03 XG Vin Soft Dst+Dly
63 00 XG Dual Rotary 1
63 01 XG Dual Rotary 2
37 changes: 15 additions & 22 deletions src/basic/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ let RootDisplay = class extends CustomEventSource {
getMapped(id) {};
getEfx([msb, lsb]) {
let id = (msb << 8) | lsb;
return upThis.#efxList[id] || `0x${id.toString(16).padStart(4, "0")}`;
return this.#efxList[id] || `0x${id.toString(16).padStart(4, "0")}`;
};
get noteProgress() {
return this.#noteTime / this.#noteBInt;
Expand Down Expand Up @@ -277,27 +277,20 @@ let RootDisplay = class extends CustomEventSource {
(upThis.#metaRun[e.meta] || console.debug).call(upThis, e.meta, e.data);
});
});
upThis.device.addEventListener("mode", function (ev) {
upThis.dispatchEvent("mode", ev.data);
});
upThis.device.addEventListener("mastervolume", function (ev) {
upThis.dispatchEvent("mastervolume", ev.data);
});
upThis.device.addEventListener("channelactive", function (ev) {
upThis.dispatchEvent("channelactive", ev.data);
});
upThis.device.addEventListener("channelmin", function (ev) {
upThis.dispatchEvent("channelmin", ev.data);
});
upThis.device.addEventListener("channelmax", function (ev) {
upThis.dispatchEvent("channelmax", ev.data);
});
upThis.device.addEventListener("channelreset", function (ev) {
upThis.dispatchEvent("channelreset");
});
upThis.device.addEventListener("screen", function (ev) {
upThis.dispatchEvent("screen", ev.data);
});
eventPassThru(upThis.device, upThis, "mode");
eventPassThru(upThis.device, upThis, "mastervolume");
eventPassThru(upThis.device, upThis, "channelactive");
eventPassThru(upThis.device, upThis, "channelmin");
eventPassThru(upThis.device, upThis, "channelmax");
eventPassThru(upThis.device, upThis, "channelreset");
eventPassThru(upThis.device, upThis, "screen");
eventPassThru(upThis.device, upThis, "efxreverb");
eventPassThru(upThis.device, upThis, "efxchorus");
eventPassThru(upThis.device, upThis, "efxdelay");
eventPassThru(upThis.device, upThis, "efxinsert0");
eventPassThru(upThis.device, upThis, "efxinsert1");
eventPassThru(upThis.device, upThis, "efxinsert2");
eventPassThru(upThis.device, upThis, "efxinsert3");
upThis.#metaRun[3] = function (type, data) {
if (upThis.#titleName?.length < 1) {
upThis.#titleName = data;
Expand Down
33 changes: 21 additions & 12 deletions src/cambiare/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ let Cambiare = class extends RootDisplay {
upThis.#sectInfo.tempo = createElement("span", ["field"], {t: 1, l: 454, w: 64, h: 33, a: "right"});
upThis.#sectInfo.volume = createElement("span", ["field"], {t: 1, l: 562, w: 63, h: 33, a: "right"});
upThis.#sectInfo.mode = createElement("span", ["field"], {t: 1, l: 708, w: 152, h: 33});
upThis.#sectInfo.reverb = createElement("span", ["field"], {t: 1, l: 1000, w: 188, h: 33});
upThis.#sectInfo.chorus = createElement("span", ["field"], {t: 1, l: 1238, w: 188, h: 33});
upThis.#sectInfo.delay = createElement("span", ["field"], {t: 1, l: 1471, w: 188, h: 33});
upThis.#sectInfo.insert = createElement("span", ["field"], {t: 1, l: 1701, w: 188, h: 33});
upThis.#sectInfo.reverb = createElement("span", ["field"], {t: 1, l: 1000, w: 190, h: 33});
upThis.#sectInfo.chorus = createElement("span", ["field"], {t: 1, l: 1240, w: 190, h: 33});
upThis.#sectInfo.delay = createElement("span", ["field"], {t: 1, l: 1475, w: 190, h: 33});
upThis.#sectInfo.insert = createElement("span", ["field"], {t: 1, l: 1706, w: 190, h: 33});
upThis.#sectInfo.title = createElement("span", ["field"], {t: 34, l: 50, w: 810, h: 33})
canvasElement.appendChild(upThis.#sectInfo.root);
mountElement(upThis.#sectInfo.root, [
Expand All @@ -143,11 +143,11 @@ let Cambiare = class extends RootDisplay {
upThis.#sectInfo.mode,
createElement("span", ["field", "field-key"], {t: 1, l: 960, w: 34, h: 33, i: "Rev"}),
upThis.#sectInfo.reverb,
createElement("span", ["field", "field-key"], {t: 1, l: 1196, w: 36, h: 33, i: "Cho"}),
createElement("span", ["field", "field-key"], {t: 1, l: 1198, w: 36, h: 33, i: "Cho"}),
upThis.#sectInfo.chorus,
createElement("span", ["field", "field-key"], {t: 1, l: 1434, w: 31, h: 33, i: "Var"}),
createElement("span", ["field", "field-key"], {t: 1, l: 1438, w: 31, h: 33, i: "Var"}),
upThis.#sectInfo.delay,
createElement("span", ["field", "field-key"], {t: 1, l: 1668, w: 27, h: 33, i: "Ins"}),
createElement("span", ["field", "field-key"], {t: 1, l: 1674, w: 27, h: 33, i: "Ins"}),
upThis.#sectInfo.insert,
createElement("span", ["field", "field-key"], {t: 34, l: 0, w: 44, h: 33, i: "Title"}),
upThis.#sectInfo.title
Expand All @@ -170,15 +170,27 @@ let Cambiare = class extends RootDisplay {
upThis.#sectInfo.volume.innerText = `${Math.floor(cramVolume)}.${`${Math.floor((cramVolume % 1) * 100)}`.padStart(2, "0")}`;
});
upThis.addEventListener("tempo", (ev) => {
let cramTempo = Math.round(ev.data * 100) / 100;
upThis.#sectInfo.tempo.innerText = `${Math.floor(cramTempo)}.${`${(cramTempo % 1) * 100}`.padStart(2, "0")}`;
let cramTempo = Math.round(ev.data * 100);
upThis.#sectInfo.tempo.innerText = `${Math.floor(cramTempo / 100)}.${`${Math.floor(cramTempo % 100)}`.padStart(2, "0")}`;
});
upThis.addEventListener("tsig", (ev) => {
[upThis.#sectInfo.sigN.innerText, upThis.#sectInfo.sigD.innerText] = ev.data;
});
upThis.addEventListener("title", (ev) => {
upThis.#sectInfo.title.innerText = ev.data || `No Title`;
});
upThis.addEventListener("efxreverb", (ev) => {
upThis.#sectInfo.reverb.innerText = upThis.getEfx(ev.data);
});
upThis.addEventListener("efxchorus", (ev) => {
upThis.#sectInfo.chorus.innerText = upThis.getEfx(ev.data);
});
upThis.addEventListener("efxdelay", (ev) => {
upThis.#sectInfo.delay.innerText = upThis.getEfx(ev.data);
});
upThis.addEventListener("efxinsert0", (ev) => {
upThis.#sectInfo.insert.innerText = upThis.getEfx(ev.data);
});
upThis.dispatchEvent("mode", "?");
upThis.dispatchEvent("mastervolume", 100);
upThis.dispatchEvent("tempo", 120);
Expand All @@ -188,9 +200,6 @@ let Cambiare = class extends RootDisplay {
upThis.dispatchEvent(`efxchorus`, upThis.device.getEffectType(1));
upThis.dispatchEvent(`efxdelay`, upThis.device.getEffectType(2));
upThis.dispatchEvent(`efxinsert0`, upThis.device.getEffectType(3));
upThis.dispatchEvent(`efxinsert1`, upThis.device.getEffectType(4));
upThis.dispatchEvent(`efxinsert2`, upThis.device.getEffectType(5));
upThis.dispatchEvent(`efxinsert3`, upThis.device.getEffectType(6));
};
detach(attachElement) {
let upThis = this;
Expand Down
7 changes: 4 additions & 3 deletions src/cambiare_demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ self.gPort = async function (port) {
};
self.gDemo = async function ({file, id}) {
await audioFilePlayer.pause();
let midiBlob = await(await getBlobFrom(`${file}.mid`)).blob(),
audioBlob = await(await getBlobFrom(`${file}.opus`)).blob();
visualizer.reset();
await visualizer.loadFile(await midiBlob);
if (audioUri) {
URL.revokeObjectURL(audioUri);
};
audioFilePlayer.src = "";
let midiBlob = await(await getBlobFrom(`${file}.mid`)).blob(),
audioBlob = await(await getBlobFrom(`${file}.opus`)).blob();
await visualizer.loadFile(await midiBlob);
audioUri = URL.createObjectURL(audioBlob);
audioFilePlayer.currentTime = 0;
audioFilePlayer.src = audioUri;
Expand Down
9 changes: 8 additions & 1 deletion src/state/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,13 @@ let OctaviaDevice = class extends CustomEventSource {
// NRPN drum section reset
};
upThis.dispatchEvent("mastervolume", upThis.#masterVol);
upThis.dispatchEvent(`efxreverb`, upThis.getEffectType(0));
upThis.dispatchEvent(`efxchorus`, upThis.getEffectType(1));
upThis.dispatchEvent(`efxdelay`, upThis.getEffectType(2));
upThis.dispatchEvent(`efxinsert0`, upThis.getEffectType(3));
upThis.dispatchEvent(`efxinsert1`, upThis.getEffectType(4));
upThis.dispatchEvent(`efxinsert2`, upThis.getEffectType(5));
upThis.dispatchEvent(`efxinsert3`, upThis.getEffectType(6));
return;
};
switchMode(mode, forced = false) {
Expand Down Expand Up @@ -1880,7 +1887,7 @@ let OctaviaDevice = class extends CustomEventSource {
}, (e) => {
upThis.setEffectTypeRaw(2, true, e);
console.debug(`${dPref}sub type: ${e + 1}`);
upThis.dispatchEvent("efxdelay", upThis.getEffectType(0));
upThis.dispatchEvent("efxdelay", upThis.getEffectType(2));
}][msg[0] - 64 + i] || function () {
//console.warn(`Unknown XG variation address: ${msg[0]}.`);
})(e);
Expand Down
2 changes: 1 addition & 1 deletion test/cambiare.htm
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@
<div class="column"></div>
</div>
</div>
<div class="cambiare"></div>
<div class="cambiare" lang="ja"></div>
</body>

0 comments on commit 59862ea

Please sign in to comment.