wraps the IMMDeviceEnumerator interface and provides methods for enumerating multimedia device resources.
| AutoHotkey | AHK_L v1.1+ |
| OS | Windows Vista, Windows 2008 Server or higher |
| Base classes | Unknown |
| Helper classes | EDataFlow, ERole, DEVICE_STATE |
| Other classes | (MMDeviceCollection, MMDevice, MMNotificationClient) |
| MMDeviceEnumerator | wraps the IMMDeviceEnumerator interface and provides methods for enumerating multimedia device resources. |
| Variables | |
| CLSID | This is CLSID_MMDeviceEnumerator. |
| IID | This is IID_IMMDeviceEnumerator. |
| Functions | |
| EnumAudioEndpoints | generates a collection of audio endpoint devices that meet the specified criteria. |
| GetDefaultAudioEndpoint | retrieves the default audio endpoint for the specified data-flow direction and role. |
| GetDevice | retrieves an audio endpoint device that is identified by an endpoint ID string. |
| RegisterEndpointNotificationCallback | |
| UnregisterEndpointNotificationCallback |
EnumAudioEndpoints( dataFlow, mask )
generates a collection of audio endpoint devices that meet the specified criteria.
| UINT dataFlow | The data-flow direction for the endpoint devices in the collection. You can use the fields of the EDataFlow enumeration class for convenience. You should set this parameter either EDataFlow.eRender or EDataFlow.eCapture. |
| UINT mask | The state or states of the endpoints that are to be included in the collection. You can use a combination (or just one) of the fields in the DEVICE_STATE enumeration class for convenience. |
| MMDeviceCollection collection | a new instance of the MMDeviceCollection class |
GetDefaultAudioEndpoint( dataFlow, role )
retrieves the default audio endpoint for the specified data-flow direction and role.
| UINT dataFlow | The data-flow direction for the endpoint device. You can use the fields of the EDataFlow enumeration class for convenience. You should set this parameter either EDataFlow.eRender or EDataFlow.eCapture. |
| UINT role | The role of the endpoint device. You can use the fields of the ERole enumeration class for convenience. You should set this parameter either to ERole.eConsole, ERole.eMultimedia or ERole.eCommunications. |
| MMDevice endpoint | a new instance of the MMDevice class |
In Windows Vista, the MMDevice API supports device roles but the system-supplied user interface programs do not. The user interface in Windows Vista enables the user to select a default audio device for rendering and a default audio device for capture. When the user changes the default rendering or capture device, the system assigns all three device roles (eConsole, eMultimedia, and eCommunications) to that device. Thus, GetDefaultAudioEndpoint always selects the default rendering or capture device, regardless of which role is indicated by the role parameter. In a future version of Windows, the user interface might enable the user to assign individual roles to different devices. In that case, the selection of a rendering or capture device by GetDefaultAudioEndpoint might depend on the role parameter. Thus, the behavior of an audio application developed to run in Windows Vista might change when run in a future version of Windows. For more information, see <Device Roles in Windows Vista at url target=”http://msdn.microsoft.com/en-us/library/windows/desktop/dd370821” name=”http://msdn.microsoft.com/en-us/library/windows/desktop/dd370821”(v=vs.85).aspx>.
GetDevice( id )
retrieves an audio endpoint device that is identified by an endpoint ID string.
| STR id | a string containing the endpoint ID. The caller typically obtains this string from the IMMDevice::GetId method or from one of the methods in the IMMNotificationClient interface. |
| MMDevice device | a new instance of the MMDevice class |
generates a collection of audio endpoint devices that meet the specified criteria.
EnumAudioEndpoints( dataFlow, mask )
retrieves the default audio endpoint for the specified data-flow direction and role.
GetDefaultAudioEndpoint( dataFlow, role )
retrieves an audio endpoint device that is identified by an endpoint ID string.
GetDevice( id )
RegisterEndpointNotificationCallback( client )
UnregisterEndpointNotificationCallback( client )