- 什麼是MMDevice?
全名:The Windows Multimedia Device (MMDevice) API
Windows多媒體驅動API
頭文件:Header file Mmdeviceapi.h defines the interfaces in the MMDevice API - MMDevice API 的作用:
MSDN:The Windows Multimedia Device (MMDevice) API enables audio clients to discover audio endpoint devices, determine their capabilities, and create driver instances for those devices.
作用:Windows的MMDevice API 能讓擁有多媒體操作的客戶端 發現多媒體終端驅動,設置參數,Create一個驅動實例
PS: endpoint devices是什麼?
- 那麼MMDevice 給我們提供了什麼API?
1) IMMDeviceEnumerator interface
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
hr = CoCreateInstance(
CLSID_MMDeviceEnumerator, NULL,
CLSCTX_ALL, IID_IMMDeviceEnumerator,
(void**)&pEnumerator);
在上面的代碼中:CLSID_MMDeviceEnumerator和IID_IMMDeviceEnumerator 是 IMMDeviceEnumerator 接口對象(一個叫做MMDeviceEnumerator的類)的兩個參數,這兩個參數都是GUID(全局唯一先設置好的參數)。pEnumerator 是這個枚舉對象(IMMDeviceEnumerator)的指針。返回值hr是一個HRESULT類型的資源句柄
2)Interface | Description
IMMDevice Represents an audio device IMMDeviceCollection Represents a collection of audio devices
IMMDeviceEnumerator Provides methods for enumerating audio devices.
IMMEndpoint Represents an audio endpoint devic
IMMNotificationClient Provides notifications when an audio endpoint device is added or removed, when the state or properties of a device change, or when there is a change in the default role assigned to a device