[linux-audio-dev] Oss & threading -- is it possible

hexe_2003 at directbox.com hexe_2003 at directbox.com
Fri Oct 10 12:00:01 UTC 2003



-------- directBOX Reply ---------------
From: paul at linuxaudiosystems.com
To  : linux-audio-dev at music.columbia.edu
Date: 10.10.2003 17:37:43

>Hello !
>
>I've read somewhere that it is not possible that threads write different data to /
>dev/dsp.
>But how does Cheesetracker, for example, make it then? 

i don't how cheesetracker does it, but it requires user-space
synchronization (e.g. pthread_mutex_(un)lock). with ALSA, you don't
need to to do this - any thread can write to the device at any
time. that's the theory, at least. in general, its probably a bad
design to be doing that, much like it is for GUI programming, where
its better to have a single thread mediate between the "device" and
the rest of the program.

------------------

But well, If I synthize ( ? spelling) two signals and want to send them at  the same time
to the device, my first idea'd be:
1.) Open /dev/dsp, maybe O_NONBLOCK | O_WRONLY
2.) thread
3.) two threads calculate the both signals
4.) sync them
5.) two threads write their signals to /dev/dsp
6.) threads close

certainly some of this. I mean mp3blaster, for example, have several pids while playing audio streams, and it is basicly OSS-programming and not alsa.
Am I so wrong ? ;)

Sascha Retzki
__________________________________________________
Verpassen Sie keine eBay-Auktion und bieten Sie bequem
und schnell über das Telefon mit http://www.telefonbieten.de

Ihre eMails auf dem Handy lesen - ohne Zeitverlust - 24h/Tag
eMail, FAX, SMS, VoiceMail mit http://www.directbox.com





More information about the Linux-audio-dev mailing list