VOID
CWavehdrQueue::RemoveCompleteBlocks(void)
{
PWAVEHDR pwh;
while (m_pHead != NULL && IS_BUFFER_DONE(m_pHead))
{
ASSERT(m_pHead != m_pCurrent); // By definition, the current block is not complete.
pwh = m_pHead;
m_pHead = pwh->lpNext;
if (m_pHead == NULL)
{
// keep m_pTail consistent.
m_pTail = NULL;
}
pwh->lpNext = NULL;
MARK_BUFFER_DEQUEUED(pwh);
//
// Make the callback function call to the Wave API Manager
//
// call back into the waveform API manager, which takes care of marshalling the callback
// to the application.
// Note that the application callback could conceivably trigger events
// that would lead to the stream being closed before the callback returns
// In that case, the driver must close gracefully and defer
// the deletion of the underlying objects until after the callback
// has returned.
// This is accomplished in the stream context interrupt handler with
// reference counting.
m_pfnCallback(m_hWave, m_uMsg, m_dwInstance, (DWORD) pwh, 0); //调用
count--;//cren
RETAILMSG(ZONE_CALLBACK, (TEXT("HDRQ: Sending callback hwav=%08x inst=%08x pwh=%08x, %d \r\n"), m_hWave, m_dwInstance, pwh, count));
}
}