Those pesky core audio error codes

We’ve all been there. I was there recently with an error code from core audio, ‘-66748’ to be specific. On a good day the meaning for these codes can be found in the core audio header files but this must be done by hand, unless there is some framework global search facility in XCode that no-one has told me about.

This time I thought I’d be slightly more automated and grep the framework header directory to search everything for me.

So with a right click on the framework and “Show in Finder” to get the path I tried

grep: warning: recursive search of stdin

Eh?

I’ve specified the path so why is grep reading stdin?

Turns out it’s the negative error code, despite being in quotes. The dash is making -66748 a grep argument, rather than the search term.

The trick to fix this is to use a double dash — to indicate to the shell there are no further optional arguments to parse after the -r option.

This comes up with the goods:

and a bit of extra grep arguments to show line numbers and context:

Or why not put it in a script?

2 thoughts on “Those pesky core audio error codes

  1. GW says:

    Pardon my ignorance about grep and terminal programs in general, but I had a similar error -10867 and found exactly where it is. But this method you have laid out seems to be a great idea, yet I cannot get it to work (or am not sure if it is working). Note that I am running a OSX app and not iOS.

    I typed in
    grep -r “-10867” /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks

    got the stdin error, then typed:
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AudioUnit.framework/Versions/A/Headers/AUComponent.h = -10867

    All it does is say (standard input): … then the exact same thing I typed in before.

    Ideas?

    • audiodog says:

      Thanks for your comment – it looks like the code in my post lost some key characters when I migrated my blog to a new service. I’ve now updated the post to give the correct instructions. The missing part is to add a double dash after the -r.

      One my machine this now works for your error code:

      grep -r -- "-10867" /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks

      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.h: kAudioUnitErr_Uninitialized = -10867,
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AudioUnit.framework/Versions/A/Headers/AUComponent.h: kAudioUnitErr_Uninitialized = -10867,
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AudioUnit.framework/Versions/Current/Headers/AUComponent.h: kAudioUnitErr_Uninitialized = -10867

Leave a Reply

Your email address will not be published. Required fields are marked *