Ios 在RemoteIO和VPIO之间切换录制音量下降
在我的应用程序中,我需要在这两个不同的音频单元之间切换。 每当我从VPIO切换到RemoteIO时,我的录制音量就会下降。下降幅度相当大。 但播放音量没有变化。有人经历过这种情况吗 下面是我切换的代码,它是由路由更改触发的。(我不太确定我是否做了正确的更改,所以我也在这里询问。) 如何解决录音音量下降的问题 谢谢,谢谢你给我的任何帮助 码头Ios 在RemoteIO和VPIO之间切换录制音量下降,ios,core-audio,remoteio,Ios,Core Audio,Remoteio,在我的应用程序中,我需要在这两个不同的音频单元之间切换。 每当我从VPIO切换到RemoteIO时,我的录制音量就会下降。下降幅度相当大。 但播放音量没有变化。有人经历过这种情况吗 下面是我切换的代码,它是由路由更改触发的。(我不太确定我是否做了正确的更改,所以我也在这里询问。) 如何解决录音音量下降的问题 谢谢,谢谢你给我的任何帮助 码头 - (void)switchInputBoxTo : (OSType) inputBoxSubType { OSStatus result; if (!r
- (void)switchInputBoxTo : (OSType) inputBoxSubType
{
OSStatus result;
if (!remoteIONode) return; // NULL check
// Get info about current output node
AudioComponentDescription outputACD;
AudioUnit currentOutputUnit;
AUGraphNodeInfo(theGraph, remoteIONode, &outputACD, ¤tOutputUnit);
if (outputACD.componentSubType != inputBoxSubType)
{
AUGraphStop(theGraph);
AUGraphUninitialize(theGraph);
result = AUGraphDisconnectNodeInput(theGraph, remoteIONode, 0);
NSCAssert (result == noErr, @"Unable to disconnect the nodes in the audio processing graph. Error code: %d '%.4s'", (int) result, (const char *)&result);
AUGraphRemoveNode(theGraph, remoteIONode);
// Re-init as other type
outputACD.componentSubType = inputBoxSubType;
// Add the RemoteIO unit node to the graph
result = AUGraphAddNode (theGraph, &outputACD, &remoteIONode);
NSCAssert (result == noErr, @"Unable to add the replacement IO unit to the audio processing graph. Error code: %d '%.4s'", (int) result, (const char *)&result);
result = AUGraphConnectNodeInput(theGraph, mixerNode, 0, remoteIONode, 0);
// Obtain a reference to the I/O unit from its node
result = AUGraphNodeInfo (theGraph, remoteIONode, 0, &_remoteIOUnit);
NSCAssert (result == noErr, @"Unable to obtain a reference to the I/O unit. Error code: %d '%.4s'", (int) result, (const char *)&result);
//result = AudioUnitUninitialize(_remoteIOUnit);
[self setupRemoteIOTest]; // reinit all that remoteIO/voiceProcessing stuff
[self configureAndStartAudioProcessingGraph:theGraph];
}
}
如果您没有正确处理音频单元,会有一些关于低音量问题的讨论。基本上,第一个音频组件保留在内存中,任何连续的播放都将隐藏在您或其他应用程序下,导致音量下降 解决方案:
音频单元是AudioComponentInstance的,必须使用AudioComponentInstanceDispose()释放。为此,我使用了我的apple开发者支持。 以下是支持人员所说的: 语音I/O的存在将导致对输入/输出的处理非常不同。我们不希望这些单位有相同的增益水平在所有,但水平不应该急剧下降,因为它似乎表明你 也就是说,Core Audio engineering指出,您的结果可能与创建语音块的时间有关,它也会影响RIO实例。经进一步讨论,Core Audio engineering有人认为,由于您说电平差异非常大,因此,如果您可以用一些录音记录一个bug,以突出您听到的语音I/O和远程I/O之间的电平差异以及测试代码,那么我们可以尝试在内部复制,看看这是否确实是一个错误缺陷最好包括上述单IO单元测试的结果以及进一步的比较结果 没有控制此增益级别的API,所有内容都由操作系统内部设置,具体取决于音频会话类别(例如,VPIO预计将始终与Play和Record一起使用)以及已设置的IO单元。通常情况下,不希望同时实例化这两者
结论?我认为这是一只虫子/ 我成功地将音频会话类别从语音处理io(播放和录制)更改为远程io(SoloAmbient)。更改此设置之前,请确保暂停音频会话。您还必须取消对音频图的初始化。嗨,洛基,我试过了。因为我使用了AUGraphNodeInfo(图形、remoteIONode、0和_remoteIOUnit);要获取remoteIO实例,似乎无法使用AudioComponentInstanceDispose(它崩溃)。我读过你似乎在谈论的那篇文章。似乎对我不起作用:/Uninitialize,然后Dispose,到目前为止对我不起作用。你找到解决方案了吗?2021年5月,bug仍然存在。。。