# logAnyErrors\_CoreAudio jasserting (and responding myself?)

**URL:** <https://forum.juce.com/t/loganyerrors-coreaudio-jasserting-and-responding-myself/6843>\
**Category:** MacOSX and iOS\
**Created:** [May 11, 2011, 4:12pm UTC](https://forum.juce.com/t/loganyerrors-coreaudio-jasserting-and-responding-myself/6843 "2011-05-11T16:12:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [May 11, 2011, 4:12pm UTC](https://forum.juce.com/t/loganyerrors-coreaudio-jasserting-and-responding-myself/6843/1 "2011-05-11T16:12:55Z")

</div>

On my system at least, I reliably get a CoreAudio error when I simply turn my interface off, which results in a jassert and program halting in a debug build, and just a log file entry in a release build.

I assume when I start wider testing I’ll find all sorts of ways to generate CoreAudio errors.

I’d much rather get a chance to handle such errors myself (probably bringing up a dialog saying, “The program’s lost connection with your audio interface, perhaps because it was turned off or disconnected”).

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2011, 11:42am UTC](https://forum.juce.com/t/loganyerrors-coreaudio-jasserting-and-responding-myself/6843/2 "2011-05-12T11:42:25Z")

</div>

Ok… Is there a particular place in the code that’s asserting, or is it just whenever a CoreAudio call is made after the device was removed?

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [May 12, 2011, 7:20pm UTC](https://forum.juce.com/t/loganyerrors-coreaudio-jasserting-and-responding-myself/6843/3 "2011-05-12T19:20:30Z")

</div>

Oh, sorry, should have been clearer.

See juce\_mac\_CoreAudio.cpp, line 52 (or so, I haven’t updated in a few weeks), where the assert goes off.

Really, what I’d like is to be able to drop my own function into the place of logAnyErrors\_CoreAudio

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 13, 2011, 8:54am UTC](https://forum.juce.com/t/loganyerrors-coreaudio-jasserting-and-responding-myself/6843/4 "2011-05-13T08:54:39Z")

</div>

Hmm, the logging in there was really just for debugging - I guess the only clean way to expose a callback function would be to add a virtual method to the AudioIODeviceCallback, which could be possible…

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [May 14, 2011, 9:00pm UTC](https://forum.juce.com/t/loganyerrors-coreaudio-jasserting-and-responding-myself/6843/5 "2011-05-14T21:00:56Z")

</div>

For error handling, you could simply let us set a function pointer as a one-time call in main() before CoreAudio even started up…

but an error callback would be really nifty, I can imagine you’d use that in Windows-world sooner or later, too!
