Post

Replies

Boosts

Views

Activity

Testing installTap(onBus:bufferSize:format:block:)
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?
1
0
760
Jun ’20
Microphone crashing when change input source
I am using the microphone, and found a lot of issues that crashes the app when the input source did change. The error was always something like: ** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: format.sampleRate == hwFormat.sampleRate. Now I have fixed this issue, forcing the input-source to be always the builtin microphone and using AVAudioFoundation entities at different moments. But I am still not confident about this solution. For example, I still having some inconsistencies while transmitting the device screen on macOS through QuickTime. So my question around this: How to prevent app-crashes with this kind of error? I saw a lot of similar errors just changing the property of the format. How can I avoid these kinds of errors? There is a Swift-way to handle the error instead of using an exception catcher from Objective-c?
3
0
1.9k
Jun ’20