Skip to content

Commit

Permalink
M2M1 control()
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Nov 29, 2023
1 parent 5dc64ff commit b1416e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion javascript/JZZ.js
Original file line number Diff line number Diff line change
Expand Up @@ -3049,6 +3049,7 @@
umpRuby: function(g, t) { return _helperGCX.umpCustomText(g, 0, 1, 2, 3, t); },
umpRubyLanguage: function(g, t) { return _helperGCX.umpCustomText(g, 0, 1, 2, 4, t); }
};
var _noctrl = [0, 6, 32, 38, 98, 99, 100, 101];
var _helperGC = {
umpNoteOn: function(g, c, n, v, t, a) {
if (typeof v == 'undefined') v = 0xffff;
Expand All @@ -3066,7 +3067,7 @@
return [0x40 + _4b(g), 0xa0 + _ch(c), _7bn(n), 0, (x >> 24) & 255, (x >> 16) & 255, (x >> 8) & 255, x & 255];
},
umpControl: function(g, c, n, x) {
if ([0, 6, 32, 38, 98, 99, 100, 101].includes(n)) _throw(n);
if (_noctrl.includes(n)) _throw(n);
x = _32b(x);
return [0x40 + _4b(g), 0xb0 + _ch(c), _7b(n), 0, (x >> 24) & 255, (x >> 16) & 255, (x >> 8) & 255, x & 255];
},
Expand Down Expand Up @@ -3461,6 +3462,10 @@
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 == 11) {
if (_noctrl.includes(msg[2])) return;
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));
}
Expand Down
2 changes: 1 addition & 1 deletion minified/JZZ.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,14 @@ describe('JZZ.M2M1', function() {
port.connect(function(msg) { sample.compare(msg); });
port.umpAftertouch(0, 1, 'C5', 0xa0000000).umpAftertouch(0, 1, 'C5', 0).umpPressure(0, 1, 0xa0000000);
});
it('control', function(done) {
var sample = new test.Sample(done, [
[0xb1, 1, 80]
]);
var port = new JZZ.M2M1();
port.connect(function(msg) { sample.compare(msg); });
port.send([0x40, 0xb1, 0, 0, 20, 20, 20, 20]).umpControl(0, 1, 1, 0xa0000000).umpControl(0, 1, 1, 0xa0000000);
});
it('sysex', function(done) {
var sample = new test.Sample(done, [
[0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7],
Expand Down

0 comments on commit b1416e1

Please sign in to comment.