Re: A driver question - hiding channels in a DMA buffer
Re: A driver question - hiding channels in a DMA buffer
- Subject: Re: A driver question - hiding channels in a DMA buffer
- From: Devendra Parakh <email@hidden>
- Date: Mon, 09 Sep 2002 16:36:59 -0700
Mark,
Thank you for the quick response!
The problem is that CoreAudio wants to know a lot about the DMA buffer
(which in this case is a shared memory buffer - the data stays in main
memory, the hardware fetches the samples directly from the buffer via PCI
transactions). It wants to know the sample size and the number of
channels and the total buffer size (in samples).
Based on this information, and the location reported by "takeTimeStamp",
ConvertInputSamples(since this is Input we're talking about) is called
with a pointer into my DMA buffer. The only problem is that since I'm not
telling CoreAudio the whole truth (the DMA buffer really always has 12
channels), it will send me a pointer based on a 6ch. x 32bit buffer.
What's more, I don't think CoreAudio has any responsibility to provide me
with a pointer into "my" physical buffer. It might as well copy the DMA
buffer into a private buffer, and then provide me a pointer to this
private buffer.
Or am I being unnecessarily paranoid here!
Thanks.
Devendra.
At 10:51 AM 9/9/2002, Mark Cookson wrote:
I can't think of any other way of doing this than to just report your
device as 6 channels (because that's what it is), and then do the
math to get your data to the right place.
It shouldn't be too bad as the buffer given to you by CoreAudio will
be sequential audio, though your clip routine will need to convert
from float to 32 bit and calculate where to put that sample in your
PCI card's memory. It's too bad that the hardware is using channels
1,2,3,4,5,6 because that gap from channel 2 to channel 7 is going to
give the PCI bus a real workout.
There are two ways to do the copy, and you should experiment to find
out which one works best. One way is to copy linearly from the
CoreAudio buffer to your hardware, jumping around in PCI memory as
required by your card. The other option is to jump around in
CoreAudio's buffer to go linearly through your PCI card's memory.
Normally this is a better way to go because the PCI bus is so much
slower than the main memory bus, you want the performance improvement
of having all the writes gathered together. However, with your
writes being slightly scattered, there might not be much of a
performance boost. Still, it's worth experimenting with.
Good luck,
Mark
On Monday, September 9, 2002, at 09:56 AM, Devendra Parakh wrote:
Hi,
We have a driver for a PCI audio device with 12 input channels
(32bit
samples). This driver is working fine.
We have to now modify this driver for another flavor of the
device which
only only provides connectors for 6 of the 12 channels. In other
words,
we want to expose only 6 channels (channel number 1,2,7,8,9,10,11
and 12)
to CoreAudio HAL.
However, the DMA buffers will always contain data for all 12
channels.
Is there a good solution?
If I report 6 channels, then ConvertInputSamples() will probably
come
back with inappropriate buffer pointers!
Any help would be greatly appreciated!
Thanks.
Devendra.
Devendra ParakhSinging Electrons,
Inc.
http://www.singingelectrons.com425-889-2478
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
--
Mark Cookson
Engineering Droid
Apple Computer, Inc.
Core Audio CPU Software
6 Infinite Loop MS 306-2CW
Cupertino, CA 95014
Devendra ParakhSinging Electrons, Inc.
http://www.singingelectrons.com425-889-2478
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.