Skip to content

Commit

Permalink
M2M1 PitchBend
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Dec 20, 2023
1 parent a68e4a1 commit f075f91
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion javascript/JZZ.js
Original file line number Diff line number Diff line change
Expand Up @@ -3466,7 +3466,7 @@
function _grp(m, g) { m.gr = g; return m; }
function _m2m1(msg) {
if (msg.isMidi2) {
var n, c;
var n, c, x;
var t = msg[0] >> 4;
var g = msg[0] & 15;
if (t == 1 || t == 2) {
Expand Down Expand Up @@ -3512,6 +3512,10 @@
if (n == 13) {
this._emit(_grp(new MIDI([msg[1], _32_7(msg[4], msg[5], msg[6], msg[7])]), g));
}
if (n == 14) {
x = (msg[4] * 0x1000000 + msg[5] * 0x10000 + msg[6] * 0x100 + msg[4]) >> 18;
this._emit(_grp(new MIDI([msg[1], x & 127, (x >> 7) & 127]), g));
}
else if (n == 12) {
if (msg[3]) {
this._emit(_grp(new MIDI([0xb0 + c, 0, msg[6]]), g));
Expand Down
2 changes: 1 addition & 1 deletion minified/JZZ.js

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,15 @@ describe('JZZ.M2M1', function() {
]);
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);
port.umpAftertouch(0, 1, 'C5', 0xa0000000).umpPnPressure(0, 1, 'C5', 0).umpPressure(0, 1, 0xa0000000);
});
it('pitchBend', function(done) {
var sample = new test.Sample(done, [
[0xe1, 0, 0], [0xe1, 0, 0x40], [0xe1, 0x7f, 0x7f]
]);
var port = new JZZ.M2M1();
port.connect(function(msg) { sample.compare(msg); });
port.umpPitchBend(0, 1, 0).umpPitchBend(0, 1, 0x80000000).umpPitchBend(0, 1, 0xffffffff);
});
it('control', function(done) {
var sample = new test.Sample(done, [
Expand Down

0 comments on commit f075f91

Please sign in to comment.