gpt4 book ai didi

c++ - OSX AUGraph 重新创建导致 badComponentType 错误

转载 作者:行者123 更新时间:2023-12-03 02:23:41 25 4
gpt4 key购买 nike

在 OSX 上,我正在为我的音频系统创建一个 AUGraph,如下所示:

OSStatus result = NewAUGraph(&mGraph);

AUNode outputNode;
AudioComponentDescription outputDesc;
outputDesc.componentType = kAudioUnitType_Output;
outputDesc.componentSubType = kAudioUnitSubType_DefaultOutput;
outputDesc.componentManufacturer = kAudioUnitManufacturer_Apple;
outputDesc.componentFlags = 0;
outputDesc.componentFlagsMask = 0;
result = AUGraphAddNode(mGraph, &outputDesc, &outputNode);

AUNode converterNode;
AudioComponentDescription converterDesc;
converterDesc.componentType = kAudioUnitType_FormatConverter;
converterDesc.componentSubType = kAudioUnitSubType_AUConverter;
converterDesc.componentManufacturer = kAudioUnitManufacturer_Apple;
converterDesc.componentFlags = 0;
outputDesc.componentFlagsMask = 0;
result = AUGraphAddNode(mGraph, &converterDesc, &converterNode);

result = AUGraphConnectNodeInput(mGraph, converterNode, 0, outputNode, 0);
result = AUGraphOpen(mGraph);

...initialize graph, start graph, etc...

这一切正常,我可以听到声音等。稍后系统关闭:
unsigned char isRunning = false;
AUGraphIsRunning(mGraph, &isRunning);
if (isRunning)
AUGraphStop(mGraph);

OSStatus result;
unsigned char isInitialized = false;
AUGraphIsInitialized(mGraph, &isInitialized);
if (isInitialized)
{
result = AUGraphUninitialize(mGraph);
}
result = DisposeAUGraph(mGraph);

同样,这里没有问题。然而,当系统重新启动时,第一个代码块再次执行后不久。在:
result = AUGraphOpen(mGraph);

“结果”显示为 -2005 (badComponentType)。有谁知道这是什么原因?

最佳答案

在关机时调用 AUGraphClose 解决了这个问题。猜猜你不能有两个具有相同输出单元的开放图?

关于c++ - OSX AUGraph 重新创建导致 badComponentType 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8348537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com