UInt32 offset = firstSampleFrame * (streamFormat->fBitWidth / 8) * streamFormat->fNumChannels;
UInt32 size = numSampleFrames * (streamFormat->fBitWidth / 8) * streamFormat->fNumChannels;
memcpy(&((SInt8 *)sampleBuf)[offset], &((SInt8 *)mixBuf)[offset], size); // panic here when !streamFormat->fIsMixable
<snip>
}
The panic doesn't occur when I hardcode a small size or don't add an offset to the mixBuf. I'm wondering if the math has to be done differently.
However, maybe this is barking up the wrong tree here, anyway I've wasted a day or so on it. Perhaps it is better to override
virtual IOReturn addClient(IOAudioClientBuffer *clientBuffer)???
Also, I found that when a user-space client connects, a debug property kIOUserClientCreatorKey is set in the IORegistry
IOUserClientCreator string pid XXXX, coreaudiod
Is this reliable? Currently I'm parsing the string to obtain just the client name, since pid_for_task() does not seem to exist in the kernel. Or maybe I'm missing something there too, and there's a way to get process name from the task_t passed in to the user client?
I've been scouring the IOAudioFamily source code, and have learned much but any help on these issues would be appreciated. Thanks again!