Skip to content

Commit

Permalink
Annotate raw clips
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Mar 22, 2024
1 parent 4004e59 commit eb2d892
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion code2/test-text-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ clip
.umpCPerformerName(6, 6, 'Performer Name per channel')
.tick(96)
.umpAccPerformerName(7, 'Accompanying Performer Name per group')
.umpCAccPerformerName(7, 7, 'AccompanyingPerformer Name per channel')
.umpCAccPerformerName(7, 7, 'Accompanying Performer Name per channel')
.tick(96)
.umpRecordingDate(8, 'Recording Date per group')
.umpCRecordingDate(8, 8, 'Recording Date per channel')
Expand Down
20 changes: 17 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,25 @@ Warn.prototype.toString = function() {
if (typeof this.data != 'undefined') a.push('(' + this.data + ')');
return a.join(' ');
};
function _tohex(x) { return (x < 16 ? '0' : '') + x.toString(16); }
function _hex(x) { return (x < 16 ? '0' : '') + x.toString(16); }

RawClip.prototype = [];
RawClip.prototype.send = function(msg) { this.push(JZZ.UMP(msg)); return this; };
RawClip.prototype.annotate = function() {};
RawClip.prototype.annotate = function() {
var i, ctxt;
ctxt = JZZ.Context();
for (i = 0; i < this.length; i++) {
if (this[i].isStartClip()) break;
if (this[i].lbl) this[i].lbl = undefined;
ctxt._read(this[i]);
}
ctxt = JZZ.Context();
for (; i < this.length; i++) {
if (this[i].lbl) this[i].lbl = undefined;
ctxt._read(this[i]);
}
return this;
};
RawClip.prototype.validate = function() {
var i;
var off = this._off || 0;
Expand Down Expand Up @@ -77,7 +91,7 @@ RawClip.prototype.load = function(s) {
len = [4, 4, 4, 8, 8, 16, 4, 4, 8, 8, 8, 12, 12, 16, 16, 16][t];
a = [];
if (s.length < off + len) {
for (i = off; i < s.length; i++) a.push(_tohex(s.charCodeAt(i)));
for (i = off; i < s.length; i++) a.push(_hex(s.charCodeAt(i)));
this._complain(off, 'Incomplete message', a.join(' '));
off += len;
break;
Expand Down
Binary file modified midi2/test-text-message.midi2
Binary file not shown.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "test-midi-files",
"version": "1.0.4",
"version": "1.0.5",
"description": "A framework for producing test MIDI files",
"main": "index.js",
"scripts": {
Expand All @@ -20,15 +20,15 @@
],
"author": "jazz-soft (https://jazz-soft.net)",
"dependencies": {
"jzz": "^1.7.9",
"jzz-gui-player": "^1.7.0",
"jzz": "^1.8.1",
"jzz-gui-player": "^1.7.2",
"jzz-midi-gear": "^1.3.2",
"jzz-midi-gm": "^1.3.5",
"jzz-midi-smf": "^1.8.6",
"jzz-midi-smf": "^1.9.0",
"jzz-synth-tiny": "^1.3.8"
},
"devDependencies": {
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"grunt": "^1.6.1",
"mocha": "^10.3.0",
"nyc": "^15.1.0"
Expand Down

0 comments on commit eb2d892

Please sign in to comment.