Re: Do not want multiple clients mixing my audio
Re: Do not want multiple clients mixing my audio
- Subject: Re: Do not want multiple clients mixing my audio
- From: Jeff Moore <email@hidden>
- Date: Fri, 14 May 2010 09:38:43 -0700
IOAudio drivers are multi-client by design. By being in the kernel and writing one of these drivers, you are signing up to support this. If you only want one application to use your driver, you should not make your driver be an IOAudio-based driver. You should write something else and have your app talk to that.
On May 14, 2010, at 6:53 AM, John Johnson wrote:
> I'm trying to figure out if there's a way to prevent audio streams from mixing data, whether by one client having exclusive access or whatever. I've tried making the format not mixable, but then I get a panic in clipOutputSamples:
> IOReturn Engine::clipOutputSamples(const void *mixBuf, void *sampleBuf, UInt32 firstSampleFrame, UInt32 numSampleFrames, const IOAudioStreamFormat *streamFormat, IOAudioStream *audioStream)
> {
> <snip>
> 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!
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden