[alsa-devel] What does snd_pcm_delay() actually return?
tom at dbservice.com
Wed Jun 11 23:40:24 CEST 2008
Colin Guthrie wrote:
> AFAIK, the way Wine uses snd_pcm_delay() is to check when a sample is
> fully played. e.g. they wait for the function to return 0. I think this
> was done due to the docs specifically say that it is the "difference
> between appl_ptr and hw_ptr" so it makes sense to assume this will
> return 0 when there is nothing waiting to be played. I would strongly
> recommend that you remove the implementation detail from the (supposedly
> high level) docs.
Wine needs to know when a particular sample has been played by the
hardware. And it should be reasonably accurate as some applications may
depend on that timing. Currently Wine accounts for how many bytes it has
written into the device, and then uses 'bytes_written -
frames_to_bytes(snd_pcm_delay())' to find out which samples have been
played. AFAICS alsa has no dedicated function to find out which samples
have been played, so Wine is forced to emulate it using snd_pcm_delay().
If there is any function at all that would be more appropriate in that
situation, please tell the Wine developers.
More information about the Alsa-devel