Author: janderwald
Date: Fri Dec 3 16:49:33 2010
New Revision: 49931
URL:
http://svn.reactos.org/svn/reactos?rev=49931&view=rev
Log:
[AUDIO-BRINGUP]
- Pass audio device id to wdmaud.drv callback functions
- Extend VALIDATE_MMSYS_PARAMETER macro
- Handle case when the caller does not pass handle of mixer, but a device id
- Pass device id to mmixer library
- Remove dead code
- MS sndvol32.exe now gets further, but crashes in user32 IntCallMessageProc
Modified:
branches/audio-bringup/dll/win32/wdmaud.drv/mmixer.c
branches/audio-bringup/dll/win32/wdmaud.drv/wdmaud.h
branches/audio-bringup/include/reactos/libs/sound/mmebuddy.h
branches/audio-bringup/lib/drivers/sound/mmebuddy/mixer/mxdMessage.c
branches/audio-bringup/lib/drivers/sound/mmixer/mixer.c
branches/audio-bringup/lib/drivers/sound/mmixer/mmixer.h
Modified: branches/audio-bringup/dll/win32/wdmaud.drv/mmixer.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/dll/win32/wdmaud.…
==============================================================================
--- branches/audio-bringup/dll/win32/wdmaud.drv/mmixer.c [iso-8859-1] (original)
+++ branches/audio-bringup/dll/win32/wdmaud.drv/mmixer.c [iso-8859-1] Fri Dec 3 16:49:33
2010
@@ -384,7 +384,7 @@
MMRESULT
WdmAudGetMixerCapabilties(
- IN ULONG DeviceId,
+ IN ULONG DeviceId,
LPMIXERCAPSW Capabilities)
{
if (MMixerGetCapabilities(&MixerContext, DeviceId, Capabilities) ==
MM_STATUS_SUCCESS)
@@ -396,10 +396,11 @@
MMRESULT
WdmAudGetLineInfo(
IN HANDLE hMixer,
+ IN DWORD MixerId,
IN LPMIXERLINEW MixLine,
IN ULONG Flags)
{
- if (MMixerGetLineInfo(&MixerContext, hMixer, Flags, MixLine) ==
MM_STATUS_SUCCESS)
+ if (MMixerGetLineInfo(&MixerContext, hMixer, MixerId, Flags, MixLine) ==
MM_STATUS_SUCCESS)
return MMSYSERR_NOERROR;
return MMSYSERR_ERROR;
@@ -408,10 +409,11 @@
MMRESULT
WdmAudGetLineControls(
IN HANDLE hMixer,
+ IN DWORD MixerId,
IN LPMIXERLINECONTROLSW MixControls,
IN ULONG Flags)
{
- if (MMixerGetLineControls(&MixerContext, hMixer, Flags, MixControls) ==
MM_STATUS_SUCCESS)
+ if (MMixerGetLineControls(&MixerContext, hMixer, MixerId, Flags, MixControls) ==
MM_STATUS_SUCCESS)
return MMSYSERR_NOERROR;
return MMSYSERR_ERROR;
@@ -420,10 +422,11 @@
MMRESULT
WdmAudSetControlDetails(
IN HANDLE hMixer,
+ IN DWORD MixerId,
IN LPMIXERCONTROLDETAILS MixDetails,
IN ULONG Flags)
{
- if (MMixerSetControlDetails(&MixerContext, hMixer, Flags, MixDetails) ==
MM_STATUS_SUCCESS)
+ if (MMixerSetControlDetails(&MixerContext, hMixer, MixerId, Flags, MixDetails) ==
MM_STATUS_SUCCESS)
return MMSYSERR_NOERROR;
return MMSYSERR_ERROR;
@@ -433,10 +436,11 @@
MMRESULT
WdmAudGetControlDetails(
IN HANDLE hMixer,
+ IN DWORD MixerId,
IN LPMIXERCONTROLDETAILS MixDetails,
IN ULONG Flags)
{
- if (MMixerGetControlDetails(&MixerContext, hMixer, Flags, MixDetails) ==
MM_STATUS_SUCCESS)
+ if (MMixerGetControlDetails(&MixerContext, hMixer, MixerId, Flags, MixDetails) ==
MM_STATUS_SUCCESS)
return MMSYSERR_NOERROR;
return MMSYSERR_ERROR;
@@ -610,6 +614,7 @@
MMRESULT
WdmAudQueryMixerInfoByMMixer(
IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
+ IN DWORD MixerId,
IN UINT uMsg,
IN LPVOID Parameter,
IN DWORD Flags)
@@ -617,6 +622,7 @@
LPMIXERLINEW MixLine;
LPMIXERLINECONTROLSW MixControls;
LPMIXERCONTROLDETAILS MixDetails;
+ HANDLE hMixer = NULL;
MixLine = (LPMIXERLINEW)Parameter;
MixControls = (LPMIXERLINECONTROLSW)Parameter;
@@ -624,19 +630,23 @@
/* FIXME param checks */
+ if (SoundDeviceInstance)
+ {
+ hMixer = SoundDeviceInstance->Handle;
+ }
+
switch(uMsg)
{
case MXDM_GETLINEINFO:
- return WdmAudGetLineInfo(SoundDeviceInstance->Handle, MixLine, Flags);
+ return WdmAudGetLineInfo(hMixer, MixerId, MixLine, Flags);
case MXDM_GETLINECONTROLS:
- return WdmAudGetLineControls(SoundDeviceInstance->Handle, MixControls,
Flags);
+ return WdmAudGetLineControls(hMixer, MixerId, MixControls, Flags);
case MXDM_SETCONTROLDETAILS:
- return WdmAudSetControlDetails(SoundDeviceInstance->Handle, MixDetails,
Flags);
- break;
+ return WdmAudSetControlDetails(hMixer, MixerId, MixDetails, Flags);
case MXDM_GETCONTROLDETAILS:
- return WdmAudGetControlDetails(SoundDeviceInstance->Handle, MixDetails,
Flags);
- break;
+ return WdmAudGetControlDetails(hMixer, MixerId, MixDetails, Flags);
default:
+ DPRINT1("MixerId %lu, uMsg %lu, Parameter %p, Flags %lu\n", MixerId,
uMsg, Parameter, Flags);
SND_ASSERT(0);
return MMSYSERR_NOTSUPPORTED;
}
Modified: branches/audio-bringup/dll/win32/wdmaud.drv/wdmaud.h
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/dll/win32/wdmaud.…
==============================================================================
--- branches/audio-bringup/dll/win32/wdmaud.drv/wdmaud.h [iso-8859-1] (original)
+++ branches/audio-bringup/dll/win32/wdmaud.drv/wdmaud.h [iso-8859-1] Fri Dec 3 16:49:33
2010
@@ -69,24 +69,28 @@
MMRESULT
WdmAudGetLineInfo(
IN HANDLE hMixer,
+ IN DWORD MixerId,
IN LPMIXERLINEW MixLine,
IN ULONG Flags);
MMRESULT
WdmAudGetLineControls(
IN HANDLE hMixer,
+ IN DWORD MixerId,
IN LPMIXERLINECONTROLSW MixControls,
IN ULONG Flags);
MMRESULT
WdmAudSetControlDetails(
IN HANDLE hMixer,
+ IN DWORD MixerId,
IN LPMIXERCONTROLDETAILS MixDetails,
IN ULONG Flags);
MMRESULT
WdmAudGetControlDetails(
IN HANDLE hMixer,
+ IN DWORD MixerId,
IN LPMIXERCONTROLDETAILS MixDetails,
IN ULONG Flags);
@@ -115,6 +119,7 @@
MMRESULT
WdmAudQueryMixerInfoByMMixer(
IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
+ IN DWORD MixerId,
IN UINT uMsg,
IN LPVOID Parameter,
IN DWORD Flags);
@@ -146,87 +151,4 @@
MMRESULT
WdmAudCleanupByMMixer();
-/* legacy.c */
-
-MMRESULT
-WdmAudCleanupByLegacy();
-
-MMRESULT
-WdmAudGetCapabilitiesByLegacy(
- IN PSOUND_DEVICE SoundDevice,
- IN DWORD DeviceId,
- OUT PVOID Capabilities,
- IN DWORD CapabilitiesSize);
-
-MMRESULT
-WdmAudOpenSoundDeviceByLegacy();
-
-MMRESULT
-WdmAudCloseSoundDeviceByLegacy(
- IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
- IN PVOID Handle);
-
-MMRESULT
-WdmAudGetDeviceInterfaceStringByLegacy(
- IN MMDEVICE_TYPE DeviceType,
- IN DWORD DeviceId,
- IN LPWSTR Interface,
- IN DWORD InterfaceLength,
- OUT DWORD * InterfaceSize);
-
-MMRESULT
-WdmAudSetMixerDeviceFormatByLegacy(
- IN PSOUND_DEVICE_INSTANCE Instance,
- IN DWORD DeviceId,
- IN PWAVEFORMATEX WaveFormat,
- IN DWORD WaveFormatSize);
-
-MMRESULT
-WdmAudQueryMixerInfoByLegacy(
- IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
- IN UINT uMsg,
- IN LPVOID Parameter,
- IN DWORD Flags);
-
-MMRESULT
-WdmAudSetWaveDeviceFormatByLegacy(
- IN PSOUND_DEVICE_INSTANCE Instance,
- IN DWORD DeviceId,
- IN PWAVEFORMATEX WaveFormat,
- IN DWORD WaveFormatSize);
-
-MMRESULT
-WdmAudSetWaveStateByLegacy(
- IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
- IN BOOL bStart);
-
-MMRESULT
-WdmAudResetStreamByLegacy(
- IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
- IN MMDEVICE_TYPE DeviceType,
- IN BOOLEAN bStartReset);
-
-MMRESULT
-WdmAudGetWavePositionByLegacy(
- IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
- IN MMTIME* Time);
-
-MMRESULT
-WriteFileEx_Committer2(
- IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
- IN PVOID OffsetPtr,
- IN DWORD Length,
- IN PSOUND_OVERLAPPED Overlap,
- IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine);
-
-MMRESULT
-WdmAudGetNumWdmDevsByLegacy(
- IN MMDEVICE_TYPE DeviceType,
- OUT DWORD* DeviceCount);
-
-DWORD
-WINAPI
-MixerEventThreadRoutine(
- LPVOID Parameter);
-
#endif
Modified: branches/audio-bringup/include/reactos/libs/sound/mmebuddy.h
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/include/reactos/l…
==============================================================================
--- branches/audio-bringup/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original)
+++ branches/audio-bringup/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Fri Dec 3
16:49:33 2010
@@ -135,7 +135,7 @@
{ \
if ( ! (parameter_condition) ) \
{ \
- SND_ERR(L"FAILED parameter check: %hS\n", #parameter_condition); \
+ SND_ERR(L"FAILED parameter check: %hS at File %S Line %lu\n",
#parameter_condition, __FILE__, __LINE__); \
return MMSYSERR_INVALPARAM; \
} \
}
@@ -199,10 +199,10 @@
typedef MMRESULT (*MMMIXERQUERY_FUNC) (
IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
+ IN DWORD DeviceId,
IN UINT uMsg,
IN LPVOID Parameter,
IN DWORD Flags);
-
typedef MMRESULT (*MMWAVEQUERYFORMATSUPPORT_FUNC)(
IN struct _SOUND_DEVICE* Device,
Modified: branches/audio-bringup/lib/drivers/sound/mmebuddy/mixer/mxdMessage.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmebuddy/mixer/mxdMessage.c [iso-8859-1]
(original)
+++ branches/audio-bringup/lib/drivers/sound/mmebuddy/mixer/mxdMessage.c [iso-8859-1] Fri
Dec 3 16:49:33 2010
@@ -20,6 +20,7 @@
MMRESULT
MmeGetLineInfo(
+ IN UINT DeviceId,
IN UINT Message,
IN DWORD_PTR PrivateHandle,
IN DWORD_PTR Parameter1,
@@ -31,6 +32,21 @@
PMMFUNCTION_TABLE FunctionTable;
//SND_TRACE(L"Getting mixer info %u\n", Message);
+
+ if ( PrivateHandle == 0 )
+ {
+ Result = GetSoundDevice(MIXER_DEVICE_TYPE, DeviceId, &SoundDevice);
+
+ if ( ! MMSUCCESS(Result) )
+ return TranslateInternalMmResult(Result);
+
+ Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable);
+ if ( ! MMSUCCESS(Result) )
+ return TranslateInternalMmResult(Result);
+
+ Result = FunctionTable->QueryMixerInfo(NULL, DeviceId, Message,
(LPVOID)Parameter1, Parameter2);
+ return Result;
+ }
VALIDATE_MMSYS_PARAMETER( PrivateHandle );
SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle;
@@ -46,7 +62,7 @@
if ( ! FunctionTable->QueryMixerInfo )
return MMSYSERR_NOTSUPPORTED;
- Result = FunctionTable->QueryMixerInfo(SoundDeviceInstance, Message,
(LPVOID)Parameter1, Parameter2);
+ Result = FunctionTable->QueryMixerInfo(SoundDeviceInstance, DeviceId, Message,
(LPVOID)Parameter1, Parameter2);
return Result;
}
@@ -100,7 +116,7 @@
(LPWAVEOPENDESC) Parameter1, /* unused */
Parameter2,
(DWORD*) PrivateHandle);
-
+ VALIDATE_MMSYS_PARAMETER(*(DWORD_PTR*)PrivateHandle);
break;
}
@@ -113,7 +129,8 @@
case MXDM_GETCONTROLDETAILS :
{
- Result = MmeGetLineInfo(Message,
+ Result = MmeGetLineInfo(DeviceId,
+ Message,
PrivateHandle,
Parameter1,
Parameter2);
@@ -123,7 +140,8 @@
case MXDM_SETCONTROLDETAILS :
{
- Result = MmeGetLineInfo(Message,
+ Result = MmeGetLineInfo(DeviceId,
+ Message,
PrivateHandle,
Parameter1,
Parameter2);
@@ -133,7 +151,8 @@
case MXDM_GETLINECONTROLS :
{
- Result = MmeGetLineInfo(Message,
+ Result = MmeGetLineInfo(DeviceId,
+ Message,
PrivateHandle,
Parameter1,
Parameter2);
@@ -143,7 +162,8 @@
case MXDM_GETLINEINFO :
{
- Result = MmeGetLineInfo(Message,
+ Result = MmeGetLineInfo(DeviceId,
+ Message,
PrivateHandle,
Parameter1,
Parameter2);
Modified: branches/audio-bringup/lib/drivers/sound/mmixer/mixer.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmixer/mixer.c [iso-8859-1] (original)
+++ branches/audio-bringup/lib/drivers/sound/mmixer/mixer.c [iso-8859-1] Fri Dec 3
16:49:33 2010
@@ -89,7 +89,7 @@
if (Status != MM_STATUS_SUCCESS)
{
/* invalid context passed */
- DPRINT1("invalid context\n");
+ DPRINT1("invalid context\n");
return Status;
}
@@ -98,7 +98,7 @@
if (!MixerInfo)
{
/* invalid mixer id */
- DPRINT1("invalid mixer id %lu\n", MixerId);
+ DPRINT1("invalid mixer id %lu\n", MixerId);
return MM_STATUS_INVALID_PARAMETER;
}
@@ -115,8 +115,9 @@
MIXER_STATUS
MMixerGetLineInfo(
IN PMIXER_CONTEXT MixerContext,
- IN HANDLE MixerHandle,
- IN ULONG Flags,
+ IN HANDLE MixerHandle,
+ IN ULONG MixerId,
+ IN ULONG Flags,
OUT LPMIXERLINEW MixerLine)
{
MIXER_STATUS Status;
@@ -130,6 +131,17 @@
{
/* invalid context passed */
return Status;
+ }
+ if ((Flags & (MIXER_OBJECTF_MIXER | MIXER_OBJECTF_HMIXER)) ==
MIXER_OBJECTF_MIXER)
+ {
+ /* caller passed mixer id */
+ MixerHandle = (HANDLE)MMixerGetMixerInfoByIndex(MixerContext, MixerId);
+
+ if (!MixerHandle)
+ {
+ /* invalid parameter */
+ return MM_STATUS_INVALID_PARAMETER;
+ }
}
/* clear hmixer from flags */
@@ -220,6 +232,7 @@
MMixerGetLineControls(
IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
+ IN ULONG MixerId,
IN ULONG Flags,
OUT LPMIXERLINECONTROLSW MixerLineControls)
{
@@ -236,6 +249,18 @@
{
/* invalid context passed */
return Status;
+ }
+
+ if ((Flags & (MIXER_OBJECTF_MIXER | MIXER_OBJECTF_HMIXER)) ==
MIXER_OBJECTF_MIXER)
+ {
+ /* caller passed mixer id */
+ MixerHandle = (HANDLE)MMixerGetMixerInfoByIndex(MixerContext, MixerId);
+
+ if (!MixerHandle)
+ {
+ /* invalid parameter */
+ return MM_STATUS_INVALID_PARAMETER;
+ }
}
Flags &= ~MIXER_OBJECTF_HMIXER;
@@ -312,6 +337,7 @@
MMixerSetControlDetails(
IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
+ IN ULONG MixerId,
IN ULONG Flags,
OUT LPMIXERCONTROLDETAILS MixerControlDetails)
{
@@ -328,6 +354,18 @@
{
/* invalid context passed */
return Status;
+ }
+
+ if ((Flags & (MIXER_OBJECTF_MIXER | MIXER_OBJECTF_HMIXER)) ==
MIXER_OBJECTF_MIXER)
+ {
+ /* caller passed mixer id */
+ MixerHandle = (HANDLE)MMixerGetMixerInfoByIndex(MixerContext, MixerId);
+
+ if (!MixerHandle)
+ {
+ /* invalid parameter */
+ return MM_STATUS_INVALID_PARAMETER;
+ }
}
/* get mixer info */
@@ -362,6 +400,7 @@
MMixerGetControlDetails(
IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
+ IN ULONG MixerId,
IN ULONG Flags,
OUT LPMIXERCONTROLDETAILS MixerControlDetails)
{
@@ -378,6 +417,18 @@
{
/* invalid context passed */
return Status;
+ }
+
+ if ((Flags & (MIXER_OBJECTF_MIXER | MIXER_OBJECTF_HMIXER)) ==
MIXER_OBJECTF_MIXER)
+ {
+ /* caller passed mixer id */
+ MixerHandle = (HANDLE)MMixerGetMixerInfoByIndex(MixerContext, MixerId);
+
+ if (!MixerHandle)
+ {
+ /* invalid parameter */
+ return MM_STATUS_INVALID_PARAMETER;
+ }
}
/* get mixer info */
Modified: branches/audio-bringup/lib/drivers/sound/mmixer/mmixer.h
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmixer/mmixer.h [iso-8859-1] (original)
+++ branches/audio-bringup/lib/drivers/sound/mmixer/mmixer.h [iso-8859-1] Fri Dec 3
16:49:33 2010
@@ -149,7 +149,8 @@
MIXER_STATUS
MMixerGetLineInfo(
IN PMIXER_CONTEXT MixerContext,
- IN HANDLE MixerHandle,
+ IN HANDLE MixerHandle,
+ IN ULONG MixerId,
IN ULONG Flags,
OUT LPMIXERLINEW MixerLine);
@@ -157,6 +158,7 @@
MMixerGetLineControls(
IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
+ IN ULONG MixerId,
IN ULONG Flags,
OUT LPMIXERLINECONTROLSW MixerLineControls);
@@ -164,6 +166,7 @@
MMixerSetControlDetails(
IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
+ IN ULONG MixerId,
IN ULONG Flags,
OUT LPMIXERCONTROLDETAILS MixerControlDetails);
@@ -171,6 +174,7 @@
MMixerGetControlDetails(
IN PMIXER_CONTEXT MixerContext,
IN HANDLE MixerHandle,
+ IN ULONG MixerId,
IN ULONG Flags,
OUT LPMIXERCONTROLDETAILS MixerControlDetails);