Linux and Latency

reine at mbox314.swipnet.se reine at mbox314.swipnet.se
Sat Aug 21 11:09:59 CEST 1999


On 18 Aug, Miller Puckette wrote:
> Hi Guenter & Reine,
> 
> Well, I hacked pretty hard on the sound support for 0.26 (so
> making "-audiobuf" use the GETISPACE/GETOSPACE ioctls for instance.)
> On drivers that support those features (like my Creative PCI driver)
> this works great, but apparently I really should be offering a
> "-stupid-linux-audio-driver" flag to go back and do it the 0.25
> way with -setfragsize or whatever.  I confess I don't know what the
> fragment size business even does, but on PCI128 it's nowhere as good
> as using GETISPACE/GETOSPACE.

To make my homebrew play work with my Thinkpad 560 (133mHz pentium) 
i added

   svar=(2<<16) | (14) ;
   ioctl(sfh,SNDCTL_DSP_SETFRAGMENT,&svar);

to my InitPlay function. This ioctl should, because of something,
be used before the others (SETFMT,SPEED etc).

Here are my guesses:
The 2 in (2<<16) refers to number of fragments.
The 14 refters to size of fragments. 14 bits is 16384. 
(correct me if im wrong).
It seems like if I stay on a total of 32768 (=2*16384)
I can use a number of variations like svar=(4<<16) | (13);

By some odd reason I get funny glitches I've never heard
before (not like over/underrun clicks) if the total buffer size 
gets higher than 32768. 
If SNDCTL_DSP_SETFRAGMENT is not used my Linux chooses 
to use twice the size if 32768, ok for most soundcards.

To get a hint of whats happening we can use

{
   audio_buf_info info;

   ioctl(sfh,SNDCTL_DSP_GETOSPACE,&info);
   printf("%d %d &d &d\n",info.fragments,info.fragstotal,
      info.fragsize,info.bytes);

}   

Sorry if I pestered you about obvius things.

Reine
 

> 
> So I propose to try to put out a "patch" of 0.26 giving the choice,
> perhaps using Guenter's proposed flag name.  Right now I'm trying to put
> out a new release of fiddle~ etc, so the "patch" might not hit the
> web until this weekend or so...
> 
> cheers
> Miller
> 
> 
> 
> 





More information about the Pd-list mailing list