Skip to content

Commit

Permalink
JZZ.Context - in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Jun 29, 2021
1 parent 1a48059 commit 533bea0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
17 changes: 17 additions & 0 deletions javascript/JZZ.js
Original file line number Diff line number Diff line change
Expand Up @@ -1507,6 +1507,7 @@
}
SMPTE.prototype.toString = function() { return _smptetxt([this.hour, this.minute, this.second, this.frame]); };
JZZ.SMPTE = SMPTE;
_J.prototype.SMPTE = SMPTE;

// JZZ.MIDI

Expand Down Expand Up @@ -2423,6 +2424,22 @@
};

JZZ.MIDI = MIDI;
_J.prototype.MIDI = MIDI;

Context = function() {
var self = this instanceof Context ? this : self = new Context();
if (this == self) self._resume();
return self;
};
Context.prototype = new _M();
Context.prototype.constructor = Context;
Context.prototype._receive = function(msg) { this._emit(this._read(msg)); };
Context.prototype._read = function(msg) {
if (!msg.length || msg[0] < 0x80) return msg;
return msg;
};
JZZ.Context = Context;
_J.prototype.Context = Context;

function MPE() {
var self = this instanceof MPE ? this : self = new MPE();
Expand Down
2 changes: 1 addition & 1 deletion minified/JZZ.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,13 @@ describe('JZZ.Widget', function() {
});
});

describe('JZZ.Context', function() {
it.only('reset', function() {
var ctxt = JZZ.Context();
ctxt.reset();
});
});

describe('Engine: none', function() {
it('and/or', function() { JZZ().and('').openMidiIn('Non-existing port').or(''); });
test.engine_name('none', true);
Expand Down

0 comments on commit 533bea0

Please sign in to comment.