Skip to content

stop() called too soon #362

@infojunkie

Description

@infojunkie

In this block

if (state.endedTracks === this._json.tracks.length) {
this._stop(state);
}
_stop() is called as soon as "End of Track" message is found.

However, some notes may still be scheduled for the future. This means that "All Sound Off" will be sent too early.

My solution is to maintain an additional state latest that calculates the latest scheduled event and only stops then
https://github.com/infojunkie/midi-player/blob/c351943c1da33bd818e30e67e37174bfd268f71c/src/midi-player.ts#L160-L167

Maybe there would be a way to only use the scheduled time of the "End of Track" message itself as the latest time, but I'm not sure this would be reliable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions