Skip to content

Commit

Permalink
M2M1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Nov 27, 2023
1 parent 3fde7a3 commit 4277fc7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions javascript/JZZ.js
Original file line number Diff line number Diff line change
Expand Up @@ -3419,6 +3419,7 @@
_J.prototype.MIDI2 = UMP;

function _16_7(n) { return n ? (n >> 9) || 1 : 0; }
function _32_7(n) { return n ? ((n >> 25) & 127) || 1 : 0; }
function _grp(m, g) { m.gr = g; return m; }
function _m2m1(msg) {
if (msg.isMidi2) {
Expand Down Expand Up @@ -3452,6 +3453,12 @@
if (n == 8 || n == 9) {
this._emit(_grp(new MIDI([msg[1], msg[2], _16_7(msg[4] * 256 + msg[5])]), g));
}
if (n == 10) {
this._emit(_grp(new MIDI([msg[1], msg[2], _32_7(msg[4] * 0x1000000 + msg[5] * 0x10000 + msg[6] * 0x100 + msg[7])]), g));
}
if (n == 13) {
this._emit(_grp(new MIDI([msg[1], _32_7(msg[4] * 0x1000000 + msg[5] * 0x10000 + msg[6] * 0x100 + msg[7])]), g));
}
else if (n == 12) {
if (msg[3]) {
this._emit(_grp(new MIDI([0xb0 + c, 0, msg[6]]), g));
Expand Down
8 changes: 8 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,14 @@ describe('JZZ.M2M1', function() {
port.connect(function(msg) { sample.compare(msg); });
port.umpProgram(0, 1, 32).umpProgram(0, 1, 64, 1, 2);
});
it('aftertouch/pressure', function(done) {
var sample = new test.Sample(done, [
[0xa1, 60, 80], [0xa1, 60, 0], [0xd1, 80]
]);
var port = new JZZ.M2M1();
port.connect(function(msg) { sample.compare(msg); });
port.umpAftertouch(0, 1, 'C5', 0xa0000000).umpAftertouch(0, 1, 'C5', 0).umpPressure(0, 1, 0xa0000000);
});
it('sysex', function(done) {
var sample = new test.Sample(done, [
[0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7],
Expand Down

0 comments on commit 4277fc7

Please sign in to comment.