Patch: Fix for small buffers on pro audio cards (RME 9632)

Ed Wildgoose <[email protected]> Sat, 21 Aug 2004 13:24:16 +0100
Newsgroups gmane.comp.video.ogle.devel
Message-ID <[email protected]>
Hi,

I have an RME 9632 which is a high quality audio card, one of the few 
which are supported under linux to some extent.  The card only supports 
operation with two audio buffers, although these can be quite large.  
Quality if very high, but I have been having problems using it at all 
with Ogle.

Fix appears to be down to removing the alsa code which sets 
"snd_pcm_sw_params_set_avail_min" - see attached patch.  I can see no 
negative impacts from removing this (I can't actually see why it's that 
useful at all?).  However, this then allows my RME 9632 to play normally.

I have also tested with my RME 96/8 card and this still appears to work 
fine. 

(Note: I did try simply reducing the number of periods requested in the 
"..set_avail_min" command but this simply lead to high speed buffer 
under-run - I believe this is due to some interaction as a result of the 
two buffer periods available on this card)

Could this patch please be commited to CVS

Thanks

Ed Wildgoose
ogle.diff (text/plain, 865 B)
--- libogleao/alsa_audio.c.orig	2004-08-21 12:51:48.911308125 +0100
+++ libogleao/alsa_audio.c	2004-08-21 12:55:50.809056165 +0100
@@ -55,8 +55,6 @@
 #define BUFFER_TIME 500000
 /* period time in us */ 
 #define PERIOD_TIME 10000
-/* minimum samples before play */
-#define MINIMUM_SAMPLES 5000
 
 static int set_hwparams(alsa_instance_t *i)
 {
@@ -168,11 +166,6 @@
     ERROR("Unable to determine current swparams for playback: %s\n",
 	  snd_strerror(err));
   }
-  /* allow transfer when at least period_size samples can be processed */
-  if((err = snd_pcm_sw_params_set_avail_min(i->alsa_pcm, i->swparams,
-					    MINIMUM_SAMPLES)) < 0) {
-    ERROR("Unable to set avail min for playback: %s\n", snd_strerror(err));
-  }
   /* align all transfers to 1 samples */
   if((err = snd_pcm_sw_params_set_xfer_align(i->alsa_pcm, 
 					     i->swparams, 1)) < 0) {