Closed BopItFreak closed 4 years ago
or at least, when playing that MIDI the program hangs and consumes high CPU. I can connect to the process and run synchronous commands, but anything async never completes. (I am co-reporting this issue)
It happens for me when you play a song without stopping the player first. Even though I call player.stop() the first thing when 'endOfFile' fires, it still doesn't stop and cpu usage spikes. I tried to use async to fix it but as Lamp said anything with async never completes.
So, what gives?
The bug is here: https://github.com/grimmdude/MidiPlayerJS/blob/master/src/player.js#L428
should be >=
:
endOfFile() {
if (this.isPlaying()) {
return this.totalTicks - this.tick <= 0;
}
return this.bytesProcessed() >= this.buffer.length;
}
Some midis, which are valid on other players, seem to create an Infinite loop when loading the file. one of these midis is this: https://cdn.discordapp.com/attachments/360985607209484290/477205561469829121/9934.mid
please fix this.