The waveOutOpen function opens the given waveform-audio output device for playback.
MMRESULT waveOutOpen(
LPHWAVEOUT phwo,
UINT uDeviceID,
LPWAVEFORMATEX pwfx,
DWORD dwCallback,
DWORD dwCallbackInstance,
DWORD fdwOpen
);
Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
Value | Description | |
---|---|---|
MMSYSERR_ALLOCATED | Specified resource is already allocated. | |
MMSYSERR_BADDEVICEID | Specified device identifier is out of range. | |
MMSYSERR_NODRIVER | No device driver is present. | |
MMSYSERR_NOMEM | Unable to allocate or lock memory. | |
WAVERR_BADFORMAT | Attempted to open with an unsupported waveform-audio format. | |
WAVERR_SYNC | The device is synchronous but waveOutOpen was called without using the WAVE_ALLOWSYNC flag. |
Use the waveOutGetNumDevs function to determine the number of waveform-audio output devices present in the system. If the value specified by the uDeviceID parameter is a device identifier, it can vary from zero to one less than the number of devices present. The WAVE_MAPPER constant can also be used as a device identifier.
The structure pointed to by pwfx can be extended to include type-specific information for certain data formats. For example, for PCM data, an extra UINT is added to specify the number of bits per sample. Use the PCMWAVEFORMAT structure in this case. For all other waveform-audio formats, use the WAVEFORMATEX structure to specify the length of the additional data.
If you choose to have a window or thread receive callback information, the following messages are sent to the window procedure function to indicate the progress of waveform-audio output: MM_WOM_OPEN, MM_WOM_CLOSE, and MM_WOM_DONE.
If you choose to have a function receive callback information, the following messages are sent to the function to indicate the progress of waveform-audio output: WOM_OPEN, WOM_CLOSE, and WOM_DONE.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 2.0 or later.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
Waveform Audio Overview, Waveform Functions, WAVEFORMATEX, waveOutGetNumDevs, waveOutProc, PCMWAVEFORMAT, MM_WOM_OPEN, MM_WOM_CLOSE, MM_WOM_DONE