You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Oof, my audio keeps getting cut off before the last second.
If I guessed correctly, player.IsPlaying() does not account for the hardware and will return false once it has emptied its internal buffer. And makes my program exit prematurely.
Apart from sleeping a duration of BufferSize, is there any way to tell if the player really finished playing?
The text was updated successfully, but these errors were encountered:
I think it would be interesting to have per-driver guesstimates about the hardware playback position. It could be interesting to figure out what AudioContext.currentTime does.
One idea, for example, is that ALSA works with periods. Say that at the moment when we just finished sending a period of audio to ALSA, and given that n periods are filled, we could make an assumption that at that time the speaker is playing sample number x. Using the samplerate we can extrapolate the sample number at later times. But keep updating the measurements.
Then if you need the hardware position of the player, just account for the player's buffer size in between.
This could later be expanded to allow other scheduling based playback.
I don't have time for it right now but I would be happy to make a POC for ALSA at some point, and maybe Windows.
I think it would be good to have a difference between player.IsPlaying() and player.HardwareIsPlaying() for different use-cases. If you call player.Play(), player.HardwareIsPlaying() will still return false for a number of milliseconds.
Oof, my audio keeps getting cut off before the last second.
If I guessed correctly,
player.IsPlaying()
does not account for the hardware and will return false once it has emptied its internal buffer. And makes my program exit prematurely.Apart from sleeping a duration of BufferSize, is there any way to tell if the player really finished playing?
The text was updated successfully, but these errors were encountered: