Using an Event Callback to Manage Buffered Playback

To use an event callback, use the CreateEvent function to retrieve the handle of an event. In a call to the midiOutOpen function, specify CALLBACK_EVENT for the dwFlags parameter. After using the midiOutPrepareHeader function but before sending MIDI events to the device, create a nonsignaled event by calling the ResetEvent function, specifying the event handle retrieved by CreateEvent. Then, inside a loop that checks whether the MHDR_DONE bit is set in the dwFlags member of the MIDIHDR structure, use the WaitForSingleObject function, specifying the event handle and a time-out value of INFINITE as parameters.

An event callback is set by anything that might cause a function callback.

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

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database