About MMDevice API (MSDN文檔理解)

  1. 什麼是MMDevice?
    全名:The Windows Multimedia Device (MMDevice) API
    Windows多媒體驅動API
    頭文件:Header file Mmdeviceapi.h defines the interfaces in the MMDevice API
  2. 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是什麼?
***The following diagram shows how audio endpoint devices differ from adapter devices***.

  1. 那麼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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章