Start of implementation of UpDown processing unit control.

This commit is contained in:
augustss 2000-01-16 09:32:56 +00:00
parent bfde45e89f
commit d50156f1bd
2 changed files with 61 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uaudio.c,v 1.15 2000/01/06 21:13:55 augustss Exp $ */
/* $NetBSD: uaudio.c,v 1.16 2000/01/16 09:32:56 augustss Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -209,6 +209,9 @@ static void uaudio_add_selector __P((struct uaudio_softc *sc,
usb_descriptor_t *v, usb_descriptor_t **dps));
static void uaudio_add_feature __P((struct uaudio_softc *sc,
usb_descriptor_t *v, usb_descriptor_t **dps));
static void uaudio_add_processing_updown
__P((struct uaudio_softc *sc,
usb_descriptor_t *v, usb_descriptor_t **dps));
static void uaudio_add_processing __P((struct uaudio_softc *sc,
usb_descriptor_t *v, usb_descriptor_t **dps));
static void uaudio_add_extension __P((struct uaudio_softc *sc,
@ -886,6 +889,46 @@ uaudio_add_feature(sc, v, dps)
}
}
void
uaudio_add_processing_updown(sc, v, dps)
struct uaudio_softc *sc;
usb_descriptor_t *v;
usb_descriptor_t **dps;
{
struct usb_audio_processing_unit *d =
(struct usb_audio_processing_unit *)v;
struct usb_audio_processing_unit_1 *d1 =
(struct usb_audio_processing_unit_1 *)&d->baSourceId[d->bNrInPins];
struct usb_audio_processing_unit_updown *ud =
(struct usb_audio_processing_unit_updown *)
&d1->bmControls[d1->bControlSize];
struct mixerctl mix;
int i;
DPRINTFN(2,("uaudio_add_processing_updown: bUnitId=%d bNrModes=%d\n",
d->bUnitId, ud->bNrModes));
if (!(d1->bmControls[0] & UA_PROC_MASK(UD_MODE_SELECT_CONTROL))) {
DPRINTF(("uaudio_add_processing_updown: no mode select\n"));
return;
}
mix.wIndex = MAKE(d->bUnitId, sc->sc_ac_iface);
mix.nchan = 1;
mix.wValue[0] = MAKE(UD_MODE_SELECT_CONTROL, 0);
mix.class = -1;
mix.type = MIX_ON_OFF; /* XXX */
mix.ctlunit = "";
sprintf(mix.ctlname, "pro%d-mode", d->bUnitId);
for (i = 0; i < ud->bNrModes; i++) {
DPRINTFN(2,("uaudio_add_processing_updown: i=%d bm=0x%x\n",
i, UGETW(ud->waModes[i])));
/* XXX */
}
uaudio_mixer_add_ctl(sc, &mix);
}
void
uaudio_add_processing(sc, v, dps)
struct uaudio_softc *sc;
@ -915,6 +958,8 @@ uaudio_add_processing(sc, v, dps)
switch(ptype) {
case UPDOWNMIX_PROCESS:
uaudio_add_processing_updown(sc, v, dps);
break;
case DOLBY_PROLOGIC_PROCESS:
case P3D_STEREO_EXTENDER_PROCESS:
case REVERBATION_PROCESS:

View File

@ -1,4 +1,4 @@
/* $NetBSD: uaudioreg.h,v 1.3 2000/01/06 21:13:56 augustss Exp $ */
/* $NetBSD: uaudioreg.h,v 1.4 2000/01/16 09:32:56 augustss Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -155,14 +155,14 @@ struct usb_audio_mixer_unit {
uByte bDescriptorSubtype;
uByte bUnitId;
uByte bNrInPins;
uByte baSourceId[255]; /* length is really bNrInPins */
uByte baSourceId[255]; /* [bNrInPins] */
/* struct usb_audio_mixer_unit_1 */
};
struct usb_audio_mixer_unit_1 {
uByte bNrChannels;
uWord wChannelConfig;
uByte iChannelNames;
uByte bmControls[255];
uByte bmControls[255]; /* [bNrChannels] */
/*uByte iMixer;*/
};
@ -173,7 +173,7 @@ struct usb_audio_selector_unit {
uByte bDescriptorSubtype;
uByte bUnitId;
uByte bNrInPins;
uByte baSourceId[255];
uByte baSourceId[255]; /* [bNrInPins] */
/* uByte iSelector; */
};
@ -197,7 +197,7 @@ struct usb_audio_processing_unit {
uByte bUnitId;
uWord wProcessType;
uByte bNrInPins;
uByte baSourceId[255];
uByte baSourceId[255]; /* [bNrInPins] */
/* struct usb_audio_processing_unit_1 */
};
struct usb_audio_processing_unit_1{
@ -205,9 +205,14 @@ struct usb_audio_processing_unit_1{
uWord wChannelConfig;
uByte iChannelNames;
uByte bControlSize;
uByte bmControls[255];
uByte bmControls[255]; /* [bControlSize] */
#define UA_PROC_ENABLE_MASK 1
/*uByte iProcessing;*/
};
struct usb_audio_processing_unit_updown {
uByte iProcessing;
uByte bNrModes;
uWord waModes[255]; /* [bNrModes] */
};
/* UDESCSUB_AC_EXTENSION */
@ -218,7 +223,7 @@ struct usb_audio_extension_unit {
uByte bUnitId;
uWord wExtensionCode;
uByte bNrInPins;
uByte baSourceId[255];
uByte baSourceId[255]; /* [bNrInPins] */
/* struct usb_audio_extension_unit_1 */
};
struct usb_audio_extension_unit_1 {
@ -226,7 +231,7 @@ struct usb_audio_extension_unit_1 {
uWord wChannelConfig;
uByte iChannelNames;
uByte bControlSize;
uByte bmControls[255];
uByte bmControls[255]; /* [bControlSize] */
#define UA_EXT_ENABLE_MASK 1
#define UA_EXT_ENABLE 1
/*uByte iExtension;*/
@ -278,6 +283,7 @@ struct usb_audio_extension_unit_1 {
#define FORMAT_TYPE_II 2
#define FORMAT_TYPE_III 3
#define UA_PROC_MASK(n) (1<< ((n)-1))
#define PROCESS_UNDEFINED 0
#define XX_ENABLE_CONTROL 1
#define UPDOWNMIX_PROCESS 1