mirror of
https://github.com/reactos/reactos.git
synced 2025-06-09 11:20:39 +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 hStopEvent;
|
||||||
HANDLE hResetEvent;
|
HANDLE hResetEvent;
|
||||||
BOOL ResetInProgress;
|
BOOL ResetInProgress;
|
||||||
|
BOOL bPaused;
|
||||||
} SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE;
|
} SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE;
|
||||||
|
|
||||||
/* This lives in WAVEHDR.reserved */
|
/* This lives in WAVEHDR.reserved */
|
||||||
|
@ -702,6 +703,9 @@ MMRESULT
|
||||||
StopStreaming(
|
StopStreaming(
|
||||||
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
|
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
InitiateSoundStreaming(
|
||||||
|
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
kernel.c
|
kernel.c
|
||||||
|
|
|
@ -29,6 +29,7 @@ MmeSetState(
|
||||||
PMMFUNCTION_TABLE FunctionTable;
|
PMMFUNCTION_TABLE FunctionTable;
|
||||||
PSOUND_DEVICE SoundDevice;
|
PSOUND_DEVICE SoundDevice;
|
||||||
PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
|
PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
|
||||||
|
BOOL OldState;
|
||||||
|
|
||||||
VALIDATE_MMSYS_PARAMETER( PrivateHandle );
|
VALIDATE_MMSYS_PARAMETER( PrivateHandle );
|
||||||
SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle;
|
SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle;
|
||||||
|
@ -53,6 +54,20 @@ MmeSetState(
|
||||||
/* Try change state */
|
/* Try change state */
|
||||||
Result = FunctionTable->SetState(SoundDeviceInstance, bStart);
|
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;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,8 +242,12 @@ EnqueueWaveHeader(
|
||||||
SoundDeviceInstance->HeadWaveHeader = WaveHeader;
|
SoundDeviceInstance->HeadWaveHeader = WaveHeader;
|
||||||
SoundDeviceInstance->TailWaveHeader = WaveHeader;
|
SoundDeviceInstance->TailWaveHeader = WaveHeader;
|
||||||
|
|
||||||
|
/* Only do wave streaming when the stream has not been paused */
|
||||||
|
if (SoundDeviceInstance->bPaused == FALSE)
|
||||||
|
{
|
||||||
DoWaveStreaming(SoundDeviceInstance);
|
DoWaveStreaming(SoundDeviceInstance);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* There are already queued headers - make this one the tail */
|
/* There are already queued headers - make this one the tail */
|
||||||
|
@ -258,9 +262,13 @@ EnqueueWaveHeader(
|
||||||
SoundDeviceInstance->TailWaveHeader = WaveHeader;
|
SoundDeviceInstance->TailWaveHeader = WaveHeader;
|
||||||
DUMP_WAVEHDR_QUEUE(SoundDeviceInstance);
|
DUMP_WAVEHDR_QUEUE(SoundDeviceInstance);
|
||||||
|
|
||||||
|
/* Only do wave streaming when the stream has not been paused */
|
||||||
|
if ( SoundDeviceInstance->bPaused == FALSE )
|
||||||
|
{
|
||||||
DoWaveStreaming(SoundDeviceInstance);
|
DoWaveStreaming(SoundDeviceInstance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DUMP_WAVEHDR_QUEUE(SoundDeviceInstance);
|
DUMP_WAVEHDR_QUEUE(SoundDeviceInstance);
|
||||||
|
|
||||||
|
|
|
@ -361,3 +361,37 @@ StopStreaming(
|
||||||
StopStreamingInSoundThread,
|
StopStreamingInSoundThread,
|
||||||
NULL);
|
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