MMixerAddMixerControl(
IN PMIXER_CONTEXT MixerContext,
IN LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN PTOPOLOGY Topology,
IN ULONG NodeIndex,
- IN LPMIXERLINE_EXT MixerLine,
- OUT LPMIXERCONTROLW MixerControl)
+ IN LPMIXERLINE_EXT MixerLine)
{
LPGUID NodeType;
KSP_NODE Node;
ULONG BytesReturned;
MIXER_STATUS Status;
LPWSTR Name;
+ LPMIXERCONTROL_EXT MixerControl;
+
+ /* allocate mixer control */
+ MixerControl = MixerContext->Alloc(sizeof(MIXERCONTROL_EXT));
+ if (!MixerControl)
+ {
+ /* no memory */
+ return MM_STATUS_NO_MEMORY;
+ }
+
/* initialize mixer control */
- MixerControl->cbStruct = sizeof(MIXERCONTROLW);
- MixerControl->dwControlID = MixerInfo->ControlId;
+ MixerControl->hDevice = hMixer;
+ MixerControl->NodeID = NodeIndex;
+ MixerControl->ExtraData = NULL;
+
+ MixerControl->Control.cbStruct = sizeof(MIXERCONTROLW);
+ MixerControl->Control.dwControlID = MixerInfo->ControlId;
/* get node type */
NodeType = MMixerGetNodeTypeFromTopology(Topology, NodeIndex);
/* store control type */
- MixerControl->dwControlType = MMixerGetControlTypeFromTopologyNode(NodeType);
+ MixerControl->Control.dwControlType = MMixerGetControlTypeFromTopologyNode(NodeType);
- MixerControl->fdwControl = MIXERCONTROL_CONTROLF_UNIFORM; /* FIXME */
- MixerControl->cMultipleItems = 0;
+ MixerControl->Control.fdwControl = MIXERCONTROL_CONTROLF_UNIFORM; /* FIXME */
+ MixerControl->Control.cMultipleItems = 0;
/* setup request to retrieve name */
Node.NodeId = NodeIndex;
Node.Reserved = 0;
/* get node name size */
- Status = MixerContext->Control(MixerInfo->hMixer, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), NULL, 0, &BytesReturned);
+ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), NULL, 0, &BytesReturned);
if (Status == MM_STATUS_MORE_ENTRIES)
{
}
/* get node name */
- Status = MixerContext->Control(MixerInfo->hMixer, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), (LPVOID)Name, BytesReturned, &BytesReturned);
+ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), (LPVOID)Name, BytesReturned, &BytesReturned);
if (Status == MM_STATUS_SUCCESS)
{
- MixerContext->Copy(MixerControl->szShortName, Name, (min(MIXER_SHORT_NAME_CHARS, wcslen(Name)+1)) * sizeof(WCHAR));
- MixerControl->szShortName[MIXER_SHORT_NAME_CHARS-1] = L'\0';
+ MixerContext->Copy(MixerControl->Control.szShortName, Name, (min(MIXER_SHORT_NAME_CHARS, wcslen(Name)+1)) * sizeof(WCHAR));
+ MixerControl->Control.szShortName[MIXER_SHORT_NAME_CHARS-1] = L'\0';
- MixerContext->Copy(MixerControl->szName, Name, (min(MIXER_LONG_NAME_CHARS, wcslen(Name)+1)) * sizeof(WCHAR));
- MixerControl->szName[MIXER_LONG_NAME_CHARS-1] = L'\0';
+ MixerContext->Copy(MixerControl->Control.szName, Name, (min(MIXER_LONG_NAME_CHARS, wcslen(Name)+1)) * sizeof(WCHAR));
+ MixerControl->Control.szName[MIXER_LONG_NAME_CHARS-1] = L'\0';
}
/* free name buffer */
MixerContext->Free(Name);
}
+ /* increment control count */
MixerInfo->ControlId++;
- if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_MUX)
+ /* insert control */
+ InsertTailList(&MixerLine->ControlsList, &MixerControl->Entry);
+
+ if (MixerControl->Control.dwControlType == MIXERCONTROL_CONTROLTYPE_MUX)
{
ULONG NodesCount;
PULONG Nodes;
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;
+ MixerControl->Control.Bounds.dwMinimum = 0;
+ MixerControl->Control.Bounds.dwMaximum = NodesCount - 1;
+ MixerControl->Control.Metrics.dwReserved[0] = NodesCount;
+ MixerControl->Control.cMultipleItems = NodesCount;
+ MixerControl->Control.fdwControl |= MIXERCONTROL_CONTROLF_MULTIPLE;
}
- else if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_MUTE)
+ else if (MixerControl->Control.dwControlType == MIXERCONTROL_CONTROLTYPE_MUTE)
{
- MixerControl->Bounds.dwMinimum = 0;
- MixerControl->Bounds.dwMaximum = 1;
+ MixerControl->Control.Bounds.dwMinimum = 0;
+ MixerControl->Control.Bounds.dwMaximum = 1;
}
- else if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_ONOFF)
+ else if (MixerControl->Control.dwControlType == MIXERCONTROL_CONTROLTYPE_ONOFF)
{
/* only needs to set bounds */
- MixerControl->Bounds.dwMinimum = 0;
- MixerControl->Bounds.dwMaximum = 1;
+ MixerControl->Control.Bounds.dwMinimum = 0;
+ MixerControl->Control.Bounds.dwMaximum = 1;
}
- else if (MixerControl->dwControlType == MIXERCONTROL_CONTROLTYPE_VOLUME)
+ else if (MixerControl->Control.dwControlType == MIXERCONTROL_CONTROLTYPE_VOLUME)
{
KSNODEPROPERTY_AUDIO_CHANNEL Property;
ULONG Length;
PKSPROPERTY_MEMBERSHEADER Members;
PKSPROPERTY_STEPPING_LONG Range;
- MixerControl->Bounds.dwMinimum = 0;
- MixerControl->Bounds.dwMaximum = 0xFFFF;
- MixerControl->Metrics.cSteps = 0xC0; /* FIXME */
+ MixerControl->Control.Bounds.dwMinimum = 0;
+ MixerControl->Control.Bounds.dwMaximum = 0xFFFF;
+ MixerControl->Control.Metrics.cSteps = 0xC0; /* FIXME */
Length = sizeof(KSPROPERTY_DESCRIPTION) + sizeof(KSPROPERTY_MEMBERSHEADER) + sizeof(KSPROPERTY_STEPPING_LONG);
Desc = (PKSPROPERTY_DESCRIPTION)MixerContext->Alloc(Length);
Property.NodeProperty.Property.Set = KSPROPSETID_Audio;
/* get node volume level info */
- Status = MixerContext->Control(MixerInfo->hMixer, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSNODEPROPERTY_AUDIO_CHANNEL), Desc, Length, &BytesReturned);
+ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSNODEPROPERTY_AUDIO_CHANNEL), Desc, Length, &BytesReturned);
if (Status == MM_STATUS_SUCCESS)
{
Steps = MaxRange / Range->SteppingDelta + 1;
/* store mixer control info there */
- VolumeData->Header.dwControlID = MixerControl->dwControlID;
+ VolumeData->Header.dwControlID = MixerControl->Control.dwControlID;
VolumeData->SignedMaximum = Range->Bounds.SignedMaximum;
VolumeData->SignedMinimum = Range->Bounds.SignedMinimum;
VolumeData->SteppingDelta = Range->SteppingDelta;
VolumeData->Values[Index] = Value;
Value += Range->SteppingDelta;
}
- InsertTailList(&MixerLine->LineControlsExtraData, &VolumeData->Header.Entry);
+ MixerControl->ExtraData = VolumeData;
}
}
MixerContext->Free(Desc);
}
- DPRINT("Status %x Name %S\n", Status, MixerControl->szName);
+ DPRINT("Status %x Name %S\n", Status, MixerControl->Control.szName);
return MM_STATUS_SUCCESS;
}
/* initialize mixer destination line */
DestinationLine->Line.cbStruct = sizeof(MIXERLINEW);
- DestinationLine->Line.dwSource = MAXULONG;
+ DestinationLine->Line.cChannels = 2; /* FIXME */
+ DestinationLine->Line.cConnections = 0;
+ DestinationLine->Line.cControls = 0;
+ DestinationLine->Line.dwComponentType = (bInputMixer == 0 ? MIXERLINE_COMPONENTTYPE_DST_SPEAKERS : MIXERLINE_COMPONENTTYPE_DST_WAVEIN);
+ DestinationLine->Line.dwDestination = MixerInfo->MixCaps.cDestinations;
DestinationLine->Line.dwLineID = MixerInfo->MixCaps.cDestinations + DESTINATION_LINE;
- DestinationLine->Line.fdwLine = MIXERLINE_LINEF_ACTIVE;
+ DestinationLine->Line.dwSource = MAXULONG;
DestinationLine->Line.dwUser = 0;
- DestinationLine->Line.dwDestination = MixerInfo->MixCaps.cDestinations;
- DestinationLine->Line.dwComponentType = (bInputMixer == 0 ? MIXERLINE_COMPONENTTYPE_DST_SPEAKERS : MIXERLINE_COMPONENTTYPE_DST_WAVEIN);
- DestinationLine->Line.cChannels = 2; /* FIXME */
+ DestinationLine->Line.fdwLine = MIXERLINE_LINEF_ACTIVE;
+
if (LineName)
{
wcscpy(DestinationLine->Line.Target.szPname, MixerInfo->MixCaps.szPname);
/* initialize extra line */
- InitializeListHead(&DestinationLine->LineControlsExtraData);
+ InitializeListHead(&DestinationLine->ControlsList);
/* insert into mixer info */
InsertTailList(&MixerInfo->LineList, &DestinationLine->Entry);
MMixerGetPinName(
IN PMIXER_CONTEXT MixerContext,
IN LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN ULONG PinId,
IN OUT LPWSTR * OutBuffer)
{
Pin.Property.Id = KSPROPERTY_PIN_NAME;
/* try get pin name size */
- Status = MixerContext->Control(MixerInfo->hMixer, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), NULL, 0, &BytesReturned);
+ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), NULL, 0, &BytesReturned);
/* check if buffer overflowed */
if (Status == MM_STATUS_MORE_ENTRIES)
}
/* try get pin name */
- Status = MixerContext->Control(MixerInfo->hMixer, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), (PVOID)Buffer, BytesReturned, &BytesReturned);
+ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSP_PIN), (PVOID)Buffer, BytesReturned, &BytesReturned);
if (Status != MM_STATUS_SUCCESS)
{
/* failed to get pin name */
MMixerBuildMixerDestinationLine(
IN PMIXER_CONTEXT MixerContext,
IN OUT LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN ULONG PinId,
IN ULONG bInput)
{
MIXER_STATUS Status;
/* try get pin name */
- Status = MMixerGetPinName(MixerContext, MixerInfo, PinId, &PinName);
+ Status = MMixerGetPinName(MixerContext, MixerInfo, hMixer, PinId, &PinName);
if (Status == MM_STATUS_SUCCESS)
{
/* create mixer destination line */
MMixerGetChannelCountEnhanced(
IN PMIXER_CONTEXT MixerContext,
IN LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN ULONG NodeId,
OUT PULONG MaxChannels)
{
/* get description */
- Status = MixerContext->Control(MixerInfo->hMixer, IOCTL_KS_PROPERTY, (PVOID)&Request, sizeof(KSP_NODE), (PVOID)&Description, sizeof(KSPROPERTY_DESCRIPTION), &BytesReturned);
+ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Request, sizeof(KSP_NODE), (PVOID)&Description, sizeof(KSPROPERTY_DESCRIPTION), &BytesReturned);
if (Status == MM_STATUS_SUCCESS)
{
if (Description.DescriptionSize >= sizeof(KSPROPERTY_DESCRIPTION) + sizeof(KSPROPERTY_MEMBERSHEADER) && (Description.MembersListCount > 0))
}
/* get description */
- Status = MixerContext->Control(MixerInfo->hMixer, IOCTL_KS_PROPERTY, (PVOID)&Request, sizeof(KSP_NODE), (PVOID)NewDescription, Description.DescriptionSize, &BytesReturned);
+ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Request, sizeof(KSP_NODE), (PVOID)NewDescription, Description.DescriptionSize, &BytesReturned);
if (Status == MM_STATUS_SUCCESS)
{
/* get header */
MMixerGetChannelCountLegacy(
IN PMIXER_CONTEXT MixerContext,
IN LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN ULONG NodeId,
OUT PULONG MaxChannels)
{
do
{
/* get channel volume */
- Status = MixerContext->Control(MixerInfo->hMixer, IOCTL_KS_PROPERTY, (PVOID)&Channel, sizeof(KSNODEPROPERTY_AUDIO_CHANNEL), (PVOID)&Volume, sizeof(LONG), &BytesReturned);
+ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Channel, sizeof(KSNODEPROPERTY_AUDIO_CHANNEL), (PVOID)&Volume, sizeof(LONG), &BytesReturned);
if (Status != MM_STATUS_SUCCESS)
break;
MMixerGetMaxChannelsForNode(
IN PMIXER_CONTEXT MixerContext,
IN LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN ULONG NodeId,
OUT PULONG MaxChannels)
{
MIXER_STATUS Status;
/* try to get it enhanced */
- Status = MMixerGetChannelCountEnhanced(MixerContext, MixerInfo, NodeId, MaxChannels);
+ Status = MMixerGetChannelCountEnhanced(MixerContext, MixerInfo, hMixer, NodeId, MaxChannels);
if (Status != MM_STATUS_SUCCESS)
{
/* get it old-fashioned way */
- MMixerGetChannelCountLegacy(MixerContext, MixerInfo, NodeId, MaxChannels);
+ MMixerGetChannelCountLegacy(MixerContext, MixerInfo, hMixer, NodeId, MaxChannels);
}
}
MMixerAddMixerControlsToMixerLineByNodeIndexArray(
IN PMIXER_CONTEXT MixerContext,
IN LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN PTOPOLOGY Topology,
IN OUT LPMIXERLINE_EXT DstLine,
IN ULONG NodesCount,
LPGUID NodeType;
ULONG MaxChannels;
- /* store nodes array */
- DstLine->NodeIds = Nodes;
-
- /* allocate MIXERCONTROLSW array */
- DstLine->LineControls = MixerContext->Alloc(NodesCount * sizeof(MIXERCONTROLW));
-
- if (!DstLine->LineControls)
- {
- /* out of memory */
- return MM_STATUS_NO_MEMORY;
- }
-
/* initialize control count */
Count = 0;
if (IsEqualGUIDAligned(NodeType, &KSNODETYPE_VOLUME))
{
/* calculate maximum channel count for node */
- MMixerGetMaxChannelsForNode(MixerContext, MixerInfo, Nodes[Index], &MaxChannels);
+ MMixerGetMaxChannelsForNode(MixerContext, MixerInfo, hMixer, Nodes[Index], &MaxChannels);
DPRINT("NodeId %lu MaxChannels %lu Line %S Id %lu\n", Nodes[Index], MaxChannels, DstLine->Line.szName, DstLine->Line.dwLineID);
/* calculate maximum channels */
DstLine->Line.cChannels = min(DstLine->Line.cChannels, MaxChannels);
}
-
/* now add the mixer control */
- Status = MMixerAddMixerControl(MixerContext, MixerInfo, Topology, Nodes[Index], DstLine, &DstLine->LineControls[Count]);
+ Status = MMixerAddMixerControl(MixerContext, MixerInfo, hMixer, Topology, Nodes[Index], DstLine);
if (Status == MM_STATUS_SUCCESS)
{
MMixerGetComponentAndTargetType(
IN PMIXER_CONTEXT MixerContext,
IN OUT LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN ULONG PinId,
OUT PULONG ComponentType,
OUT PULONG TargetType)
PKSPIN_PHYSICALCONNECTION Connection;
/* first dataflow type */
- Status = MMixerGetPinDataFlowAndCommunication(MixerContext, MixerInfo->hMixer, PinId, &DataFlow, &Communication);
+ Status = MMixerGetPinDataFlowAndCommunication(MixerContext, hMixer, PinId, &DataFlow, &Communication);
if (Status != MM_STATUS_SUCCESS)
{
/* get pin category */
- Status = MixerContext->Control(MixerInfo->hMixer, IOCTL_KS_PROPERTY, (PVOID)&Request, sizeof(KSP_PIN), &Guid, sizeof(GUID), &BytesReturned);
+ Status = MixerContext->Control(hMixer, IOCTL_KS_PROPERTY, (PVOID)&Request, sizeof(KSP_PIN), &Guid, sizeof(GUID), &BytesReturned);
if (Status != MM_STATUS_SUCCESS)
{
/* failed to get dataflow */
}
/* check if it has a physical connection */
- Status = MMixerGetPhysicalConnection(MixerContext, MixerInfo->hMixer, PinId, &Connection);
+ Status = MMixerGetPhysicalConnection(MixerContext, hMixer, PinId, &Connection);
if (Status == MM_STATUS_SUCCESS)
{
/* pin is a brige pin */
MMixerBuildMixerSourceLine(
IN PMIXER_CONTEXT MixerContext,
IN OUT LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN PTOPOLOGY Topology,
IN ULONG PinId,
IN ULONG NodesCount,
ULONG ComponentType, TargetType;
/* get component and target type */
- Status = MMixerGetComponentAndTargetType(MixerContext, MixerInfo, PinId, &ComponentType, &TargetType);
+ Status = MMixerGetComponentAndTargetType(MixerContext, MixerInfo, hMixer, PinId, &ComponentType, &TargetType);
if (Status != MM_STATUS_SUCCESS)
{
/* failed to get component status */
ASSERT(DstLine);
/* initialize mixer src line */
- SrcLine->hDevice = MixerInfo->hMixer;
SrcLine->PinId = PinId;
- SrcLine->NodeIds = Nodes;
/* initialize mixer line */
SrcLine->Line.cbStruct = sizeof(MIXERLINEW);
SrcLine->Line.Target.wMid = MixerInfo->MixCaps.wMid;
SrcLine->Line.Target.wPid = MixerInfo->MixCaps.wPid;
SrcLine->Line.Target.vDriverVersion = MixerInfo->MixCaps.vDriverVersion;
- InitializeListHead(&SrcLine->LineControlsExtraData);
+ InitializeListHead(&SrcLine->ControlsList);
/* copy name */
ASSERT(MixerInfo->MixCaps.szPname[MAXPNAMELEN-1] == L'\0');
wcscpy(SrcLine->Line.Target.szPname, MixerInfo->MixCaps.szPname);
/* get pin name */
- Status = MMixerGetPinName(MixerContext, MixerInfo, PinId, &PinName);
+ Status = MMixerGetPinName(MixerContext, MixerInfo, hMixer, PinId, &PinName);
if (Status == MM_STATUS_SUCCESS)
{
}
/* add the controls to mixer line */
- Status = MMixerAddMixerControlsToMixerLineByNodeIndexArray(MixerContext, MixerInfo, Topology, SrcLine, NodesCount, Nodes);
+ Status = MMixerAddMixerControlsToMixerLineByNodeIndexArray(MixerContext, MixerInfo, hMixer, Topology, SrcLine, NodesCount, Nodes);
if (Status != MM_STATUS_SUCCESS)
{
/* failed */
MMixerAddMixerSourceLines(
IN PMIXER_CONTEXT MixerContext,
IN OUT LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN PTOPOLOGY Topology,
IN ULONG DestinationLineID,
IN ULONG LineTerminator)
ULONG TempIndex;
#endif
/* now build the mixer source line */
- Status = MMixerBuildMixerSourceLine(MixerContext, MixerInfo, Topology, PinId, AllPinNodesCount, AllPinNodes, DestinationLineID, &SrcLine);
+ Status = MMixerBuildMixerSourceLine(MixerContext, MixerInfo, hMixer, Topology, PinId, AllPinNodesCount, AllPinNodes, DestinationLineID, &SrcLine);
if (Status == MM_STATUS_SUCCESS)
{
/* increment destination line count */
DstLine->Line.cConnections++;
+
+ /* mark pin as reserved */
+ MMixerSetTopologyPinReserved(Topology, PinId);
+
#ifdef MMIXER_DEBUG
DPRINT1("Adding PinId %lu AllPinNodesCount %lu to DestinationLine %lu\n", PinId, AllPinNodesCount, DestinationLineID);
for(TempIndex = 0; TempIndex < AllPinNodesCount; TempIndex++)
MMixerAddMixerControlsToDestinationLine(
IN PMIXER_CONTEXT MixerContext,
IN OUT LPMIXER_INFO MixerInfo,
+ IN HANDLE hMixer,
IN PTOPOLOGY Topology,
IN ULONG PinId,
IN ULONG bInput,
if (NodesCount > 0)
{
/* add all nodes as mixer controls to the destination line */
- Status = MMixerAddMixerControlsToMixerLineByNodeIndexArray(MixerContext, MixerInfo, Topology, DstLine, NodesCount, Nodes);
+ Status = MMixerAddMixerControlsToMixerLineByNodeIndexArray(MixerContext, MixerInfo, hMixer, Topology, DstLine, NodesCount, Nodes);
if (Status != MM_STATUS_SUCCESS)
{
/* failed to add controls */
MMixerApplyOutputFilterHack(
IN PMIXER_CONTEXT MixerContext,
IN LPMIXER_DATA MixerData,
+ IN HANDLE hMixer,
IN OUT PULONG PinsCount,
IN OUT PULONG Pins)
{
for(Index = 0; Index < *PinsCount; Index++)
{
/* check if it has a physical connection */
- Status = MMixerGetPhysicalConnection(MixerContext, MixerData->hDevice, Pins[Index], &Connection);
+ Status = MMixerGetPhysicalConnection(MixerContext, hMixer, Pins[Index], &Connection);
if (Status == MM_STATUS_SUCCESS)
{
DPRINT1("Name %S, Pin %lu bInput %lu\n", OutConnection->SymbolicLinkName, OutConnection->Pin, bInput);
- if (MixerInfo->hMixer != NULL)
- {
- /* dont replace mixer destination handles */
- DPRINT1("MixerInfo hDevice %p MixerData hDevice %p\n", MixerInfo->hMixer, MixerData->hDevice);
- ASSERT(MixerInfo->hMixer == MixerData->hDevice);
- }
+ /* sanity check */
+ ASSERT(MixerData->MixerInfo == NULL || MixerData->MixerInfo == MixerInfo);
- /* store connected mixer handle */
- MixerInfo->hMixer = MixerData->hDevice;
+ /* associate with mixer */
+ MixerData->MixerInfo = MixerInfo;
if (MixerData->Topology == NULL)
{
Topology = MixerData->Topology;
}
- /* allocate pin index array which will hold all referenced pins */
- Status = MMixerAllocateTopologyPinArray(MixerContext, Topology, &Pins);
- ASSERT(Status == MM_STATUS_SUCCESS);
+ /* mark pin as consumed */
+ MMixerSetTopologyPinReserved(Topology, OutConnection->Pin);
if (!bInput)
{
+ /* allocate pin index array which will hold all referenced pins */
+ Status = MMixerAllocateTopologyPinArray(MixerContext, Topology, &Pins);
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* failed to create topology */
+ return Status;
+ }
+
/* the mixer is an output mixer
* find end pin of the node path
*/
* WorkArround: remove all pin ids which have a physical connection
* because bridge pins may belong to different render paths
*/
- MMixerApplyOutputFilterHack(MixerContext, MixerData, &PinsCount, Pins);
+ MMixerApplyOutputFilterHack(MixerContext, MixerData, MixerData->hDevice, &PinsCount, Pins);
/* sanity checks */
ASSERT(PinsCount != 0);
ASSERT(PinsCount == 1);
/* create destination line */
- Status = MMixerBuildMixerDestinationLine(MixerContext, MixerInfo, Pins[0], bInput);
+ Status = MMixerBuildMixerDestinationLine(MixerContext, MixerInfo, MixerData->hDevice, Pins[0], bInput);
/* calculate destination line id */
DestinationLineID = (DESTINATION_LINE + MixerInfo->MixCaps.cDestinations-1);
}
/* add mixer controls to destination line */
- Status = MMixerAddMixerControlsToDestinationLine(MixerContext, MixerInfo, Topology, Pins[0], bInput, DestinationLineID, &LineTerminator);
+ Status = MMixerAddMixerControlsToDestinationLine(MixerContext, MixerInfo, MixerData->hDevice, Topology, Pins[0], bInput, DestinationLineID, &LineTerminator);
if (Status == MM_STATUS_SUCCESS)
{
/* now add the rest of the source lines */
- Status = MMixerAddMixerSourceLines(MixerContext, MixerInfo, Topology, DestinationLineID, LineTerminator);
+ Status = MMixerAddMixerSourceLines(MixerContext, MixerInfo, MixerData->hDevice, Topology, DestinationLineID, LineTerminator);
}
+
+ /* mark pin as consumed */
+ MMixerSetTopologyPinReserved(Topology, Pins[0]);
+
+ /* free topology pin array */
+ MixerContext->Free(Pins);
}
else
{
DestinationLineID = (DESTINATION_LINE + MixerInfo->MixCaps.cDestinations-1);
/* add mixer controls */
- Status = MMixerAddMixerControlsToDestinationLine(MixerContext, MixerInfo, Topology, OutConnection->Pin, bInput, DestinationLineID, &LineTerminator);
+ Status = MMixerAddMixerControlsToDestinationLine(MixerContext, MixerInfo, MixerData->hDevice, Topology, OutConnection->Pin, bInput, DestinationLineID, &LineTerminator);
if (Status == MM_STATUS_SUCCESS)
{
/* now add the rest of the source lines */
- Status = MMixerAddMixerSourceLines(MixerContext, MixerInfo, Topology, DestinationLineID, LineTerminator);
+ Status = MMixerAddMixerSourceLines(MixerContext, MixerInfo, MixerData->hDevice, Topology, DestinationLineID, LineTerminator);
}
}
IN ULONG bInputMixer,
IN OUT LPMIXER_INFO * OutMixerInfo)
{
-
+ ULONG Index;
MIXER_STATUS Status;
PKSPIN_PHYSICALCONNECTION OutConnection;
ULONG * Pins;
/* initialize line list */
InitializeListHead(&MixerInfo->LineList);
InitializeListHead(&MixerInfo->EventList);
+
+ /* associate with mixer data */
+ MixerData->MixerInfo = MixerInfo;
}
/* store mixer info */
return Status;
}
+ /* mark all found pins as reserved */
+ for(Index = 0; Index < PinsFound; Index++)
+ {
+ MMixerSetTopologyPinReserved(Topology, Pins[Index]);
+ }
+
if (bInputMixer)
{
/* pre create the mixer destination line for input mixers */
- Status = MMixerBuildMixerDestinationLine(MixerContext, MixerInfo, Pins[0], bInputMixer);
+ Status = MMixerBuildMixerDestinationLine(MixerContext, MixerInfo, MixerData->hDevice, Pins[0], bInputMixer);
if (Status != MM_STATUS_SUCCESS)
{
if (Status == MM_STATUS_SUCCESS)
{
+ /* mark pin as reserved */
+ MMixerSetTopologyPinReserved(Topology, Pins[0]);
+
/* topology on the topoloy filter */
Status = MMixerHandlePhysicalConnection(MixerContext, MixerList, MixerData, MixerInfo, bInputMixer, OutConnection);
* handle drivers which expose their topology on the same filter
*/
ASSERT(0);
- MixerInfo->hMixer = MixerData->hDevice;
}
/* free pins */
return Status;
}
+VOID
+MMixerHandleAlternativeMixers(
+ IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_LIST MixerList,
+ IN LPMIXER_DATA MixerData,
+ IN PTOPOLOGY Topology)
+{
+ ULONG Index, PinCount, Reserved;
+ MIXER_STATUS Status;
+ ULONG DestinationLineID, LineTerminator;
+ LPMIXERLINE_EXT DstLine;
+
+ DPRINT1("DeviceName %S\n", MixerData->DeviceName);
+
+ /* get topology pin count */
+ MMixerGetTopologyPinCount(Topology, &PinCount);
+
+ for(Index = 0; Index < PinCount; Index++)
+ {
+ MMixerIsTopologyPinReserved(Topology, Index, &Reserved);
+
+ /* check if it has already been reserved */
+ if (Reserved == TRUE)
+ {
+ /* pin has already been reserved */
+ continue;
+ }
+
+ DPRINT("MixerName %S Available PinID %lu\n", MixerData->DeviceName, Index);
+
+ /* sanity check */
+ ASSERT(MixerData->MixerInfo);
+
+ if (!MixerData->MixerInfo)
+ {
+ DPRINT1("Expected mixer info\n");
+ continue;
+ }
+
+ /* build the destination line */
+ Status = MMixerBuildMixerDestinationLine(MixerContext, MixerData->MixerInfo, MixerData->hDevice, Index, TRUE);
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* failed to build destination line */
+ continue;
+ }
+
+ /* calculate destination line id */
+ DestinationLineID = (DESTINATION_LINE + MixerData->MixerInfo->MixCaps.cDestinations-1);
+
+ /* add mixer controls to destination line */
+ Status = MMixerAddMixerControlsToDestinationLine(MixerContext, MixerData->MixerInfo, MixerData->hDevice, MixerData->Topology, Index, TRUE, DestinationLineID, &LineTerminator);
+ if (Status == MM_STATUS_SUCCESS)
+ {
+ /* now add the rest of the source lines */
+ Status = MMixerAddMixerSourceLines(MixerContext, MixerData->MixerInfo, MixerData->hDevice, MixerData->Topology, DestinationLineID, LineTerminator);
+ }
+
+ /* mark pin as consumed */
+ MMixerSetTopologyPinReserved(Topology, Index);
+
+ /* now grab destination line */
+ DstLine = MMixerGetSourceMixerLineByLineId(MixerData->MixerInfo, DestinationLineID);
+
+ /* set type and target as undefined */
+ DstLine->Line.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_UNDEFINED;
+ DstLine->Line.Target.dwType = MIXERLINE_TARGETTYPE_UNDEFINED;
+ DstLine->Line.Target.vDriverVersion = 0;
+ DstLine->Line.Target.wMid = 0;
+ DstLine->Line.Target.wPid = 0;
+ }
+}
+
MIXER_STATUS
MMixerSetupFilter(
IN PMIXER_CONTEXT MixerContext,
}
- /* TODO: handle alternative mixer types + apply hacks for Wave source line */
+ /* TODO: apply hacks for Wave source line */
/* activate midi devices */
- MMixerInitializeMidiForFilter(MixerContext, MixerList, MixerData, Topology);
+ //MMixerInitializeMidiForFilter(MixerContext, MixerList, MixerData, Topology);
/* done */
return Status;