>Ok. Sorry to be so pedantic, it must be some small small error, but...
>
>1.  what does snd_pcm_avail_update() do and what does its return value mean?

it checks on the h/w pointer to discover how much data/space is
actually available. it returns the space (in units of frames). if
there has been an xrun, it returns -EPIPE.

>1b. why does the value of 'avail' returned by snd_pcm_mmap_begin differ from
>    avail_update's value?

IIRC, it reflects issues to do with the layout of the h/w buffer. the
results from mmap_begin() reflect the amount you can touch in one single
contiguous operation (e.g. memcpy). keep in mind that the h/w buffer
is a ring buffer, and the space available may actually be split across
the buffer boundary. if you look at the audioengine code again, you'll
see how i use this. we invoke the engine's clients to process each
contiguous block.

>1c. what good does calling avail_update do?

its the only reliable (and cheap) way to find out the status when you
wake up from poll/select. consider what would happen if for whatever
reason, the kernel failed to schedule your thread when the last h/w
interrupt made your thread ready to run again. you still wake up, but
its after two interrupts (hopefully), and so the amount of data is
larger than you may be expecting. avail_update() tells you of this
situation.

>The following output prompted these questions. The loop is still not blocking
>btw.

lets see the code.

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to