在我的應用程序中,我需要在這兩個不同的AudioUnit之間切換。 每當我從VPIO切換到RemoteIO時,錄製音量都會有所下降。相當大的下降。 雖然沒有改變播放音量。任何人都經歷過這個?RemoteIO和VPIO之間的錄製音量下降切換
下面是我做開關的代碼,它由路由更改觸發。 (我不太確定我是否做了正確的改變,所以我也在這裏問。)
如何解決錄音音量下降的問題?
謝謝,感謝任何幫助,我可以得到。
碼頭。
- (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];
}
}
嗨,洛基,我試過了。因爲我使用AUGraphNodeInfo(theGraph,remoteIONode,0,&_remoteIOUnit);獲取remoteIO實例,似乎我無法使用AudioComponentInstanceDispose(它崩潰)。我讀過你似乎在談論的帖子。似乎並不適合我:/ – lppier