winmm: Prefer using MMSYSERR_* over AUDCLNT_E_* from mmdevapi.

This commit is contained in:
Jörg Höhle 2012-01-10 18:47:17 +01:00 committed by Alexandre Julliard
parent 23cbfff4b6
commit 6086c7be19
1 changed files with 12 additions and 25 deletions

View File

@ -1702,7 +1702,7 @@ exit:
} }
} }
static HRESULT WINMM_BeginPlaying(WINMM_Device *device) static MMRESULT WINMM_BeginPlaying(WINMM_Device *device)
{ {
HRESULT hr; HRESULT hr;
@ -1719,11 +1719,11 @@ static HRESULT WINMM_BeginPlaying(WINMM_Device *device)
if(FAILED(hr) && hr != AUDCLNT_E_NOT_STOPPED){ if(FAILED(hr) && hr != AUDCLNT_E_NOT_STOPPED){
device->stopped = TRUE; device->stopped = TRUE;
WARN("Start failed: %08x\n", hr); WARN("Start failed: %08x\n", hr);
return hr; return MMSYSERR_ERROR;
} }
} }
return S_OK; return MMSYSERR_NOERROR;
} }
static LRESULT WINMM_Pause(HWAVE hwave) static LRESULT WINMM_Pause(HWAVE hwave)
@ -2577,7 +2577,7 @@ UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut,
UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR *header, UINT uSize) UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR *header, UINT uSize)
{ {
WINMM_Device *device; WINMM_Device *device;
HRESULT hr; MMRESULT mr;
TRACE("(%p, %p, %u)\n", hWaveOut, header, uSize); TRACE("(%p, %p, %u)\n", hWaveOut, header, uSize);
@ -2598,7 +2598,6 @@ UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR *header, UINT uSize)
if(device->acm_handle){ if(device->acm_handle){
ACMSTREAMHEADER *ash = (ACMSTREAMHEADER*)header->reserved; ACMSTREAMHEADER *ash = (ACMSTREAMHEADER*)header->reserved;
MMRESULT mr;
ash->cbSrcLength = header->dwBufferLength; ash->cbSrcLength = header->dwBufferLength;
mr = acmStreamConvert(device->acm_handle, ash, 0); mr = acmStreamConvert(device->acm_handle, ash, 0);
@ -2625,15 +2624,11 @@ UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR *header, UINT uSize)
header->dwFlags &= ~WHDR_DONE; header->dwFlags &= ~WHDR_DONE;
header->dwFlags |= WHDR_INQUEUE; header->dwFlags |= WHDR_INQUEUE;
hr = WINMM_BeginPlaying(device); mr = WINMM_BeginPlaying(device);
if(FAILED(hr)){
LeaveCriticalSection(&device->lock);
return MMSYSERR_ERROR;
}
LeaveCriticalSection(&device->lock); LeaveCriticalSection(&device->lock);
return MMSYSERR_NOERROR; return mr;
} }
/************************************************************************** /**************************************************************************
@ -2683,7 +2678,7 @@ UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut) UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut)
{ {
WINMM_Device *device; WINMM_Device *device;
HRESULT hr; MMRESULT mr;
TRACE("(%p)\n", hWaveOut); TRACE("(%p)\n", hWaveOut);
@ -2694,15 +2689,11 @@ UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut)
device->stopped = TRUE; device->stopped = TRUE;
hr = WINMM_BeginPlaying(device); mr = WINMM_BeginPlaying(device);
if(FAILED(hr)){
LeaveCriticalSection(&device->lock);
return MMSYSERR_ERROR;
}
LeaveCriticalSection(&device->lock); LeaveCriticalSection(&device->lock);
return MMSYSERR_NOERROR; return mr;
} }
/************************************************************************** /**************************************************************************
@ -3255,7 +3246,7 @@ UINT WINAPI waveInReset(HWAVEIN hWaveIn)
UINT WINAPI waveInStart(HWAVEIN hWaveIn) UINT WINAPI waveInStart(HWAVEIN hWaveIn)
{ {
WINMM_Device *device; WINMM_Device *device;
HRESULT hr; MMRESULT mr;
TRACE("(%p)\n", hWaveIn); TRACE("(%p)\n", hWaveIn);
@ -3264,15 +3255,11 @@ UINT WINAPI waveInStart(HWAVEIN hWaveIn)
if(!WINMM_ValidateAndLock(device)) if(!WINMM_ValidateAndLock(device))
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
hr = WINMM_BeginPlaying(device); mr = WINMM_BeginPlaying(device);
if(FAILED(hr)){
LeaveCriticalSection(&device->lock);
return MMSYSERR_ERROR;
}
LeaveCriticalSection(&device->lock); LeaveCriticalSection(&device->lock);
return MMSYSERR_NOERROR; return mr;
} }
/************************************************************************** /**************************************************************************