2014-06-05 116 views
0

在OS X中,我试图找到一个如何发现安装在最终用户系统上的所有音频单元并取回该信息以供显示和使用的示例。如何发现带音频组件服务的[非Apple]音频设备?

我知道音频组件与该任务有关,但我完全不知如何去做。我遇到的所有例子都是基于找到一个AudioComponentFindNext的'已知'Apple AU,我找不到发现其他任何东西的例子。

任何人都可以指点我一个例子吗?

感谢

回答

0

您可以设置使用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.