At Sun, 06 Jan 2008 11:15:35 +0100, Joachim Foerster wrote:
Hi Cliff,
On Wed, 2008-01-02 at 06:26 +0000, cailinhua wrote:
I want to enable dmix for our sound card.Unfortunately for some reason the sound card driver don't support 'mmap' way,it only support 'copy' callback to copy data from upper level to DMA.So ,I think maybe I can modify the alsa-lib dmix source code to let it use 'copy' way to send data to the driver. Is it possible? Could you please give me some ideas?
I don't know how difficult it would be to change alsa-lib's dmix sources, but my suggestion - in general - would be to alter the driver of your sound card to use the "intermediate buffer" technique (using pcm-indirect.h): Setup a buffer in RAM, which can be mmap'ed by applications and copy the contents of this buffer to the hardware in a background process for example. (See Takashi's "Writing an ALSA Driver" guide.)
I know, perhaps this is not the easiest solution ... and it's not a "direct" answer to your question - just a thought.
Yes, currently it's the only "solution". The dmix requires mmap because the shared mmap among several processes is the key technique of dmix.
Takashi