Author: janderwald
Date: Tue Dec 7 15:19:22 2010
New Revision: 49970
URL:
http://svn.reactos.org/svn/reactos?rev=49970&view=rev
Log:
[AUDIO-BRINGUP]
- Implement registering source / destination lines + controls of alternative mixers
- Implement support function for retrieving mixer by name
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/sup.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] Tue Dec 7
15:19:22 2010
@@ -249,13 +249,16 @@
/* initialize mixer destination line */
DestinationLine->Line.cbStruct = sizeof(MIXERLINEW);
+ 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.dwSource = MAXULONG;
- DestinationLine->Line.dwLineID = MixerInfo->MixCaps.cDestinations +
DESTINATION_LINE;
+ DestinationLine->Line.dwUser = 0;
DestinationLine->Line.fdwLine = MIXERLINE_LINEF_ACTIVE;
- 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 */
+
if (LineName)
{
@@ -1267,6 +1270,12 @@
DPRINT1("Name %S, Pin %lu bInput %lu\n",
OutConnection->SymbolicLinkName, OutConnection->Pin, bInput);
+ /* sanity check */
+ ASSERT(MixerData->MixerInfo == NULL || MixerData->MixerInfo == MixerInfo);
+
+ /* associate with mixer */
+ MixerData->MixerInfo = MixerInfo;
+
if (MixerData->Topology == NULL)
{
/* construct new topology */
@@ -1418,6 +1427,9 @@
/* initialize line list */
InitializeListHead(&MixerInfo->LineList);
InitializeListHead(&MixerInfo->EventList);
+
+ /* associate with mixer data */
+ MixerData->MixerInfo = MixerInfo;
}
/* store mixer info */
@@ -1535,6 +1547,9 @@
IN PTOPOLOGY Topology)
{
ULONG Index, PinCount, Reserved;
+ MIXER_STATUS Status;
+ ULONG DestinationLineID, LineTerminator;
+ LPMIXERLINE_EXT DstLine;
DPRINT1("DeviceName %S\n", MixerData->DeviceName);
@@ -1546,10 +1561,54 @@
MMixerIsTopologyPinReserved(Topology, Index, &Reserved);
/* check if it has already been reserved */
- if (Reserved == FALSE)
- {
- DPRINT1("MixerName %S Available PinID %lu\n",
MixerData->DeviceName, Index);
- }
+ 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;
}
}
@@ -1625,7 +1684,7 @@
/* TODO: apply hacks for Wave source line */
/* activate midi devices */
- MMixerInitializeMidiForFilter(MixerContext, MixerList, MixerData, Topology);
+ //MMixerInitializeMidiForFilter(MixerContext, MixerList, MixerData, Topology);
/* done */
return Status;
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] Tue Dec 7
15:19:22 2010
@@ -122,6 +122,7 @@
HANDLE hDeviceInterfaceKey;
LPWSTR DeviceName;
PTOPOLOGY Topology;
+ LPMIXER_INFO MixerInfo;
}MIXER_DATA, *LPMIXER_DATA;
typedef struct
@@ -372,6 +373,11 @@
IN LPMIXER_DATA MixerData,
IN PTOPOLOGY Topology);
+MIXER_STATUS
+MMixerGetMixerByName(
+ IN PMIXER_LIST MixerList,
+ IN LPWSTR MixerName,
+ OUT LPMIXER_INFO *MixerInfo);
/* topology.c */
Modified: branches/audio-bringup/lib/drivers/sound/mmixer/sup.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmixer/sup.c [iso-8859-1] (original)
+++ branches/audio-bringup/lib/drivers/sound/mmixer/sup.c [iso-8859-1] Tue Dec 7 15:19:22
2010
@@ -100,6 +100,33 @@
return NULL;
}
+MIXER_STATUS
+MMixerGetMixerByName(
+ IN PMIXER_LIST MixerList,
+ IN LPWSTR MixerName,
+ OUT LPMIXER_INFO *OutMixerInfo)
+{
+ LPMIXER_INFO MixerInfo;
+ PLIST_ENTRY Entry;
+
+ Entry = MixerList->MixerList.Flink;
+ while(Entry != &MixerList->MixerList)
+ {
+ MixerInfo = (LPMIXER_INFO)CONTAINING_RECORD(Entry, MIXER_INFO, Entry);
+
+ DPRINT1("MixerName %S MixerName %S\n", MixerInfo->MixCaps.szPname,
MixerName);
+ if (wcsicmp(MixerInfo->MixCaps.szPname, MixerName) == 0)
+ {
+ *OutMixerInfo = MixerInfo;
+ return MM_STATUS_SUCCESS;
+ }
+ /* move to next mixer entry */
+ Entry = Entry->Flink;
+ }
+
+ return MM_STATUS_UNSUCCESSFUL;
+}
+
LPMIXERLINE_EXT
MMixerGetSourceMixerLineByLineId(
LPMIXER_INFO MixerInfo,