Skip to content

Commit

Permalink
Minor fix and test
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Mar 30, 2024
1 parent 9faace2 commit b5578c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion javascript/JZZ.midi.SMF.js
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,10 @@
a.push(JZZ.UMP(msg));
}
catch (e) {
for (i = 0; i < msg.length; i++) a.push(JZZ.UMP(msg[i]));
for (i = 0; i < msg.length; i++) {
if (!msg[i] || !msg[i].length) _error('Not a MIDI message');
a.push(JZZ.UMP(msg[i]));
}
}
return a;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"jzz-gui-player": "^1.7.2",
"jzz-midi-gm": "^1.3.6",
"jzz-synth-tiny": "^1.3.8",
"mocha": "^10.3.0",
"mocha": "^10.4.0",
"nyc": "^15.1.0",
"test-midi-files": "^1.0.5"
},
Expand Down
10 changes: 10 additions & 0 deletions test/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,16 @@ describe('SMF2', function() {
assert.equal(val[0].toString(), 'offset 40 tick 0 -- Missing series start (30366172 616f6b65 -- SysEx)');
assert.equal(val[1].toString(), 'offset 52 tick 0 -- Missing series end (30160020 2400046b -- SysEx)');
});
it('add', function() {
var clip = new JZZ.MIDI.Clip();
clip.header.add(0, JZZ.UMP.umpText(0, 'text text text'));
clip.add(0, JZZ.UMP.umpText(0, 'text text text'));
assert.throws(function() { clip.add(0); });
assert.throws(function() { clip.add(0, []); });
assert.throws(function() { clip.add(0, [[]]); });
assert.throws(function() { clip.add(0, [undefined]); });
//console.log(clip.toString());
});
it('tick', function() {
var clip = new JZZ.MIDI.Clip();
clip.tick(96).umpDelta(96).tick(96).umpEndClip();
Expand Down

0 comments on commit b5578c7

Please sign in to comment.