Skip to content

Commit

Permalink
Running status warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Jun 2, 2024
1 parent 05a4f16 commit 6040cad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion javascript/JZZ.midi.SMF.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/* istanbul ignore next */
if (JZZ.MIDI.SMF) return;

var _ver = '1.9.2';
var _ver = '1.9.3';

var _now = JZZ.lib.now;
function _error(s) { throw new Error(s); }
Expand Down Expand Up @@ -616,6 +616,7 @@
var w = '';
var st;
var m;
var rs;
off += 8;
var offset = p + off;
while (p < s.length) {
Expand All @@ -624,6 +625,7 @@
t += m[1];
offset = p + off;
if (s.charCodeAt(p) == 0xff) {
rs = false;
st = s.substring(p, p + 2);
if (st.length < 2) {
this._complain(offset, 'Incomplete track data', 3 - st.length, t);
Expand All @@ -636,6 +638,7 @@
p += m[1];
}
else if (s.charCodeAt(p) == 0xf0 || s.charCodeAt(p) == 0xf7) {
rs = false;
st = s.substring(p, p + 1);
p += 1;
m = _validate_number(this, s.substring(p, p + 4), offset + 1, t);
Expand All @@ -644,6 +647,7 @@
p += m[1];
}
else if (s.charCodeAt(p) & 0x80) {
rs = true;
w = s.substring(p, p + 1);
p += 1;
m = _msglen(w.charCodeAt(0));
Expand All @@ -652,6 +656,8 @@
p += m;
}
else if (w.charCodeAt(0) & 0x80) { // running status
if (!rs) this._complain(offset, 'Interrupted running status', w.charCodeAt(0).toString(16), t);
rs = true;
m = _msglen(w.charCodeAt(0));
if (w.charCodeAt(0) > 0xf0) this._complain(offset, 'Unexpected MIDI message', w.charCodeAt(0).toString(16), t);
this.push(new Event(t, w, _validate_msg_data(this, s, p, m, t, offset), offset));
Expand Down
Loading

0 comments on commit 6040cad

Please sign in to comment.