Closed yukulele closed 8 years ago
@yukulele thanks for reviewing but why not simply make a PR ?
I'm not sure between
MIDIFileHeader.prototype.setFormat=function(format) {
if(0!==format&&1!==format&&2!==format) {
throw new Error('Invalid MIDI format given ('+format+'),'
+' format can be 0, 1 or 2 only.');
}
return format;
};
and
MIDIFileHeader.prototype.setFormat=function(format) {
if(format == null)
format=this.datas.getUint16(8);
if(0!==format&&1!==format&&2!==format) {
throw new Error('Invalid MIDI format given ('+format+'),'
+' format can be 0, 1 or 2 only.');
}
return format;
};
Looks like there is a mistake in the original code since its purpose is to set the format and not to read it:
MIDIFileHeader.prototype.setFormat=function(format) {
if(0!==format&&1!==format&&2!==format) {
throw new Error('Invalid MIDI format given ('+format+'),'
+' format can be 0, 1 or 2 only.');
}
this.datas.setUint16(8, format);
};
Feel free to PR this, otherwise i'll try to find some time to do this.
done
variable
format
declared twice on https://github.com/nfroidure/MIDIFile/blob/master/src/MIDIFileHeader.js#L52-L53