Skip to contentSkip to conversation

documentation on SNDCTL_DSP_SETFRAGMENT exist?

DISCUSSION Britton Leo Kerin 3 participants 3 messages Feb 15, 2000 – Feb 16, 2000 Sound

lore
Share & tools
lore
#0 lore raw

Does anyone know of any documentation of any kind (book, howto, anything) out there which covers this feature?

Thanks,
Britton Kerin

#1 lore raw

http://www.4front-tech.com/pguide/audio2.html

see the section, "Selecting buffering parameters"

Quoted 6 lines · Britton Leo Kerin

Does anyone know of any documentation of any kind (book, howto, anything) out there which covers this feature?

Thanks,
Britton Kerin

Signature · 3 lines
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
| Eric B. Mitchell         mailto:[email protected] |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
#2 lore raw
In reply to Britton Leo Kerin

There's not much to cover. It is used to set the size of the buffer fragments and how many of them you want. The only complication is is that the fragment size is specified as the power of 2 of the size of the fragment - e.g. for 1024byte frags the value 10 is used, 1024=2^10. The number of buffers is held in the top 16bits of an int and the power of 2 of the buffer fragment in the bottom 16 bits.

If /dev/dsp is open on fd, N is the number of fragments, and E is the power of 2 of the fragment size....

   int fr=(N<<16)+E;
   if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT , &fr) < 0) {
      Error_Stuff;
   }

Choosing a fragment size depends on the application. If you have somesort of "interactive" app generating audio samples then you probably want smallish fragments holding somewhere between 10 or 100 millisecs of samples (depending on what you concept of interactive is :-) and as few as possible so you don't have too much buffered ahead, yet have enough samples buffered so you don't get breakup due to running out of samples. If there is no "interactive" element, often a few large fragments will suffice.

Quoted 14 lines · Eric Mitchell

http://www.4front-tech.com/pguide/audio2.html

see the section, "Selecting buffering parameters"

Quoted 6 lines · Britton Leo Kerin

Does anyone know of any documentation of any kind (book, howto, anything) out there which covers this feature?

Thanks,
Britton Kerin