Compartir a través de


mixerOpen

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function opens a specified mixer device and ensures that the device will not be removed until the application closes the handle.

Syntax

MMRESULT mixerOpen(
  LPHMIXER phmx, 
  UINT uMxId, 
  DWORD dwCallback, 
  DWORD dwInstance, 
  DWORD fdwOpen 
);

Parameters

  • phmx
    Pointer to a variable that will receive a handle identifying the opened mixer device. Use this handle to identify the device when calling other audio mixer functions.

    This parameter cannot be NULL.

  • uMxId
    Identifier of the mixer device to open. Use a valid device identifier or any HMIXEROBJ (see the mixerGetID function for a description of mixer object handles).

    A mapper for audio mixer devices does not currently exist, so a mixer device identifier of – 1 is not valid.

  • dwCallback
    Handle to a window called when the state of an audio line and/or control associated with the device being opened is changed.

    Specify zero for this parameter if no callback mechanism is to be used.

  • dwInstance
    User instance data passed to the callback function.

    This parameter is not used with window callback functions.

  • fdwOpen
    Flags for opening the device.

    The following table shows the possible flags.

    Flag Description

    CALLBACK_WINDOW

    The dwCallback parameter is assumed to be a window handle.

    MIXER_OBJECTF_HMIXER

    The uMxId parameter is a mixer device handle returned by the mixerOpen function.

    This flag is optional.

    MIXER_OBJECTF_MIXER

    The uMxId parameter is a mixer device identifier in the range of zero to one less than the number of devices returned by the mixerGetNumDevs function.

    This flag is optional.

    MIXER_OBJECTF_HWAVEIN

    The uMxId parameter is a waveform audio input handle returned by the waveInOpen function.

    MIXER_OBJECTF_HWAVEOUT

    The uMxId parameter is a waveform audio output handle returned by the waveOutOpen function.

    MIXER_OBJECTF_WAVEIN

    The uMxId parameter is the identifier of a waveform audio input device in the range of zero to one less than the number of devices returned by the waveInGetNumDevs function.

    MIXER_OBJECTF_WAVEOUT

    The uMxId parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of devices returned by the waveOutGetNumDevs function.

    The following table shows flags are supported in other versions of Windows, but not in Windows Embedded CE.

    Flags not supported in Windows Embedded CE

    MIXER_OBJECTF_AUX

    MIXER_OBJECTF_HMIDIN

    MIXER_OBJECTF_HMIDIOUT

    MIXER_OBJECTF_MIDIIN

    MIXER_OBJECTF_MIDIOUT

Return Value

Returns MMSYSERR_NOERROR if successful or an error otherwise.

The following table shows the possible values.

Value Description

MMSYSERR_ALLOCATED

The specified resource is already allocated by the maximum number of clients possible.

MMSYSERR_BADDEVICEID

The uMxId parameter specifies an invalid device identifier.

MMSYSERR_INVALFLAG

One or more flags are invalid.

MMSYSERR_INVALHANDLE

The uMxId parameter specifies an invalid handle.

MMSYSERR_INVALPARAM

One or more parameters are invalid.

MMSYSERR_NODRIVER

No mixer device is available for the object specified by uMxId.

The location referenced by uMxId also contains the value – 1.

MMSYSERR_NOMEM

Unable to allocate resources.

Remarks

Use the mixerGetNumDevs function to determine the number of audio mixer devices present in the system.

The device identifier specified by uMxId varies from zero to one less than the number of devices present.

If a window is chosen to receive callback information, the MM_MIXM_LINE_CHANGE and MM_MIXM_CONTROL_CHANGE messages are sent to the window procedure function to indicate when an audio line or control state changes. For both messages, the wParam parameter is the handle of the mixer device.

The lParam parameter is the line identifier for MM_MIXM_LINE_CHANGE or the control identifier for MM_MIXM_CONTROL_CHANGE that changed state.

To query for audio mixer support or a media device, use the mixerGetID function.

Requirements

Header mmsystem.h
Library coredll.lib
Windows Embedded CE Windows CE 2.12 and later
Windows Mobile Windows Mobile Version 5.0 and later
Note Version 2.12 requires DXPAK 1.0 or later

See Also

Reference

mixerGetID
mixerGetNumDevs
MM_MIXM_LINE_CHANGE
MM_MIXM_CONTROL_CHANGE
waveInOpen
waveOutOpen
waveInGetNumDevs
waveOutGetNumDevs
Hardware Audio Mixer Functions