0
在OS X中,我試圖找到一個如何發現安裝在最終用戶系統上的所有音頻單元並取回該信息以供顯示和使用的示例。如何發現帶音頻組件服務的[非Apple]音頻設備?
我知道音頻組件與該任務有關,但我完全不知如何去做。我遇到的所有例子都是基於找到一個AudioComponentFindNext的'已知'Apple AU,我找不到發現其他任何東西的例子。
任何人都可以指點我一個例子嗎?
感謝
在OS X中,我試圖找到一個如何發現安裝在最終用戶系統上的所有音頻單元並取回該信息以供顯示和使用的示例。如何發現帶音頻組件服務的[非Apple]音頻設備?
我知道音頻組件與該任務有關,但我完全不知如何去做。我遇到的所有例子都是基於找到一個AudioComponentFindNext的'已知'Apple AU,我找不到發現其他任何東西的例子。
任何人都可以指點我一個例子嗎?
感謝
您可以設置使用0
作爲類型,子類型和製造商一個通配符AudioComponentDescription
結構。傳遞到AudioComponentFindNext
:
AudioComponentDescription acd = { 0 };
AudioComponent comp = nullptr;
while((comp = AudioComponentFindNext(comp, &acd)) {
// Found an AU
}
下面是從頭部的一些相關文件:
@function AudioComponentFindNext
@abstract Finds an audio component.
@discussion This function is used to find an audio component that is the closest match
to the provided values.
@param inComponent
If NULL, then the search starts from the beginning until an audio
component is found that matches the description provided by inDesc.
If non-NULL, then the search starts (continues) from the previously
found audio component specified by inComponent, and will return the next
found audio component.
@param inDesc
The type, subtype and manufacturer fields are used to specify the audio
component to search for. A value of 0 (zero) for any of these fields is
a wildcard, so the first match found is returned.
@result An audio component that matches the search parameters, or NULL if none found.