After successfully opening a waveform-audio output device driver and preparing the header file, you can begin playing a sound. Windows provides the waveOutWrite and waveInAddBuffer functions for sending data blocks to a waveform audio output device.
Use the WAVEHDR structure to specify the waveform-audio data block you are sending by using the waveOutWrite or waveInAddBuffer function. This structure contains a pointer to a locked data block, the length of the data block, and some flags. After you send a data block to an output device, wait until the device driver is finished with the data block before freeing it. If you are sending multiple data blocks, monitor the completion of data blocks to know when to send additional blocks.
Note Unless the waveform audio input and output data is contained in a single data block, an application must continually supply the device driver with data blocks until recording or playback is complete.