Author: janderwald
Date: Fri Feb 25 14:10:31 2011
New Revision: 50897
URL:
http://svn.reactos.org/svn/reactos?rev=50897&view=rev
Log:
[MMEBUDDY]
- Store the internal state if an audio stream has been stopped
- Construct a thread when WODM_RESTART is received. This thread then triggers performs a
callback to the wave thread, which finally restarts playback
- Only start the wave thread when playback is active (not paused by WODM_PAUSE)
- Fixes playback in Winamp 5.601 despite graphical issues
- Tested in Vbox 4.0 + 512MB RAM + Winamp 5.601
Modified:
trunk/reactos/include/reactos/libs/sound/mmebuddy.h
trunk/reactos/lib/drivers/sound/mmebuddy/mmewrap.c
trunk/reactos/lib/drivers/sound/mmebuddy/wave/header.c
trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c
Modified: trunk/reactos/include/reactos/libs/sound/mmebuddy.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/sound…
==============================================================================
--- trunk/reactos/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Fri Feb 25 14:10:31
2011
@@ -366,6 +366,7 @@
HANDLE hStopEvent;
HANDLE hResetEvent;
BOOL ResetInProgress;
+ BOOL bPaused;
} SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE;
/* This lives in WAVEHDR.reserved */
@@ -702,6 +703,9 @@
StopStreaming(
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
+VOID
+InitiateSoundStreaming(
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
/*
kernel.c
Modified: trunk/reactos/lib/drivers/sound/mmebuddy/mmewrap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmebuddy/mmewrap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmebuddy/mmewrap.c [iso-8859-1] Fri Feb 25 14:10:31
2011
@@ -29,6 +29,7 @@
PMMFUNCTION_TABLE FunctionTable;
PSOUND_DEVICE SoundDevice;
PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
+ BOOL OldState;
VALIDATE_MMSYS_PARAMETER( PrivateHandle );
SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle;
@@ -52,6 +53,20 @@
}
/* Try change state */
Result = FunctionTable->SetState(SoundDeviceInstance, bStart);
+
+ if ( MMSUCCESS(Result) )
+ {
+ /* Get old audio stream state */
+ OldState = SoundDeviceInstance->bPaused;
+
+ /* Store audio stream pause state */
+ SoundDeviceInstance->bPaused = !bStart;
+
+ if (SoundDeviceInstance->bPaused == FALSE && OldState == TRUE)
+ {
+ InitiateSoundStreaming(SoundDeviceInstance);
+ }
+ }
return Result;
}
Modified: trunk/reactos/lib/drivers/sound/mmebuddy/wave/header.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmebuddy/wave/header.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmebuddy/wave/header.c [iso-8859-1] Fri Feb 25
14:10:31 2011
@@ -242,7 +242,11 @@
SoundDeviceInstance->HeadWaveHeader = WaveHeader;
SoundDeviceInstance->TailWaveHeader = WaveHeader;
- DoWaveStreaming(SoundDeviceInstance);
+ /* Only do wave streaming when the stream has not been paused */
+ if (SoundDeviceInstance->bPaused == FALSE)
+ {
+ DoWaveStreaming(SoundDeviceInstance);
+ }
}
else
{
@@ -258,7 +262,11 @@
SoundDeviceInstance->TailWaveHeader = WaveHeader;
DUMP_WAVEHDR_QUEUE(SoundDeviceInstance);
- DoWaveStreaming(SoundDeviceInstance);
+ /* Only do wave streaming when the stream has not been paused */
+ if ( SoundDeviceInstance->bPaused == FALSE )
+ {
+ DoWaveStreaming(SoundDeviceInstance);
+ }
}
}
Modified: trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] Fri Feb 25
14:10:31 2011
@@ -361,3 +361,37 @@
StopStreamingInSoundThread,
NULL);
}
+
+MMRESULT
+PerformWaveStreaming(
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
+ IN PVOID Parameter)
+{
+ DoWaveStreaming(SoundDeviceInstance);
+
+ return MMSYSERR_NOERROR;
+}
+
+DWORD
+WINAPI
+WaveActivateSoundStreaming(
+ IN PVOID lpParameter)
+{
+ CallSoundThread((PSOUND_DEVICE_INSTANCE)lpParameter,
+ PerformWaveStreaming,
+ NULL);
+
+ ExitThread(0);
+}
+
+VOID
+InitiateSoundStreaming(
+ IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance)
+{
+ HANDLE hThread;
+
+ hThread = CreateThread(NULL, 0, WaveActivateSoundStreaming,
(PVOID)SoundDeviceInstance, 0, NULL);
+
+ if (hThread != NULL)
+ CloseHandle(hThread);
+}