Closing Waveform Output Devices

After waveform playback is complete, call waveOutClose to close the wave-form device. If waveOutClose is called while a waveform is playing, the close operation will fail and the function returns an error code indicating that the device was not closed. If you don't want to wait for playback to end before closing the device, call waveOutReset before closing. This terminates playback and allows the device to be closed. Be sure to clean up the preparation on all data blocks before closing the waveform output device.