mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 00:13:04 +00:00
[CMAKE]
- Sync with trunk r51050. svn path=/branches/cmake-bringup/; revision=51154
This commit is contained in:
commit
785bea480a
469 changed files with 16304 additions and 9647 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ DoWaveStreaming(
|
|||
}
|
||||
|
||||
while ( ( SoundDeviceInstance->OutstandingBuffers < SoundDeviceInstance->BufferCount ) &&
|
||||
( Header ) )
|
||||
( Header ) && SoundDeviceInstance->ResetInProgress == FALSE)
|
||||
{
|
||||
HeaderExtension = (PWAVEHDR_EXTENSION) Header->reserved;
|
||||
SND_ASSERT( HeaderExtension );
|
||||
|
@ -176,8 +176,6 @@ CompleteIO(
|
|||
WaveHdr = (PWAVEHDR) SoundOverlapped->Header;
|
||||
SND_ASSERT( WaveHdr );
|
||||
|
||||
SND_ASSERT( ERROR_SUCCESS == dwErrorCode );
|
||||
|
||||
HdrExtension = (PWAVEHDR_EXTENSION) WaveHdr->reserved;
|
||||
SND_ASSERT( HdrExtension );
|
||||
|
||||
|
@ -305,6 +303,12 @@ StopStreamingInSoundThread(
|
|||
/* cancel all current audio buffers */
|
||||
FunctionTable->ResetStream(SoundDeviceInstance, DeviceType, TRUE);
|
||||
}
|
||||
while(SoundDeviceInstance->OutstandingBuffers)
|
||||
{
|
||||
SND_TRACE(L"StopStreamingInSoundThread OutStandingBufferCount %lu\n", SoundDeviceInstance->OutstandingBuffers);
|
||||
/* wait until pending i/o has completed */
|
||||
SleepEx(10, TRUE);
|
||||
}
|
||||
|
||||
/* complete all current headers */
|
||||
while( SoundDeviceInstance->HeadWaveHeader )
|
||||
|
@ -316,12 +320,6 @@ StopStreamingInSoundThread(
|
|||
/* 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)
|
||||
|
@ -363,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…
Add table
Add a link
Reference in a new issue