Skip to content

Commit

Permalink
UMP helpers -- in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Aug 20, 2023
1 parent 818527f commit a33db27
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 6 additions & 3 deletions javascript/JZZ.js
Original file line number Diff line number Diff line change
Expand Up @@ -2994,9 +2994,7 @@

var _helpersUmp = {};
function _copyHelperNN(name, func) {
UMP[name] = function() {
return new UMP(func.apply(this, arguments));
};
UMP[name] = function() { return new UMP(func.apply(this, arguments));};
_helpersUmp[name] = function() { return this.send(func.apply(this, arguments)); };
}
function _copyHelperGC(name, func) {
Expand All @@ -3013,6 +3011,11 @@
if (typeof this._gr != 'undefined') args = [this._gr].concat(args);
return new UMP(func.apply(this, args));
};
_helpersUmp[name] = function() {
var args = Array.prototype.slice.call(arguments);
if (typeof this._gr != 'undefined') args = [this._gr].concat(args);
return this.send(func.apply(this, args));
};
}
function _umpseqstat(n, i) { return n == 1 ? 0 : i == 0 ? 0x10 : i == n - 1 ? 0x30 : 0x20; }
function _sliceSX(gr, m) {
Expand Down
9 changes: 9 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,15 @@ describe('JZZ.Widget2', function() {
port2.connect(function(msg) { sample.compare(msg); });
port1.gr().gr(1).gr(1).gr().noop();
});
it('umpBPM', function(done) {
var sample = new test.Sample(done, [
[209, 16, 0, 0, 2, 250, 240, 128, 0, 0, 0, 0, 0, 0, 0, 0],
[210, 16, 0, 0, 2, 250, 240, 128, 0, 0, 0, 0, 0, 0, 0, 0]
]);
var port = JZZ.Widget2();
port.connect(function(msg) { sample.compare(msg); });
port.umpBPM(1, 120).gr(2).umpBPM(120);
});
});

describe('JZZ.Context', function() {
Expand Down

0 comments on commit a33db27

Please sign in to comment.