Hello everybody,
I'm porting coreaudio-flac project to work on 10.8 and up, using only the audio component manager, and not the component manager. My starting point:
CoreAudioUtility Classes v.1.0.3
and
Audio Codec Examples sample code v.1.0
I'm having problems with 'afil' component. Which brings me to a couple of questions for Gurus:
1. Is writing 'afil' components officially supported?
2. Is there a useful example of an 'afil' audio component - I was looking for a week now with no luck finding any documentation, support articles, or sample code.
3. Do I have to use legacy component manager APIs with 'afil', even on 10.8? What should CA_USE_AUDIO_PLUGINS_ONLY be set to for 'afil'?
4. Should I jump to 10.9 Dev preview, is there any benefit/changes to CoreAudio there?
Problem I'm having - I get a EXC_BAD_ACCESS when trying to test 'afil' by calling AudioFileOpenURL():
* thread #1: tid = 0x1e03, 0x00000001059a3ebe LZCFlacAudioFile`ExtensionIsThisFormat(obj=0x0000000105e73f90, inExtension=0x0000000100c77fe0, outResult=0x00007fff5fbff12c) + 30 at AudioFileComponentBase.cpp:279, stop reason = EXC_BAD_ACCESS (code=13, address=0x0)
frame #0: 0x00000001059a3ebe LZCFlacAudioFile`ExtensionIsThisFormat(obj=0x0000000105e73f90, inExtension=0x0000000100c77fe0, outResult=0x00007fff5fbff12c) + 30 at AudioFileComponentBase.cpp:279
frame #1: 0x00007fff8a4fb160 AudioToolbox`AudioFileComponentExtensionIsThisFormat + 103
frame #2: 0x00007fff8a4904e7 AudioToolbox`AudioFileFormatComponent::ExtensionIsThisFormat(__CFString const*) + 21
frame #3: 0x00007fff8a47c1da AudioToolbox`AudioFileFormatRegistry::GetFormatForFile(__CFURL const*, unsigned int, int, unsigned int, void const*) + 256
frame #4: 0x00007fff8a47d62f AudioToolbox`AudioFileOpenURL + 384
frame #5: 0x000000010000114d CAAUFilePlayer`main(argc=1, argv=0x00007fff5fbff808) + 141 at main.c:53
frame #6: 0x00007fff80ed57e1 libdyld.dylib`start + 1
I did subclass AudioFileComponentBase, overriding both AudioFileComponentBase() and GetAudioFormat() methods. Also, file format & file object were created. At the least I should see a debug message from within GetAudioFormat(), but it seams that it's never called.
I don't use ARC, it's all C and C++. What could cause this particular EXC_BAD_ACCESS? It's hard to debug it, as call is from AudioToolbox framework. I know that most of the time EXC_BAD_ACCESS is associated with an object being deallocated. I just don't see where it happens, or could it be something else? I been trying different things for a week now with no luck. And NSZombies are of no help here...
There is also a suspicions line in a lldb debugger: dlopen(...Carbon...) after my 'afil' component, file format and file object already been instantiated by audio component manager.
Thanks in advance! I'm thinking about making this freely available, and if I can figure this out, also create components for modular music such as .it, .mod and others. So, any help will be appreciated greatly! I do have a background in OpenGL, some CUDA, Unix programming, but not so much in CoreAudio, so, I could use some help, and it will go to a good use :)
Sorry had to write most of it out from memory as I'm at work behind a PC :(
P.S. I may have to upload my code to make sense out of all this. Also, this is my first post on here, please be patient, and let me know if I overstepped any boundaries here.