Update of /cvsroot/alsa/alsa-kernel/usb
In directory sc8-pr-cvs1:/tmp/cvs-serv4642

Modified Files:
        usbaudio.c 
Log Message:
- added a workaround for M-Audio Audiophile USB.
- avoid async out and adaptive in if other methods are available.
- fixed the hw_constraint check for 24bit formats.


Index: usbaudio.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/usb/usbaudio.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- usbaudio.c  13 Nov 2003 11:20:20 -0000      1.68
+++ usbaudio.c  13 Nov 2003 12:36:44 -0000      1.69
@@ -966,6 +966,7 @@
 {
        struct list_head *p;
        struct audioformat *found = NULL;
+       int cur_attr = 0, attr;
 
        list_for_each(p, &subs->fmt_list) {
                struct audioformat *fp;
@@ -982,9 +983,37 @@
                        if (i >= fp->nr_rates)
                                continue;
                }
+               attr = fp->ep_attr & EP_ATTR_MASK;
+               if (! found) {
+                       found = fp;
+                       cur_attr = attr;
+                       continue;
+               }
+               /* avoid async out and adaptive in if the other method
+                * supports the same format.
+                * this is a workaround for the case like
+                * M-audio audiophile USB.
+                */
+               if (attr != cur_attr) {
+                       if ((attr == EP_ATTR_ASYNC &&
+                            subs->direction == SNDRV_PCM_STREAM_PLAYBACK) ||
+                           (attr == EP_ATTR_ADAPTIVE &&
+                            subs->direction == SNDRV_PCM_STREAM_CAPTURE))
+                               continue;
+                       if ((cur_attr == EP_ATTR_ASYNC &&
+                            subs->direction == SNDRV_PCM_STREAM_PLAYBACK) ||
+                           (cur_attr == EP_ATTR_ADAPTIVE &&
+                            subs->direction == SNDRV_PCM_STREAM_CAPTURE)) {
+                               found = fp;
+                               cur_attr = attr;
+                               continue;
+                       }
+               }
                /* find the format with the largest max. packet size */
-               if (! found || fp->maxpacksize > found->maxpacksize)
+               if (fp->maxpacksize > found->maxpacksize) {
                        found = fp;
+                       cur_attr = attr;
+               }
        }
        return found;
 }
@@ -1441,7 +1470,7 @@
                fp = list_entry(p, struct audioformat, list);
                if (! hw_check_valid_format(params, fp))
                        continue;
-               fbits |= (1UL << fp->format);
+               fbits |= (1ULL << fp->format);
        }
 
        oldbits[0] = fmt->bits[0];
@@ -1466,6 +1495,7 @@
        u32 channels[64];
        u32 rates[64];
        u32 cmaster, rmaster;
+       u32 rate_min = 0, rate_max = 0;
        struct list_head *p;
 
        memset(channels, 0, sizeof(channels));
@@ -1477,6 +1507,15 @@
                /* unconventional channels? */
                if (f->channels > 32)
                        return 1;
+               /* continuous rate min/max matches? */
+               if (f->rates & SNDRV_PCM_RATE_CONTINUOUS) {
+                       if (rate_min && f->rate_min != rate_min)
+                               return 1;
+                       if (rate_max && f->rate_max != rate_max)
+                               return 1;
+                       rate_min = f->rate_min;
+                       rate_max = f->rate_max;
+               }
                /* combination of continuous rates and fixed rates? */
                if (rates[f->format] & SNDRV_PCM_RATE_CONTINUOUS) {
                        if (f->rates != rates[f->format])
@@ -2020,10 +2059,20 @@
                        pcm_format = SNDRV_PCM_FORMAT_S8;
                        break;
                case 2:
-                       pcm_format = SNDRV_PCM_FORMAT_S16_LE;
+                       /* M-Audio audiophile USB workaround */
+                       if (dev->descriptor.idVendor == 0x0763 &&
+                           dev->descriptor.idProduct == 0x2003)
+                               pcm_format = SNDRV_PCM_FORMAT_S16_BE; /* grrr, big 
endian!! */
+                       else
+                               pcm_format = SNDRV_PCM_FORMAT_S16_LE;
                        break;
                case 3:
-                       pcm_format = SNDRV_PCM_FORMAT_S24_3LE;
+                       /* M-Audio audiophile USB workaround */
+                       if (dev->descriptor.idVendor == 0x0763 &&
+                           dev->descriptor.idProduct == 0x2003)
+                               pcm_format = SNDRV_PCM_FORMAT_S24_3BE; /* grrr, big 
endian!! */
+                       else
+                               pcm_format = SNDRV_PCM_FORMAT_S24_3LE;
                        break;
                case 4:
                        pcm_format = SNDRV_PCM_FORMAT_S32_LE;



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to