[alsa-devel] Issue with Dmix

mateen abdulmateen.shaikh at gmail.com
Mon Feb 25 07:08:58 CET 2013


HI



We have enabled DMIX plugin for sample rate conversion and mixing of 2 pcm
streams in our alsa package (Alsa lib 1.0.22 and alsa driver 1.0.22.1)  to
48K output Sample rate.However we are seeing a noise issue with 44100
Sample rate input streams or Unsigned Stereo 48K stream.



This is how our current design  is:

We call snd_pcm_lib_malloc_page() in which alsa driver internally allocates
a dma buffer and map it when Dmix is invoked.

We currently reads from that mmaped buffer to our hardware buffer inside a
transfer_ack_begin() function which is called from snd_pcm_period_elapsed().

However we are getting a problem in understanding how do we know how much
data has been written by dmix lib in mapped buffer? As we see no ioctl or
corresponding hardware function call where dmix may pass information on
Size of data being written to our driver.



We do see appl_ptr and hw_ptr in runtime->mmap->control and status struct.
Out architecture doesn’t support defining and mapping of these status and
control structure at hardware level.Thus Dmix lib allocates them and copy
them to runtime substream via ioctl. As far as I could understand both
appl_ptr and hw_ptr are initialised to 0 and then appl_ptr is the one
adjusted by lib after every write. Should we tap this value to update
hw_ptr value in status information? Will difference of hw_ptr and appl_ptr
will let us know amount of frames been written?

Can anyone please help us to understand criteria and concept of data copy
from intermediate to hardware buffer?

Any information on this would be of immense help.


Regards,
Shaikh Mateen


More information about the Alsa-devel mailing list