To write an automated test to validate if the installTap(onBus bus:bufferSize:format:block:) function is calling our logics, I created an abstraction. This abstraction, instead of always installing a tap at inputNode from an AVAudioEngine instance. I inject an input node (AVAudioNode) where the install tap will be executed. At production code, I inject the microphone node, but on tests, I inject an AVAudioPlayerNode instance that produce some AVAudioBuffers. But, the test is pretty flaky, and sometimes fails because we got an exception with -10851 error code, which means kAudioUnitErr_InvalidPropertyValue. How can I write automated tests to installTap?
Can you please clarify which particular AVAudioEngine API call is resulting in -10851 error code in your tests? What does your test engine graph comprise of?
As far as the installTap API on an AVAudioPlayerNode is concerned, note that the AVAudioFormat specified in the installTap API must be same as the AVAudioPCMBuffer format that the player is producing, and same as the connection format when the player node is connected to another node.
Hope that helps.
As far as the installTap API on an AVAudioPlayerNode is concerned, note that the AVAudioFormat specified in the installTap API must be same as the AVAudioPCMBuffer format that the player is producing, and same as the connection format when the player node is connected to another node.
Hope that helps.