![]() | |||||||||||||
Messages in this thread |
On Tue, 28 Jan 1997, Ian Main wrote: > > Hi, as you guessed, I'm trying to get full duplex sound using 2 sound > cards. One is a mad16, and the other a sb16. Both work fine by > themselves, but when I try to use them together, the sb16 behaves a little > strangely. (mad16 works fine.) The sb16 works fine for 8 bit IO, but 16 > bit playback and record is very jumpy. It misses large sections of the > sound (I assume it's a buffer problem.) It's very tricky to do recording of CD quality audio to a disk file in Linux. The process just sometimes get's blocked for disk I/O for too long time. This seems to happen every time bdflush/sync starts posting dirty buffers to disk. When using 44.1 kHz/16 bits/stereo format the maximum possible DMA buffer (64k) becomes full after 0.37 seconds which causes an overrun. However with a fast (SCSI) disk it's possible to record without problems. I don't know exactly which causes the difference between SB16 and the MAD16 card but it's possibly related with different DMA overhead caused by the cards (could this be possible?). To be able to do simultaneous recording and playback reliably you should implement extra buffering in the application. This probably means that you should use multible threads (or processes communicating through a shared memory segment). One thread reads data from the device as fast as possible and stores it into a buffer (FIFO). The second thread reads data from the buffer and posts it to the disk file. For simultaneous playback you probably need more threads. Btw, allowing some kind of buffer cache write through would be an usefull feature. Some applications (like data logging) work better blocks written by an application are sent to the disk immediately. In this way the disk I/O caused by the application is distributed over longer period of time and it doesn't become an bottleneck. This kind of mode could be turned on using fcntl() or something like it so that it doesn't disturb normal applications. Is anybody interested in implementing this kind of feature in Linux? Best regards, Hannu ------- Hannu Savolainen (hannu@voxware.pp.fi, hannu@4front-tech.com) http://www.4Front-Tech.com/oss.html (Open Sound System (OSS)) http://personal.eunet.fi/pp/voxware (OSS Free/TASD/VoxWare) | ||||||||||||
| Last update: 2005-03-22 12:38 [W:0.193 / U:0.060 seconds] ©2003-2008 Jasper Spaans | |||||||||||||