5

我想通过AudioUnitAddRenderNotify将音频输出到扬声器的当前活动的 RemoteIO 单元添加一个输出渲染回调。我无权访问实际的 RemoteIO 实例变量,但我想在应用程序中获取音频单元列表并以这种方式找到 RemoteIO 单元。这甚至可能吗?

4

2 回答 2

1

如果您可以获得访问权限,AUGraph那么这是可能的。根据AUGraph 文档,有几种方法可以帮助您。

AUGraphGetNodeCount- 获取图中的节点数 AUGraphGetIndNode- 获取索引节点 AUGraphNodeInfo- 获取有关节点的信息

一旦你有了正确的节点,你就可以得到 remoteIO 单元并添加你的回调。获得访问权限AUGraph实际上是真正的问题。

于 2013-04-09T11:41:37.337 回答
0

只有一个 RemoteIO。我从来没有尝试过获得指向它的指针,而不是“创建”它的人。你为什么不尝试这样的事情,它应该给你一个指向 RemoteIO 的指针:

OSStatus status;
AudioComponentInstance audioUnit;

    // Describe audio component
AudioComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_RemoteIO;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;

// Get component
AudioComponent outputComponent = AudioComponentFindNext(NULL, &desc);

// Get audio units
status = AudioComponentInstanceNew(outputComponent, &audioUnit);
checkStatus(status);
于 2013-04-02T17:01:51.190 回答