Export (0) Print
Expand All

Using an Event Callback to Process Driver Messages

To use an event callback, use the CreateEvent function to create a manual-reset event. In the call to the waveOutOpen function, specify CALLBACK_EVENT for the fdwOpen parameter. After you call the waveOutPrepareHeader function, but before sending waveform-audio data to the device, put the event into a nonsignaled state by calling the ResetEvent function. Then, inside a loop that checks whether the WHDR_DONE flag is set in the dwFlags member of the WAVEHDR structure, call the WaitForSingleObject function, specifying as parameters the event handle and a time-out value.

Because event callbacks do not receive specific close, done, or open notifications, an application might have to check the status of the process it is waiting for after the event occurs. It is possible that a number of tasks could have been completed by the time WaitForSingleObject returns.

Related topics

Audio Data Blocks

 

 

Community Additions

ADD
Show:
© 2014 Microsoft