Skip to content

Commit 9aa299b

Browse files
[MMIXER] Don't stop audio devices enumeration when one or more of them failed to initialize (reactos#7863)
Skip unsuccessfully initialized devices and continue enumeration until all of devices are enumerated. Patch by Johannes Anderwald with additional improvements from me. This fixes 0 audio devices detected for HD audio controllers (e. g., Realtek), and hence allows to properly detect all available devices and play the sound with MMixer routines enabled (they are currently default). Tested personally with Realtek HD Audio driver version R2.74 for Windows XP/Server 2003 in pair with hdaudbus.sys from Windows Vista SP2 on real hardware. CORE-17285
1 parent 2ec3a19 commit 9aa299b

File tree

1 file changed

+11
-16
lines changed
  • sdk/lib/drivers/sound/mmixer

1 file changed

+11
-16
lines changed

sdk/lib/drivers/sound/mmixer/mixer.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,8 @@ MMixerInitialize(
817817
/* store mixer list */
818818
MixerContext->MixerContext = (PVOID)MixerList;
819819

820-
/* start enumerating all available devices */
821-
Count = 0;
822-
DeviceIndex = 0;
823-
824-
do
820+
/* enumerate all available devices */
821+
for (DeviceIndex = 0; ; DeviceIndex++)
825822
{
826823
/* enumerate a device */
827824
Status = EnumFunction(EnumContext, DeviceIndex, &DeviceName, &hMixer, &hKey);
@@ -834,29 +831,27 @@ MMixerInitialize(
834831
/* enumeration has finished */
835832
break;
836833
}
837-
else
838-
{
839-
DPRINT1("Failed to enumerate device %lu\n", DeviceIndex);
840834

841-
/* TODO cleanup */
842-
return Status;
843-
}
835+
DPRINT1("EnumFunction() failed for device %lu, Status %x\n", DeviceIndex, Status);
836+
837+
/* ignore error and continue */
844838
}
845839
else
846840
{
847841
/* create a mixer data entry */
848842
Status = MMixerCreateMixerData(MixerContext, MixerList, DeviceIndex, DeviceName, hMixer, hKey);
849843
if (Status != MM_STATUS_SUCCESS)
850-
break;
851-
}
844+
DPRINT1("MMixerCreateMixerData() failed for device %lu, Status %x\n",
845+
DeviceIndex, Status);
852846

853-
/* increment device index */
854-
DeviceIndex++;
855-
}while(TRUE);
847+
/* ignore error and continue */
848+
}
849+
}
856850

857851
/* now all filters have been pre-opened
858852
* lets enumerate the filters
859853
*/
854+
Count = 0;
860855
Entry = MixerList->MixerData.Flink;
861856
while(Entry != &MixerList->MixerData)
862857
{

0 commit comments

Comments
 (0)