mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[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 svn path=/trunk/; revision=50897
This commit is contained in:
parent
e1d7a14438
commit
c50e27e4bf
4 changed files with 63 additions and 2 deletions
|
@ -366,6 +366,7 @@ typedef struct _SOUND_DEVICE_INSTANCE
|
|||
HANDLE hStopEvent;
|
||||
HANDLE hResetEvent;
|
||||
BOOL ResetInProgress;
|
||||
BOOL bPaused;
|
||||
} SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE;
|
||||
|
||||
/* This lives in WAVEHDR.reserved */
|
||||
|
@ -702,6 +703,9 @@ MMRESULT
|
|||
StopStreaming(
|
||||
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
|
||||
|
||||
VOID
|
||||
InitiateSoundStreaming(
|
||||
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
|
||||
|
||||
/*
|
||||
kernel.c
|
||||
|
|
|
@ -29,6 +29,7 @@ MmeSetState(
|
|||
PMMFUNCTION_TABLE FunctionTable;
|
||||
PSOUND_DEVICE SoundDevice;
|
||||
PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
|
||||
BOOL OldState;
|
||||
|
||||
VALIDATE_MMSYS_PARAMETER( PrivateHandle );
|
||||
SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle;
|
||||
|
@ -53,6 +54,20 @@ MmeSetState(
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,7 +242,11 @@ EnqueueWaveHeader(
|
|||
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 @@ EnqueueWaveHeader(
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -361,3 +361,37 @@ StopStreaming(
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue