Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Implement the ENABLE control for processig units.



details:   https://anonhg.NetBSD.org/src/rev/bdabe7cb0d81
branches:  trunk
changeset: 480208:bdabe7cb0d81
user:      augustss <augustss%NetBSD.org@localhost>
date:      Thu Jan 06 21:13:55 2000 +0000

description:
Implement the ENABLE control for processig units.

diffstat:

 sys/dev/usb/uaudio.c    |  41 ++++++++++++++++++++++++++++++++++-------
 sys/dev/usb/uaudioreg.h |  35 +++++++++++++++++++++++++++++++++--
 2 files changed, 67 insertions(+), 9 deletions(-)

diffs (125 lines):

diff -r 11dd8473ddc2 -r bdabe7cb0d81 sys/dev/usb/uaudio.c
--- a/sys/dev/usb/uaudio.c      Thu Jan 06 21:03:34 2000 +0000
+++ b/sys/dev/usb/uaudio.c      Thu Jan 06 21:13:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uaudio.c,v 1.14 1999/12/06 21:06:59 augustss Exp $     */
+/*     $NetBSD: uaudio.c,v 1.15 2000/01/06 21:13:55 augustss Exp $     */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -892,14 +892,41 @@
        usb_descriptor_t *v;
        usb_descriptor_t **dps;
 {
-#ifdef UAUDIO_DEBUG
        struct usb_audio_processing_unit *d = 
-               (struct usb_audio_processing_unit *)v;
+           (struct usb_audio_processing_unit *)v;
+       struct usb_audio_processing_unit_1 *d1 =
+           (struct usb_audio_processing_unit_1 *)&d->baSourceId[d->bNrInPins];
+       int ptype = UGETW(d->wProcessType);
+       struct mixerctl mix;
+
+       DPRINTFN(2,("uaudio_add_processing: wProcessType=%d bUnitId=%d "
+                   "bNrInPins=%d\n", ptype, d->bUnitId, d->bNrInPins));
 
-       DPRINTFN(2,("uaudio_add_processing: bUnitId=%d bNrInPins=%d\n",
-                   d->bUnitId, d->bNrInPins));
-       printf("uaudio_add_processing: NOT IMPLEMENTED\n");
+       if (d1->bmControls[0] & UA_PROC_ENABLE_MASK) {
+               mix.wIndex = MAKE(d->bUnitId, sc->sc_ac_iface);
+               mix.nchan = 1;
+               mix.wValue[0] = MAKE(XX_ENABLE_CONTROL, 0);
+               mix.class = -1;
+               mix.type = MIX_ON_OFF;
+               mix.ctlunit = "";
+               sprintf(mix.ctlname, "pro%d.%d-enable", d->bUnitId, ptype);
+               uaudio_mixer_add_ctl(sc, &mix);
+       }
+
+       switch(ptype) {
+       case UPDOWNMIX_PROCESS:
+       case DOLBY_PROLOGIC_PROCESS:
+       case P3D_STEREO_EXTENDER_PROCESS:
+       case REVERBATION_PROCESS:
+       case CHORUS_PROCESS:
+       case DYN_RANGE_COMP_PROCESS:
+       default:
+#ifdef UAUDIO_DEBUG
+               printf("uaudio_add_processing: unit %d, type=%d not impl.\n",
+                      d->bUnitId, ptype);
 #endif
+               break;
+       }
 }
 
 void
@@ -917,7 +944,7 @@
        DPRINTFN(2,("uaudio_add_extension: bUnitId=%d bNrInPins=%d\n",
                    d->bUnitId, d->bNrInPins));
 
-       if (d1->bmControls[0] & (1 << UA_EXT_ENABLE)) {
+       if (d1->bmControls[0] & UA_EXT_ENABLE_MASK) {
                mix.wIndex = MAKE(d->bUnitId, sc->sc_ac_iface);
                mix.nchan = 1;
                mix.wValue[0] = MAKE(UA_EXT_ENABLE, 0);
diff -r 11dd8473ddc2 -r bdabe7cb0d81 sys/dev/usb/uaudioreg.h
--- a/sys/dev/usb/uaudioreg.h   Thu Jan 06 21:03:34 2000 +0000
+++ b/sys/dev/usb/uaudioreg.h   Thu Jan 06 21:13:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uaudioreg.h,v 1.2 1999/10/13 20:13:29 augustss Exp $   */
+/*     $NetBSD: uaudioreg.h,v 1.3 2000/01/06 21:13:56 augustss Exp $   */
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -206,6 +206,7 @@
        uByte           iChannelNames;
        uByte           bControlSize;
        uByte           bmControls[255];
+#define UA_PROC_ENABLE_MASK 1
        /*uByte         iProcessing;*/
 };
 
@@ -226,7 +227,8 @@
        uByte           iChannelNames;
        uByte           bControlSize;
        uByte           bmControls[255];
-#define UA_EXT_ENABLE 0
+#define UA_EXT_ENABLE_MASK 1
+#define UA_EXT_ENABLE 1
        /*uByte         iExtension;*/
 };
 
@@ -275,3 +277,32 @@
 #define FORMAT_TYPE_I 1
 #define FORMAT_TYPE_II 2
 #define FORMAT_TYPE_III 3
+
+#define PROCESS_UNDEFINED              0
+#define  XX_ENABLE_CONTROL                     1
+#define UPDOWNMIX_PROCESS              1
+#define  UD_ENABLE_CONTROL                     1
+#define  UD_MODE_SELECT_CONTROL                        2
+#define DOLBY_PROLOGIC_PROCESS         2
+#define  DP_ENABLE_CONTROL                     1
+#define  DP_MODE_SELECT_CONTROL                        2
+#define P3D_STEREO_EXTENDER_PROCESS    3
+#define  P3D_ENABLE_CONTROL                    1
+#define  P3D_SPACIOUSNESS_CONTROL              2
+#define REVERBATION_PROCESS            4
+#define  RV_ENABLE_CONTROL                     1
+#define  RV_LEVEL_CONTROL                      2
+#define  RV_TIME_CONTROL                       3
+#define  RV_FEEDBACK_CONTROL                   4
+#define CHORUS_PROCESS                 5
+#define  CH_ENABLE_CONTROL                     1
+#define  CH_LEVEL_CONTROL                      2
+#define  CH_RATE_CONTROL                       3
+#define  CH_DEPTH_CONTROL                      4
+#define DYN_RANGE_COMP_PROCESS         6
+#define  DR_ENABLE_CONTROL                     1
+#define  DR_COMPRESSION_RATE_CONTROL           2
+#define  DR_MAXAMPL_CONTROL                    3
+#define  DR_THRESHOLD_CONTROL                  4
+#define  DR_ATTACK_TIME_CONTROL                        5
+#define  DR_RELEASE_TIME_CONTROL               6



Home | Main Index | Thread Index | Old Index