Author: janderwald
Date: Mon Dec 6 16:00:06 2010
New Revision: 49965
URL:
http://svn.reactos.org/svn/reactos?rev=49965&view=rev
Log:
[AUDIO-BRINGUP]
- Implement support for retrieving mux mixer controls
- Implement support for on/off controls
- Store logical pins for nodes connecting to another nodes. Currently not yet used
Modified:
branches/audio-bringup/lib/drivers/sound/mmixer/controls.c
branches/audio-bringup/lib/drivers/sound/mmixer/priv.h
branches/audio-bringup/lib/drivers/sound/mmixer/topology.c
Modified: branches/audio-bringup/lib/drivers/sound/mmixer/controls.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmixer/controls.c [iso-8859-1] (original)
+++ branches/audio-bringup/lib/drivers/sound/mmixer/controls.c [iso-8859-1] Mon Dec 6
16:00:06 2010
@@ -53,19 +53,7 @@
MixerControl->dwControlType = MMixerGetControlTypeFromTopologyNode(NodeType);
MixerControl->fdwControl = MIXERCONTROL_CONTROLF_UNIFORM; /* FIXME */
- MixerControl->cMultipleItems = 0; /* FIXME */
-
- if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_MUTE)
- {
- MixerControl->Bounds.dwMinimum = 0;
- MixerControl->Bounds.dwMaximum = 1;
- }
- else if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_VOLUME)
- {
- MixerControl->Bounds.dwMinimum = 0;
- MixerControl->Bounds.dwMaximum = 0xFFFF;
- MixerControl->Metrics.cSteps = 0xC0; /* FIXME */
- }
+ MixerControl->cMultipleItems = 0;
/* setup request to retrieve name */
Node.NodeId = NodeIndex;
@@ -104,28 +92,46 @@
}
MixerInfo->ControlId++;
-#if 0
+
if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_MUX)
{
- KSNODEPROPERTY Property;
- ULONG PinId = 2;
-
- /* setup the request */
- RtlZeroMemory(&Property, sizeof(KSNODEPROPERTY));
-
- Property.NodeId = NodeIndex;
- Property.Property.Id = KSPROPERTY_AUDIO_MUX_SOURCE;
- Property.Property.Flags = KSPROPERTY_TYPE_SET;
- Property.Property.Set = KSPROPSETID_Audio;
-
- /* get node volume level info */
- Status = MixerContext->Control(hDevice, IOCTL_KS_PROPERTY,
(PVOID)&Property, sizeof(KSNODEPROPERTY), (PVOID)&PinId, sizeof(ULONG),
&BytesReturned);
-
- DPRINT1("Status %x NodeIndex %u PinId %u\n", Status, NodeIndex,
PinId);
- //DbgBreakPoint();
- }else
-#endif
- if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_VOLUME)
+ ULONG NodesCount;
+ PULONG Nodes;
+
+ /* allocate topology nodes array */
+ Status = MMixerAllocateTopologyNodeArray(MixerContext, Topology, &Nodes);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* out of memory */
+ return STATUS_NO_MEMORY;
+ }
+
+ /* get connected node count */
+ MMixerGetNextNodesFromNodeIndex(MixerContext, Topology, NodeIndex, TRUE,
&NodesCount, Nodes);
+
+ /* TODO */
+ MixerContext->Free(Nodes);
+
+ /* setup mux bounds */
+ MixerControl->Bounds.dwMinimum = 0;
+ MixerControl->Bounds.dwMaximum = NodesCount - 1;
+ MixerControl->Metrics.dwReserved[0] = NodesCount;
+ MixerControl->cMultipleItems = NodesCount;
+ MixerControl->fdwControl |= MIXERCONTROL_CONTROLF_MULTIPLE;
+ }
+ else if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_MUTE)
+ {
+ MixerControl->Bounds.dwMinimum = 0;
+ MixerControl->Bounds.dwMaximum = 1;
+ }
+ else if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_ONOFF)
+ {
+ /* only needs to set bounds */
+ MixerControl->Bounds.dwMinimum = 0;
+ MixerControl->Bounds.dwMaximum = 1;
+ }
+ else if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_VOLUME)
{
KSNODEPROPERTY_AUDIO_CHANNEL Property;
ULONG Length;
@@ -133,6 +139,10 @@
PKSPROPERTY_MEMBERSHEADER Members;
PKSPROPERTY_STEPPING_LONG Range;
+ MixerControl->Bounds.dwMinimum = 0;
+ MixerControl->Bounds.dwMaximum = 0xFFFF;
+ MixerControl->Metrics.cSteps = 0xC0; /* FIXME */
+
Length = sizeof(KSPROPERTY_DESCRIPTION) + sizeof(KSPROPERTY_MEMBERSHEADER) +
sizeof(KSPROPERTY_STEPPING_LONG);
Desc = (PKSPROPERTY_DESCRIPTION)MixerContext->Alloc(Length);
ASSERT(Desc);
@@ -142,7 +152,7 @@
Property.NodeProperty.NodeId = NodeIndex;
Property.NodeProperty.Property.Id = KSPROPERTY_AUDIO_VOLUMELEVEL;
- Property.NodeProperty.Property.Flags = KSPROPERTY_TYPE_BASICSUPPORT;
+ Property.NodeProperty.Property.Flags = KSPROPERTY_TYPE_BASICSUPPORT |
KSPROPERTY_TYPE_TOPOLOGY;
Property.NodeProperty.Property.Set = KSPROPSETID_Audio;
/* get node volume level info */
Modified: branches/audio-bringup/lib/drivers/sound/mmixer/priv.h
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmixer/priv.h [iso-8859-1] (original)
+++ branches/audio-bringup/lib/drivers/sound/mmixer/priv.h [iso-8859-1] Mon Dec 6
16:00:06 2010
@@ -27,6 +27,7 @@
ULONG NodeConnectedFromCount;
struct __TOPOLOGY_NODE__ ** NodeConnectedFrom;
+ PULONG LogicalPinNodeConnectedFrom;
ULONG PinConnectedFromCount;
PULONG PinConnectedFrom;
@@ -53,6 +54,7 @@
ULONG PinConnectedToCount;
PULONG PinConnectedTo;
+
ULONG Visited;
}PIN, *PPIN;
Modified: branches/audio-bringup/lib/drivers/sound/mmixer/topology.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmixer/topology.c [iso-8859-1] (original)
+++ branches/audio-bringup/lib/drivers/sound/mmixer/topology.c [iso-8859-1] Mon Dec 6
16:00:06 2010
@@ -264,7 +264,9 @@
{
PTOPOLOGY_NODE InNode, OutNode;
PTOPOLOGY_NODE * NewNodes;
+ PULONG NewLogicalPinNodeConnectedFrom;
ULONG Count;
+ ULONG LogicalPinId;
/* sanity checks */
ASSERT(Topology->TopologyNodesCount > Connection->ToNode);
@@ -274,6 +276,9 @@
InNode = &Topology->TopologyNodes[Connection->FromNode];
OutNode = &Topology->TopologyNodes[Connection->ToNode];
+ /* get logical pin node id */
+ LogicalPinId = Connection->ToNodePin;
+
/* get existing count */
Count = OutNode->NodeConnectedFromCount;
@@ -286,20 +291,41 @@
return MM_STATUS_NO_MEMORY;
}
+ /* allocate logical pin nodes array */
+ NewLogicalPinNodeConnectedFrom = MixerContext->Alloc((Count + 1) *
sizeof(ULONG));
+ if (!NewLogicalPinNodeConnectedFrom)
+ {
+ /* out of memory */
+ MixerContext->Free(NewNodes);
+ return MM_STATUS_NO_MEMORY;
+ }
+
if (Count)
{
/* copy existing nodes */
MixerContext->Copy(NewNodes, OutNode->NodeConnectedFrom, sizeof(PTOPOLOGY)
* Count);
+ /* copy existing logical pin node array */
+ MixerContext->Copy(NewLogicalPinNodeConnectedFrom,
OutNode->LogicalPinNodeConnectedFrom, sizeof(ULONG) * Count);
+
/* release old nodes array */
MixerContext->Free(OutNode->NodeConnectedFrom);
+
+ /* release old logical pin node array */
+ MixerContext->Free(OutNode->LogicalPinNodeConnectedFrom);
}
/* add new topology node */
NewNodes[OutNode->NodeConnectedFromCount] = InNode;
+ /* add logical node id */
+ NewLogicalPinNodeConnectedFrom[OutNode->NodeConnectedFromCount] = LogicalPinId;
+
/* replace old nodes array */
OutNode->NodeConnectedFrom = NewNodes;
+
+ /* replace old logical pin node array */
+ OutNode->LogicalPinNodeConnectedFrom = NewLogicalPinNodeConnectedFrom;
/* increment nodes count */
OutNode->NodeConnectedFromCount++;