well, jaroslav's patch (to change the ESO value) was most of the
solution. in the diff below, i have also cleaned up the spurious
interrupt detection. with these two changes, i can run my trident with
a configuration that previously caused endless xruns in full duplex
mode (44.1kHz, 64 frame period) with no xruns at all.

jaroslav - if there are any parts of this patch you don't agree with,
send me back a modified one and i'll test it again.

i really hope that not all ALSA-supported h/w has issues like
this. the ability to function correctly in full duplex mode is
critical for all DAW software and much else besides.

--p

Index: trident.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/lowlevel/pci/trident.c,v
retrieving revision 1.147
diff -c -u -p -r1.147 trident.c
--- trident.c   2001/05/11 14:21:02     1.147
+++ trident.c   2001/12/05 03:24:31
@@ -982,7 +982,14 @@ static int snd_trident_capture_prepare(s
 
        // Set voice parameters
        voice->CSO = 0;
-       voice->ESO = (runtime->period_size * 2) - 1;    /* in samples */
+       
+       /* the +2 is a correction for a h/w problem. if not
+          used, the ESO interrupt is received before the capture pointer
+          has actually reached the ESO point. this causes errors in
+          the mid-level code.
+       */
+
+       voice->ESO = (runtime->period_size * 2) + 2 - 1; /* in samples */
        voice->CTRL = snd_trident_control_mode(substream);
        voice->FMC = 3;
        voice->RVol = 0x7f;
@@ -3337,19 +3344,20 @@ static void snd_trident_interrupt(int ir
                        if ((chn_int & mask) == 0)
                                continue;
                        voice = &trident->synth.voices[channel];
-                       delta = (int)stimer - (int)voice->stimer;
-                       if (delta > -32 && delta < 32) {
-                               trident->spurious_irq_count++;
+                       
+                       if (voice->pcm && voice->substream) {
+                               delta = (int)(stimer - voice->stimer);
+                               voice->stimer = stimer;
+
                                if (delta < 0)
                                        delta = -delta;
-                               if (trident->spurious_irq_max_delta < delta)
-                                       trident->spurious_irq_max_delta = delta;
-                               if (delta < -20 || delta > 20)
-                                       snd_printk("spurious interrupt detected: 
stimer = 0x%x, voice->stimer = 0x%x, delta = %i\n", stimer, voice->stimer, delta);
-                               continue;
-                       }
-                       voice->stimer = stimer;
-                       if (voice->pcm && voice->substream) {
+                               
+                               if (delta < voice->substream->runtime->period_size - 
+32) {
+                                       trident->spurious_irq_count++;
+                                       if (delta > trident->spurious_irq_max_delta)
+                                               trident->spurious_irq_max_delta = 
+delta;
+                                       continue;
+                               }
                                spin_unlock(&trident->reg_lock);
                                snd_pcm_period_elapsed(voice->substream);
                                spin_lock(&trident->reg_lock);

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to