[linux-audio-dev] Mix, sndplay and SNDCTL_DSP_SETFRAGMENT

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] Mix, sndplay and SNDCTL_DSP_SETFRAGMENT
From: reine_AT_mbox314.swipnet.se
Date: la elo    07 1999 - 11:31:38 EDT


Testing mix with long clean nice sounds i noticed that
mix hade the same problem on my Thinkpad 560 (133mHz pentium)
as my homebrewed "play" program. Odd almost "clicks,glitches..."
that I could not hear on the on no/laptop/133mHzpentium.
One program worked: the sndplay program from Bill Schottstaedt.

So I started to study his code and found out that if I
added something like

   static int FRAGMENTS = 4;
   static int FRAGMENT_SIZE = 12;
   if (!fragments_locked) {if (srate > 30000) FRAGMENTS = 4; else FRAGMENTS = 2;}
      buffer_info = (FRAGMENTS<<16) | (FRAGMENT_SIZE);

In fact I since my little play program is just for me and not need to
be as clever as Bills (thank You Bill) I shortened it to

   int svar=(4<<16)|(12);
   ioctl(sound,SNDCTL_DSP_SETFRAGMENT,&svar);

And now my little play program was much more stable.
I also made the same change in the mixw source in the
DPTich_linux_audio.c. I guess the same appplies for the new
mix.

  queuetwo = ((int) (log (bufferbytes) / log (2.0))) + 1;
//Out_with_tho_old_line: argument = 0x7fff0000 | (queuetwo & 0x0000ffff);
//In with the new:
        argument=(4<<16)|(12);
  if (ioctl (port->file,SNDCTL_DSP_SETFRAGMENT,&argument) == -1)

And the new is more stable than the old.
I'm not sure why. It did not sound as "normal ;)" underrun-clicks.

Reine


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:25:52 EST