Author: janderwald
Date: Fri Dec 10 06:14:10 2010
New Revision: 49997
URL:
http://svn.reactos.org/svn/reactos?rev=49997&view=rev
Log:
[AUDIO-BRINGUP]
- Implement WdmAudResetStreamByMMixer, StopStreamingInSoundThread
- WIDM_RESET / WODM_RESET are now implemented
- Skipping now audio bytes (i.e. jumping to different audio position) now properly works
and no longer causes a hang under certain conditions
Modified:
branches/audio-bringup/dll/win32/wdmaud.drv/mmixer.c
branches/audio-bringup/lib/drivers/sound/mmebuddy/wave/streaming.c
branches/audio-bringup/lib/drivers/sound/mmebuddy/wave/wodMessage.c
branches/audio-bringup/lib/drivers/sound/mmixer/mmixer.h
branches/audio-bringup/lib/drivers/sound/mmixer/wave.c
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 10 06:14:10
2010
@@ -751,7 +751,19 @@
IN MMDEVICE_TYPE DeviceType,
IN BOOLEAN bStartReset)
{
- /* FIXME */
+ MIXER_STATUS Status;
+
+ if (DeviceType == WAVE_IN_DEVICE_TYPE || DeviceType == WAVE_OUT_DEVICE_TYPE)
+ {
+ Status = MMixerSetWaveResetState(&MixerContext,
SoundDeviceInstance->Handle, bStartReset);
+ if (Status == MM_STATUS_SUCCESS)
+ {
+ /* completed successfully */
+ return MMSYSERR_NOERROR;
+ }
+ }
+
+
return MMSYSERR_NOTSUPPORTED;
}
Modified: branches/audio-bringup/lib/drivers/sound/mmebuddy/wave/streaming.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1]
(original)
+++ branches/audio-bringup/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] Fri
Dec 10 06:14:10 2010
@@ -277,8 +277,62 @@
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN PVOID Parameter)
{
- /* TODO */
- return MMSYSERR_NOTSUPPORTED;
+ MMDEVICE_TYPE DeviceType;
+ PMMFUNCTION_TABLE FunctionTable;
+ MMRESULT Result;
+ PSOUND_DEVICE SoundDevice;
+
+ /* set state reset in progress */
+ SoundDeviceInstance->ResetInProgress = TRUE;
+
+ /* Get sound device */
+ Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
+ SND_ASSERT( Result == MMSYSERR_NOERROR );
+
+ /* Obtain the function table */
+ Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable);
+ SND_ASSERT( Result == MMSYSERR_NOERROR );
+
+ /* Obtain device instance type */
+ Result = GetSoundDeviceType(SoundDevice, &DeviceType);
+ SND_ASSERT( Result == MMSYSERR_NOERROR );
+
+ /* Check if reset function is supported */
+ if (FunctionTable->ResetStream)
+ {
+ /* cancel all current audio buffers */
+ FunctionTable->ResetStream(SoundDeviceInstance, DeviceType, TRUE);
+ }
+
+ /* complete all current headers */
+ while( SoundDeviceInstance->HeadWaveHeader )
+ {
+ SND_TRACE(L"StopStreamingInSoundThread: Completing Header %p\n",
SoundDeviceInstance->HeadWaveHeader);
+ CompleteWaveHeader( SoundDeviceInstance, SoundDeviceInstance->HeadWaveHeader
);
+ }
+
+ /* there should be no oustanding buffers now */
+ SND_ASSERT(SoundDeviceInstance->OutstandingBuffers == 0);
+
+ while(SoundDeviceInstance->OutstandingBuffers)
+ {
+ SND_ERR("StopStreamingInSoundThread OutStandingBufferCount %lu\n",
SoundDeviceInstance->OutstandingBuffers);
+ /* my hack of doom */
+ Sleep(10);
+ }
+
+ /* Check if reset function is supported */
+ if (FunctionTable->ResetStream)
+ {
+ /* finish the reset */
+ FunctionTable->ResetStream(SoundDeviceInstance, DeviceType, FALSE);
+ }
+
+ /* clear state reset in progress */
+ SoundDeviceInstance->ResetInProgress = FALSE;
+
+
+ return MMSYSERR_NOERROR;
}
MMRESULT
Modified: branches/audio-bringup/lib/drivers/sound/mmebuddy/wave/wodMessage.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1]
(original)
+++ branches/audio-bringup/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] Fri
Dec 10 06:14:10 2010
@@ -111,6 +111,11 @@
/* Continue playback when paused */
break;
}
+ case WODM_PAUSE :
+ {
+ /* pause playback */
+ break;
+ }
case WODM_GETPOS :
{
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 10
06:14:10 2010
@@ -207,6 +207,12 @@
IN KSSTATE State);
MIXER_STATUS
+MMixerSetWaveResetState(
+ IN PMIXER_CONTEXT MixerContext,
+ IN HANDLE PinHandle,
+ IN ULONG bBegin);
+
+MIXER_STATUS
MMixerGetWaveDevicePath(
IN PMIXER_CONTEXT MixerContext,
IN ULONG bWaveIn,
Modified: branches/audio-bringup/lib/drivers/sound/mmixer/wave.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/lib/drivers/sound…
==============================================================================
--- branches/audio-bringup/lib/drivers/sound/mmixer/wave.c [iso-8859-1] (original)
+++ branches/audio-bringup/lib/drivers/sound/mmixer/wave.c [iso-8859-1] Fri Dec 10
06:14:10 2010
@@ -608,6 +608,16 @@
{
KSPROPERTY Property;
ULONG Length;
+ MIXER_STATUS Status;
+
+ /* verify mixer context */
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* invalid context passed */
+ return Status;
+ }
/* setup property request */
Property.Set = KSPROPSETID_Connection;
@@ -618,6 +628,31 @@
}
MIXER_STATUS
+MMixerSetWaveResetState(
+ IN PMIXER_CONTEXT MixerContext,
+ IN HANDLE PinHandle,
+ IN ULONG bBegin)
+{
+ ULONG Length;
+ MIXER_STATUS Status;
+ KSRESET Reset;
+
+ /* verify mixer context */
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* invalid context passed */
+ return Status;
+ }
+
+ /* begin / stop reset */
+ Reset = (bBegin ? KSRESET_BEGIN : KSRESET_END);
+
+ return MixerContext->Control(PinHandle, IOCTL_KS_RESET_STATE, &Reset,
sizeof(KSRESET), NULL, 0, &Length);
+}
+
+MIXER_STATUS
MMixerGetWaveDevicePath(
IN PMIXER_CONTEXT MixerContext,
IN ULONG bWaveIn,