A primary responsibility of user-mode waveform and MIDI drivers is to pass streams of data between clients and kernel-mode drivers. For both input and output operations, clients first allocate data buffers and request the user-mode driver to prepare the buffers for use.
For input operations, the client passes empty buffers to the user-mode driver, which then requests data from the kernel-mode driver. The kernel-mode driver reads data from the device and passes it back the user-mode driver, which then fills the buffers. The user-mode driver notifies the client each time a buffer is filled, so that the client can copy the data from the buffer. The client can then re-use the buffer or, if all data has been received, it can request the user-mode driver to remove the buffer’s preparation, and then deallocate the buffer.
For output operations, the client fills the buffers with data and begins passing them to the user-mode driver. The user-mode driver reads the data and passes it to the kernel-mode driver, which in turn sends the data to the device. The user-mode driver notifies the client when each buffer has been read. The client can then re-use the buffer or, if all data has been sent, it can request the user-mode driver to remove the buffer’s preparation, and then deallocate the buffer. (Some MIDI output operations do not use buffers.)
For more details about transferring audio data, see:
The algorithms described in these topics are implemented in drvlib.lib and mmdrv.dll.