onEnded callback triggered when synth.pause() is called
olefrank opened this issue · comments
Calling synth.pause()
triggers onEnded
callback specified in
await synth.init({
...
options: {
onEnded: () => {
console.log("ended");
},
},
});
I would expected onEnded
callback to only be called when playback of the tune has reached the end.
IMO it would be more accurate to make additional callbacks for onPaused
, onStarted
etc.
Also, it would be helpful to have information as parameter to onEnded
callback to determine what "onEnded" means. It seems to be called on the first beat of the following bar after playback has ended. It would be nice to be able to sta
Also, It seems the onEnded
callback is triggered on the first beat of the following bar after playback has ended. That is, the bar following the last bar (AFTER playback has ended). IMO it would be more correct to trigger the onEnded
callback in the very end of the last bar.
Yeah, there does need to be some clarity on those callbacks.
For your second point, onEnded doesn't trigger until the entire last beat has finished. That is the first beat of the next bar. If you want to play something in a loop then restart it from the onEnded callback and it will be in time.