All of lore.kernel.org
 help / color / mirror / Atom feed
* ALSA with dmix, help needed
@ 2012-11-14  9:39 Sandulescu Bogdan
  0 siblings, 0 replies; only message in thread
From: Sandulescu Bogdan @ 2012-11-14  9:39 UTC (permalink / raw)
  To: alsa-devel



Hello,

I am struggling for some time now with dmix plugin from ALSA. Could anyone please answer to these questions: 


1. Is ALSA library with DMIX plugin suitable for real-time embedded 
systems: where it's needed small api latencies, fast output to 
dma/serial bus and no audible defects?

2. Is it reliable to use ALSA commands from different threads? (e.g. open() in one master thread, writei() from child threads)?

3. Is it normal that two consecutive writei() calls to generate underrun - this happens only just after opening the dmix device. 

e.g.: 

if( snd_pcm_writei(pPcmPlayHandle, (pu8WavDataBuf), 2048) < 0)
  fprintf(stderr, "Underrun encountered: application didn't sent enough data to the ALSA buffer \n");
if( snd_pcm_writei(pPcmPlayHandle, (pu8WavDataBuf+4096),2048) < 0)
 fprintf(stderr, "Underrun encountered: application didn't sent enough data to the ALSA buffer \n");


The second writei() generates this underrun error (-32), even though there is no delay between these two calls. The get_buff_size is 4096, get_buf_period = 1024.


4. The pcm_drain() help states: "for playback, wait for all pending frames to be played and then stop the PCM"
But, how come the execution duration of this drain() takes longer than the actual sound duration? e.g. pcm_drain() takes 300-400 miliseconds, but the wav size sent to writei() is less than 100ms? 

I'm using ASLA lib 1.0.25, on a ARM controller with 440MHz, and no other high prio threads.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-11-14  9:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-14  9:39 ALSA with dmix, help needed Sandulescu Bogdan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.