Author: janderwald
Date: Thu Nov 3 13:26:45 2016
New Revision: 73106
URL:
http://svn.reactos.org/svn/reactos?rev=73106&view=rev
Log:
[USBAUDIO]
- include controls from logical channels
- process selector unit descriptors
- automatic gain is KSNODETYPE_AGC
Modified:
trunk/reactos/drivers/usb/usbaudio/filter.c
trunk/reactos/drivers/usb/usbaudio/guid.c
trunk/reactos/drivers/usb/usbaudio/usbaudio.h
Modified: trunk/reactos/drivers/usb/usbaudio/filter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/filte…
==============================================================================
--- trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] Thu Nov 3 13:26:45 2016
@@ -326,7 +326,8 @@
PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR InputTerminalDescriptor;
PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR FeatureUnitDescriptor;
PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR MixerUnitDescriptor;
- ULONG NodeCount = 0;
+ PUSB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTOR SelectorUnitDescriptor;
+ ULONG NodeCount = 0, Length, Index;
ULONG DescriptorCount = 0;
UCHAR Value;
@@ -352,7 +353,15 @@
{
FeatureUnitDescriptor =
(PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR)InputTerminalDescriptor;
DescriptorCount++;
- Value = FeatureUnitDescriptor->bmaControls[0];
+
+ /* get controls from all channels*/
+ Value = 0;
+ Length = FeatureUnitDescriptor->bLength - 7;
+ for (Index = 0; Index < Length; Index++)
+ {
+ Value |= FeatureUnitDescriptor->bmaControls[Index];
+ }
+
if (Value & 0x01) /* MUTE*/
NodeCount++;
if (Value & 0x02) /* VOLUME */
@@ -369,14 +378,18 @@
NodeCount++;
if (Value & 0x80) /* DELAY */
NodeCount++;
-
- /* FIXME handle logical channels too */
}
else if (InputTerminalDescriptor->bDescriptorSubtype == 0x04 /*
MIXER_UNIT */)
{
MixerUnitDescriptor =
(PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR)InputTerminalDescriptor;
DescriptorCount++;
NodeCount += MixerUnitDescriptor->bNrInPins + 1; /*
KSNODETYPE_SUPERMIX for each source pin and KSNODETYPE_SUM for target */
+ }
+ else if (InputTerminalDescriptor->bDescriptorSubtype == 0x05 /*
SELECTOR_UNIT */)
+ {
+ SelectorUnitDescriptor =
(PUSB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTOR)InputTerminalDescriptor;
+ DescriptorCount++;
+ NodeCount++;
}
else
{
@@ -417,7 +430,7 @@
PKSFILTER_DESCRIPTOR FilterDescriptor)
{
PDEVICE_EXTENSION DeviceExtension;
- ULONG NodeCount, Index, DescriptorCount, StreamingTerminalIndex,
NonStreamingTerminalDescriptorCount, TotalTerminalDescriptorCount,
StreamingTerminalPinOffset, ControlDescriptorCount;
+ ULONG NodeCount, Index, DescriptorCount, StreamingTerminalIndex,
NonStreamingTerminalDescriptorCount, TotalTerminalDescriptorCount,
StreamingTerminalPinOffset, ControlDescriptorCount, Length;
UCHAR Value;
PUSB_INTERFACE_DESCRIPTOR Descriptor;
PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR InterfaceHeaderDescriptor;
@@ -426,6 +439,7 @@
PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR FeatureUnitDescriptor;
PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR MixerUnitDescriptor;
PUSB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR OutputTerminalDescriptor;
+ PUSB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTOR SelectorUnitDescriptor;
PKSNODE_DESCRIPTOR NodeDescriptors;
PNODE_CONTEXT NodeContext, PreviousNodeContext;
PKSTOPOLOGY_CONNECTION Connections;
@@ -558,7 +572,16 @@
else if (InputTerminalDescriptor->bDescriptorSubtype == 0x06 /*
FEATURE_UNIT*/)
{
FeatureUnitDescriptor =
(PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR)CommonDescriptor;
- Value = FeatureUnitDescriptor->bmaControls[0];
+
+ /* get controls from all channels*/
+ Value = 0;
+ Length = FeatureUnitDescriptor->bLength - 7;
+ for (Index = 0; Index < Length; Index++)
+ {
+ Value |= FeatureUnitDescriptor->bmaControls[Index];
+ }
+
+
if (Value & 0x01) /* MUTE*/
{
NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_MUTE;
@@ -651,8 +674,8 @@
if (Value & 0x40) /* AUTOMATIC GAIN */
{
-
NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE;
-
NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE;
+
NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_AGC;
+
NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_AGC;
NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable =
AllocFunction(sizeof(KSAUTOMATION_TABLE));
/* insert into node context*/
@@ -705,6 +728,19 @@
NodeContext[DescriptorCount].Descriptor = CommonDescriptor;
DescriptorCount++;
+ FilterDescriptor->NodeDescriptorsCount++;
+ }
+ else if (InputTerminalDescriptor->bDescriptorSubtype == 0x05 /*
SELECTOR UNIT */)
+ {
+ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type =
&KSNODETYPE_MUX;
+ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name =
&KSNODETYPE_MUX;
+
NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable =
AllocFunction(sizeof(KSAUTOMATION_TABLE));
+
+ /* insert into node context*/
+ NodeContext[DescriptorCount].Descriptor = CommonDescriptor;
+ NodeContext[DescriptorCount].NodeCount = 1;
+ NodeContext[DescriptorCount].Nodes[0] =
FilterDescriptor->NodeDescriptorsCount;
+ DescriptorCount++;
FilterDescriptor->NodeDescriptorsCount++;
}
else
@@ -850,6 +886,24 @@
Connections[FilterDescriptor->ConnectionsCount].ToNodePin
= 1 + Index;
Connections[FilterDescriptor->ConnectionsCount].ToNode =
NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount-1];
FilterDescriptor->ConnectionsCount++;
+ }
+ DescriptorCount++;
+ }
+ else if (InputTerminalDescriptor->bDescriptorSubtype == 0x05 /*
SELECTOR_UNIT */)
+ {
+ SelectorUnitDescriptor =
(PUSB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTOR)InputTerminalDescriptor;
+ for (Index = 0; Index < SelectorUnitDescriptor->bNrInPins;
Index++)
+ {
+ Value = SelectorUnitDescriptor->baSourceID[Index];
+ PreviousNodeContext = FindNodeContextWithId(NodeContext,
ControlDescriptorCount, Value);
+ if (PreviousNodeContext)
+ {
+
Connections[FilterDescriptor->ConnectionsCount].FromNode =
PreviousNodeContext->Nodes[PreviousNodeContext->NodeCount - 1];
+
Connections[FilterDescriptor->ConnectionsCount].FromNodePin = 0;
+
Connections[FilterDescriptor->ConnectionsCount].ToNodePin = 1;
+ Connections[FilterDescriptor->ConnectionsCount].ToNode
= NodeContext[DescriptorCount].Nodes[0];
+ FilterDescriptor->ConnectionsCount++;
+ }
}
DescriptorCount++;
}
Modified: trunk/reactos/drivers/usb/usbaudio/guid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/guid.…
==============================================================================
--- trunk/reactos/drivers/usb/usbaudio/guid.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbaudio/guid.c [iso-8859-1] Thu Nov 3 13:26:45 2016
@@ -15,6 +15,8 @@
DEFINE_GUID(KSNODETYPE_SUM, 0xDA441A60L, 0xC556, 0x11D0, 0x8A, 0x2B,
0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1);
DEFINE_GUID(KSNODETYPE_SUPERMIX, 0xE573ADC0L, 0xC555, 0x11D0, 0x8A, 0x2B,
0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1);
DEFINE_GUID(KSNODETYPE_VOLUME, 0x3A5ACC00L, 0xC557, 0x11D0, 0x8A, 0x2B,
0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1);
+DEFINE_GUID(KSNODETYPE_MUX, 0x2CEAF780L, 0xC556, 0x11D0, 0x8A, 0x2B,
0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1);
+DEFINE_GUID(KSNODETYPE_AGC, 0xE88C9BA0L, 0xC557, 0x11D0, 0x8A, 0x2B,
0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1);
DEFINE_GUID(KSCOMPONENTID_USBAUDIO, 0x8F1275F0L, 0x26E9, 0x4264, 0xBA, 0x4D,
0x39, 0xFF, 0xF0, 0x1D, 0x94, 0xAA);
DEFINE_GUID(KSPROPSETID_Audio, 0x45FFAAA0L, 0x6E1B, 0x11D0, 0xBC, 0xF2,
0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
/* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */
Modified: trunk/reactos/drivers/usb/usbaudio/usbaudio.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/usbau…
==============================================================================
--- trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] Thu Nov 3 13:26:45 2016
@@ -128,6 +128,17 @@
UCHAR bmControls;
UCHAR iMixer;
}USB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR, *PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR;
+
+typedef struct
+{
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+ UCHAR bDescriptorSubtype;
+ UCHAR bUnitID;
+ UCHAR bNrInPins;
+ UCHAR baSourceID[1];
+ UCHAR iSelector;
+}USB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTOR,
*PUSB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTOR;
typedef struct