Skip to content

Commit

Permalink
MIDI2 Context - text
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Mar 14, 2024
1 parent 614248c commit ff13952
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions javascript/JZZ.js
Original file line number Diff line number Diff line change
Expand Up @@ -2752,7 +2752,7 @@
tt = msg[0] >> 4;
gr = (msg[0] & 15).toString(16);
kk = gr;
if (!this._cc[kk]) this._cc[kk] = {};
if (!this._cc[kk]) this._cc[kk] = {};
if (tt == 2) {
mmm = new MIDI(msg.slice(1));
}
Expand Down Expand Up @@ -2782,7 +2782,7 @@
st = msg[1] >> 4;
ch = (msg[1] & 15).toString(16);
kk = gr + ch;
if (!this._cc[kk]) this._cc[kk] = {};
if (!this._cc[kk]) this._cc[kk] = {};
if (st == 12) {
if (msg[3] & 1) {
this._cc[kk].bm = msg[6];
Expand All @@ -2793,14 +2793,36 @@
if (JZZ.MIDI.programName) msg.label(JZZ.MIDI.programName(msg[4], msg._bm, msg._bl));
}
}
else if (tt == 13) {
st = msg[1] >> 6;
if (!(msg[1] & 0x30)) ch = (msg[1] & 15).toString(16);
kk = gr + ch;
if (!this._cc[kk]) this._cc[kk] = {};
a = msg.slice(4);
if (st == 0) {
this._cc[kk].tx = undefined;
}
else if (st == 1) {
this._cc[kk].tx = a;
}
else if (st == 2) {
if (this._cc[kk].tx) this._cc[kk].tx = this._cc[kk].tx.concat(a);
}
else if (st == 3) {
if (this._cc[kk].tx) {
a = this._cc[kk].tx.concat(a);
this._cc[kk].tx = undefined;
}
}
}
}
else mmm = msg;
if (!mmm || !mmm.length || mmm[0] < 0x80) return msg;
if (mmm[0] == 0xff) { this._clear(); return msg; }
st = mmm[0] >> 4;
ch = (mmm[0] & 15).toString(16);
kk = st == 15 ? gr : gr + ch;
if (!this._cc[kk]) this._cc[kk] = {};
if (!this._cc[kk]) this._cc[kk] = {};
if (st == 12) {
mmm._bm = this._cc[kk].bm;
mmm._bl = this._cc[kk].bl;
Expand Down

0 comments on commit ff13952

Please sign in to comment.