Data Transfer Using Waveform Device Drivers

The following sequence of operations occurs when transferring audio data between a client application and a waveform-output device driver:

  1. The client allocates the memory for the data block.
  2. The client requests that the driver prepare the data block.
  3. The client sends the data block to the driver.
  4. The driver puts the data block in its output queue.
  5. The client can send additional data blocks, which the driver also puts in its output queue.
  6. When the driver has sent a data block from its output queue to its output device, it returns the data block to the client by sending the client a message.
  7. The client requests that the driver clean up the preparation previously done on the data block.
  8. The client then frees the memory for the data block.

In addition, the driver must transfer the data it receives from the client to the waveform hardware. This transfer takes place in the background, as an interrupt-driven process. The driver can transfer data directly, or it can use the computer's DMA controller to transfer the data. Whether you choose to transfer data directly or use DMA depends on the capabilities of your target hardware.

For input devices, the model is similar, except the client sends the driver an empty buffer. The buffer is directly filled with audio data by the driver or with DMA. The driver notifies the client when the buffer is filled.