Skip to content

Commit

Permalink
Release 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmdude committed Sep 27, 2023
1 parent d51fe1b commit c61dd8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions browser/midiwriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var MidiWriter = (function () {
* @return {Constants}
*/
var Constants = {
VERSION: '3.0.1',
VERSION: '3.1.0',
HEADER_CHUNK_TYPE: [0x4d, 0x54, 0x68, 0x64],
HEADER_CHUNK_LENGTH: [0x00, 0x00, 0x00, 0x06],
HEADER_CHUNK_FORMAT0: [0x00, 0x00],
Expand Down Expand Up @@ -786,7 +786,7 @@ var MidiWriter = (function () {
this.status = 0xC0;
this.name = 'ProgramChangeEvent';
// delta time defaults to 0.
this.data = Utils.numberToVariableLength(this.delta).concat(this.status | this.channel - 1, this.instrument);
this.data = Utils.numberToVariableLength(this.delta).concat(this.status | this.channel, this.instrument);
}
return ProgramChangeEvent;
}());
Expand Down Expand Up @@ -1300,7 +1300,13 @@ var MidiWriter = (function () {
*/
Writer.prototype.base64 = function () {
if (typeof btoa === 'function') {
return btoa(String.fromCharCode.apply(null, this.buildFile()));
var binary = '';
var bytes = this.buildFile();
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return btoa(binary);
}
return Buffer.from(this.buildFile()).toString('base64');
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "midi-writer-js",
"version": "3.0.1",
"version": "3.1.0",
"description": "A library providing an API for generating MIDI files.",
"main": "build/index.js",
"types": "types.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

const Constants = {
VERSION : '3.0.1',
VERSION : '3.1.0',
HEADER_CHUNK_TYPE : [0x4d, 0x54, 0x68, 0x64], // Mthd
HEADER_CHUNK_LENGTH : [0x00, 0x00, 0x00, 0x06], // Header size for SMF
HEADER_CHUNK_FORMAT0 : [0x00, 0x00], // Midi Type 0 id
Expand Down

0 comments on commit c61dd8c

Please sign in to comment.