Skip to content

Commit c61dd8c

Browse files
committed
Release 3.1.0
1 parent d51fe1b commit c61dd8c

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

browser/midiwriter.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var MidiWriter = (function () {
66
* @return {Constants}
77
*/
88
var Constants = {
9-
VERSION: '3.0.1',
9+
VERSION: '3.1.0',
1010
HEADER_CHUNK_TYPE: [0x4d, 0x54, 0x68, 0x64],
1111
HEADER_CHUNK_LENGTH: [0x00, 0x00, 0x00, 0x06],
1212
HEADER_CHUNK_FORMAT0: [0x00, 0x00],
@@ -786,7 +786,7 @@ var MidiWriter = (function () {
786786
this.status = 0xC0;
787787
this.name = 'ProgramChangeEvent';
788788
// delta time defaults to 0.
789-
this.data = Utils.numberToVariableLength(this.delta).concat(this.status | this.channel - 1, this.instrument);
789+
this.data = Utils.numberToVariableLength(this.delta).concat(this.status | this.channel, this.instrument);
790790
}
791791
return ProgramChangeEvent;
792792
}());
@@ -1300,7 +1300,13 @@ var MidiWriter = (function () {
13001300
*/
13011301
Writer.prototype.base64 = function () {
13021302
if (typeof btoa === 'function') {
1303-
return btoa(String.fromCharCode.apply(null, this.buildFile()));
1303+
var binary = '';
1304+
var bytes = this.buildFile();
1305+
var len = bytes.byteLength;
1306+
for (var i = 0; i < len; i++) {
1307+
binary += String.fromCharCode(bytes[i]);
1308+
}
1309+
return btoa(binary);
13041310
}
13051311
return Buffer.from(this.buildFile()).toString('base64');
13061312
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "midi-writer-js",
3-
"version": "3.0.1",
3+
"version": "3.1.0",
44
"description": "A library providing an API for generating MIDI files.",
55
"main": "build/index.js",
66
"types": "types.d.ts",

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
const Constants = {
7-
VERSION : '3.0.1',
7+
VERSION : '3.1.0',
88
HEADER_CHUNK_TYPE : [0x4d, 0x54, 0x68, 0x64], // Mthd
99
HEADER_CHUNK_LENGTH : [0x00, 0x00, 0x00, 0x06], // Header size for SMF
1010
HEADER_CHUNK_FORMAT0 : [0x00, 0x00], // Midi Type 0 id

0 commit comments

Comments
 (0)