Skip to content

Commit

Permalink
Yamaha XF metaevents
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Jul 5, 2021
1 parent f124d73 commit 0bd2915
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
11 changes: 8 additions & 3 deletions javascript/JZZ.js
Original file line number Diff line number Diff line change
Expand Up @@ -2315,13 +2315,18 @@
if (this.dd.charCodeAt(0) == 0x43) {
if (this.dd.charCodeAt(1) == 0x7b) {
s += '[XF:' + __hex(this.dd.charCodeAt(2)) + ']';
ss = { 0: 'Version', 1: 'Chord', 2: 'Rehearsal Mark', 3: 'Phrase Mark', 4: 'Max Phrase Mark',
5: 'Fingering Number', 12: 'Guide Track Flag', 16: 'Guitar Info', 18: 'Chord Voicing',
127: 'XG Song Data Number' }[this.dd.charCodeAt(2)];
s += ss ? ' ' + ss : '';
s += ': ';
if (this.dd.charCodeAt(2) == 0) {
s += ' Version: ' + this.dd.substr(3, 4) + ' ' + _hex(_s2a(this.dd.substr(7)));
return s + this.dd.substr(3, 4) + ' ' + _hex(_s2a(this.dd.substr(7)));
}
if (this.dd.charCodeAt(2) == 1) {
s += ' Chord: ' + this.getText();
return s + this.getText();
}
return s;
return s + _hex(_s2a(this.dd.substr(3)));
}
}
s += 'Sequencer Specific' + _smfhex(this.dd);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"grunt-contrib-jshint": "^3.0.0",
"grunt-contrib-uglify": "^5.0.1",
"midi-test": "^1.1.7",
"mocha": "^9.0.1",
"mocha": "^9.0.2",
"nyc": "^15.1.0",
"web-midi-test": "^1.1.7"
},
Expand Down
6 changes: 6 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,12 @@ describe('SMF events', function() {
assert.equal(JZZ.MIDI.smf(0x7f, '\x43\x7b\x01\x44\x23\x44\x23').toString(), 'ff7f -- [XF:01] Chord: F#?');
assert.equal(JZZ.MIDI.smf(0x7f, '\x43\x7b\x01\x00\x00\x00\x00').toString(), 'ff7f -- [XF:01] Chord: -');
});
it('smf/XF Song Data Number', function() {
assert.equal(JZZ.MIDI.smf(0x7f, '\x43\x7b\x7f\x01\x02\x03\x04\x05\x06\x07\x08\x01\x02').toString(), 'ff7f -- [XF:7f] XG Song Data Number: 01 02 03 04 05 06 07 08 01 02');
});
it('smf/XF Unknown', function() {
assert.equal(JZZ.MIDI.smf(0x7f, '\x43\x7b\x7e\x01\x02\x03').toString(), 'ff7f -- [XF:7e]: 01 02 03');
});
});

describe('SMPTE', function() {
Expand Down

0 comments on commit 0bd2915

Please sign in to comment.