Author: janderwald
Date: Fri Feb 12 07:18:31 2010
New Revision: 45582
URL:
http://svn.reactos.org/svn/reactos?rev=45582&view=rev
Log:
[MMIXER, WDMAUD_KERNEL]
- Implement retrieving device path
Modified:
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mmixer.c
trunk/reactos/lib/drivers/sound/mmixer/mmixer.h
trunk/reactos/lib/drivers/sound/mmixer/wave.c
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mmixer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mmixer.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mmixer.c [iso-8859-1] Fri Feb 12
07:18:31 2010
@@ -551,10 +551,12 @@
WdmAudGetPnpNameByIndexAndType(
IN ULONG DeviceIndex,
IN SOUND_DEVICE_TYPE DeviceType,
- OUT LPWSTR *Device)
-{
- UNIMPLEMENTED
- return STATUS_NOT_IMPLEMENTED;
+ OUT LPWSTR *DevicePath)
+{
+ if (MMixerGetWaveDevicePath(&MixerContext, DeviceType == WAVE_IN_DEVICE_TYPE,
DeviceIndex, DevicePath) == MM_STATUS_SUCCESS)
+ return STATUS_SUCCESS;
+ else
+ return STATUS_UNSUCCESSFUL;
}
NTSTATUS
Modified: trunk/reactos/lib/drivers/sound/mmixer/mmixer.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/m…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/mmixer.h [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/mmixer.h [iso-8859-1] Fri Feb 12 07:18:31 2010
@@ -191,4 +191,11 @@
IN HANDLE PinHandle,
IN KSSTATE State);
+MIXER_STATUS
+MMixerGetWaveDevicePath(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG bWaveIn,
+ IN ULONG DeviceId,
+ OUT LPWSTR * DevicePath);
+
#endif
Modified: trunk/reactos/lib/drivers/sound/mmixer/wave.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/w…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/wave.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/wave.c [iso-8859-1] Fri Feb 12 07:18:31 2010
@@ -611,3 +611,61 @@
return MixerContext->Control(PinHandle, IOCTL_KS_PROPERTY, &Property,
sizeof(KSPROPERTY), &State, sizeof(KSSTATE), &Length);
}
+
+MIXER_STATUS
+MMixerGetWaveDevicePath(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG bWaveIn,
+ IN ULONG DeviceId,
+ OUT LPWSTR * DevicePath)
+{
+ PMIXER_LIST MixerList;
+ LPMIXER_DATA MixerData;
+ LPWAVE_INFO WaveInfo;
+ ULONG Length;
+ MIXER_STATUS Status;
+
+ // verify mixer context
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ // invalid context passed
+ return Status;
+ }
+
+ // grab mixer list
+ MixerList = (PMIXER_LIST)MixerContext->MixerContext;
+
+ /* find destination wave */
+ Status = MMixerGetWaveInfoByIndexAndType(MixerList, DeviceId, bWaveIn,
&WaveInfo);
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* failed to find wave info */
+ return MM_STATUS_INVALID_PARAMETER;
+ }
+
+ /* get associated device id */
+ MixerData = MMixerGetDataByDeviceId(MixerList, WaveInfo->DeviceId);
+ if (!MixerData)
+ return MM_STATUS_INVALID_PARAMETER;
+
+ /* calculate length */
+ Length = wcslen(MixerData->DeviceName)+1;
+
+ /* allocate destination buffer */
+ *DevicePath = MixerContext->Alloc(Length * sizeof(WCHAR));
+
+ if (!*DevicePath)
+ {
+ /* no memory */
+ return MM_STATUS_NO_MEMORY;
+ }
+
+ /* copy device path */
+ MixerContext->Copy(*DevicePath, MixerData->DeviceName, Length *
sizeof(WCHAR));
+
+ /* done */
+ return MM_STATUS_SUCCESS;
+}
+