Re: Are DS event notifications one-to-one with buffers

From: Chris P. [MVP] (msdn_at_chrisnet.net)
Date: 11/17/04


Date: Wed, 17 Nov 2004 12:01:42 -0500

On Wed, 17 Nov 2004 08:59:02 -0500, Grant Schenck wrote:

> Hello,
>
> If I have a capture or play buffer divided into four slots and I set
> up event notification at the end of each slot am I guaranteed that DS
> will set the event on a one-to-one basis with each completed buffer?
>
> I assume if I am busy doing some processing that, for example, two
> capture buffers could be completed before I went to wait on the
> capture event?
>
> Is that correct?

Correct. Usually it occurs in the event processing code itself. E.g.
you're busy processing the buffer event and in the mean time 2 more buffer
events have gone by.
 
> Are there any scenarios where DS itself would not set the capture or
> play event?

The event will always get set, but if the event is already in a signaled
state (i.e. you're using one event for the entire buffer). If you're using
one event "per slot" then they could all be set to a signalled state
simultaneously.

> In general, do people use one event for all "slots" associated with a
> given buffer or do they use unique events for each slot?

Commonly I see one event for the entire buffer. The event is treated
simply as an interrupt, at which time you check the buffer position and
decide how much data is required in the buffer. This way if you missed
servicing, you can catch up quickly.