4 Apr
2013
4 Apr
'13
8:08 p.m.
Gabriel M. Beddingfield wrote:
So, if the hardware can detect it then the hardware needs to signal an interrupt for the XRUN.
The hardware typically doesn't know the application pointer.
Another option... from userspace you can call SYNC_PTR (e.g. pcm_get_htimestamp() in tinyalsa) to update the hw and application pointers, then inspect them to detect when all the data is transferred. When you see all is played, immediately stop the stream.
ALSA checks for xruns before returning the pointer. It's enough to just ask for the pointer (or the state).
Regards, Clemens