Alsa ignores rate setting in thread, unlike normal function call, is there a reason?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm writing an app that generates and sends sound to the sound card via
ALSA.  When I run it with a regular function call, everything works
fine.  But I thought I could scavenge a few cycles by spawning the
write to alsa using snd_pcm_writei in a thread.  So I modified the
function to unpack the variables from the passed in structure and use a
mutex.  The main thread blocks until the writei thread returns, but it
has run another buffer of data by then.  And it works, except that the
rate information seems to go by the board.  It sucks the data down as
fast as I can send it instead of blocking until the alsa buffer is
empty enough to require more data.  i.e. alsa does not regulate the
rate anymore.  This does terrible things to the sound.

Can anyone explain why this would be true?  

Thanks.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux