(From msdn)
This function enables a given waveform audio output device for playback.
(The waveoutopen function opens the given waveform-audio output device for playback)
The prototype is as follows:
Mmresult waveoutopen (
Lphwaveout phwo,
Uint_ptr udeviceid,
Lpwaveformatex pwfx,
Dword_ptr dwcallback,
Dword_ptr dwcallbackinstance,
DWORD fdwopen
);
Parameter introduction (paramters ):
Phwo
A buffer pointing to the handle of the receiving waveform audio output device. Identify
Device when calling other waveform device output device. If fdwopen is set to wave_format_quer
Y, so this parameter may be null.
Udevideid
The ID of the waveform audio output device to be opened. It can be either a device ID or
It is the handle of an opened waveform audio input device. You can use the following values for replacement:
Value Meaning
Wave_mapper this function selects a waveform audio output device that can play a given format.
Pwfx is a pointer to the waveformatex structure that distinguishes the audio data format that will be sent to the device. You can free this structure when you pass it to the waveoutopen function;
Dwcallback
It points to a specific callback function, event handle, window handle, or
The ID of the called thread during audio playback to process the message related to the playback progress.
Back function, which can be set to 0. For more information, see waveoutproc.
Dwcallbackinstance
User instance data passed to the callback process. This parameter is not required for the window callback process (set to 0)
Fwopen
Flags are defined as follows:
Value Meaning
The callback_event dwcallback parameter column is the event handle.
The callback_function dwcallback parameter column is the address of the callback process.
The default callback_null setting means no callback process.
The callback_thread dwcallback parameter column is the thread ID.
Callback_window dwcallback parameter column is the window handle
Wave_allowsync
Enabled. If this option is not used when a synchronous driver is turned on, the device will fail to be turned on.
If this option is set for wave_format_direct, the ACM driver
Does not perform conversions on the audio data.
If this option is set for wave_format_query, query the waveoutopen.
Ask the device to determine whether the given format is supported, but the device is not actually turned on.
Wave_mapped indicates the udeviceid parameter after this parameter is set.
A waveform device mapped by a sonic ing device.
Return Value:
If the call succeeds, mmsyserr_noerror is returned. Otherwise, the following values are returned:
Value description
Mmsyserr_allocated indicates that the resource already exists.
Mmsyserr_baddeviceid device ID out of range
No driver for mmsyserr_nodriver
Mmsyserr_nomem cannot be allocated memory
Waverr_badformat attempts to open an unsupported format
The waverr_sync device can be synchronized, but the waveoutopen
There is no call to wave_allowsync.
Note:
Use waveoutgetnumdevs
Function to measure the number of output devices in the current system. If the udeviceic parameter is a device ID,
It indicates the number from 0 to the total number, and the waave_mapper constant can also be used as the device ID.
The structure referred to by pwfc can be extended to include special information of certain data formats, such
For PCM data, an additional unit
Indicates the number of sampling bits. In this case, the pcmwaveforamt structure is used. For other
Format, and the extra data length is expressed by the waveformatex structure.
If you use a window or thread to receive callback information
Will be sent to the window processing function to indicate the waveform audio output process: mm_wom_open
, Mm_wom_close, and mm_wom_done,
If you use a function to receive callback information, the following information will be transmitted:
To display the waveform audio output process in the function: wom_open, wom_close, wom_done.
Requirements:
Windows NT/2000/XP: supported ded in Windows NT 3.1 and later.
Windows 95/98/me: supported ded in Windows 95 and later.
Header: declared in mmsystem. h; Include windows. h.
Library: Use winmm. Lib.