sinshu / meltysynth

A SoundFont MIDI synthesizer for .NET
Other
130 stars 15 forks source link

Unable to tell when a midi has finished #13

Closed Emersont1 closed 2 years ago

Emersont1 commented 2 years ago

When a file is not looping, Is there a way to tell when the media has finished playing? I've been looking at the examples, and there appears to be no difference in output in the Render function when the midi has finished playing, is there a way I can check that a midi has finished playing?

sinshu commented 2 years ago

Currently, there is not a direct way to tell when the media has finished playing. But it can be done by comparing the length of the MIDI file to the number of samples written.

I think something like MidiFileSequencer.EndOfSequence should be added.

sinshu commented 2 years ago

I added MidiFileSequencer.EndOfSequence. Check this flag to see if the sequencer is still playing. A new nuget package with this update is available.