0
votes

I have a music-making app that uses AUSampler & AURemoteIO units to play back user-defined notes. I'm having an issue where after some use, the call to AudioUnitRender on the sampler never returns, hanging the audio thread and silencing the audio output. The CPU usage also shoots up at this point, as the audio thread continuously spits out error messages to the device console (not the debugger output):

May 11 11:45:12 <device name> mediaserverd(CoreAudio)[2296] <Notice>: HALS_IOContext.cpp:1496:IOWorkLoop_HandleOverload: HALS_IOContext::IOWorkLoop_HandleOverload: Overload on context 96 current time: 11788974 deadline: 11788958

This message is being logged by _os_log_impl inside the AUSampler render (specifically VoiceEnvelope::GetRunFrameCount).

Does anyone have suggestions on why this may be happening and how to avoid it?

1
Are you calling audiounitrender from within an input callback on the remoteio? If so, maybe you could show some of the code. Also, consider just making an audiounit connection if it's not necessary to use a callback and to call audiounitrender manually.dave234
It's being called from the render callback on the remoteIO audio unit. I'm using a library called The Amazing Audio Engine 2, which is handling the actual callback setup & rendering, but the call to AudioUnitRender is on line 163Jayson

1 Answers

1
votes

I discovered the issue. I was passing offsets greater than the size of the buffer into MusicDeviceMIDIEvent which would cause the issue. This was happening due to occasional jumps in the timestamp provided to the render callback. I was able to fix the issue by checking for and ignoring events with offsets greater than the frame count for the current callback.