Commit 6f9d4167 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Return error from low level driver when necessary.

parent 241a4c34
...@@ -207,6 +207,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume( ...@@ -207,6 +207,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(
) { ) {
IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
LONG oldVol; LONG oldVol;
HRESULT hres = DS_OK;
TRACE("(%p,%ld)\n",This,vol); TRACE("(%p,%ld)\n",This,vol);
...@@ -235,7 +236,6 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume( ...@@ -235,7 +236,6 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(
if (vol != oldVol) { if (vol != oldVol) {
if (This->hwbuf) { if (This->hwbuf) {
HRESULT hres;
hres = IDsDriverBuffer_SetVolumePan(This->hwbuf, &(This->volpan)); hres = IDsDriverBuffer_SetVolumePan(This->hwbuf, &(This->volpan));
if (hres != DS_OK) if (hres != DS_OK)
WARN("IDsDriverBuffer_SetVolumePan failed\n"); WARN("IDsDriverBuffer_SetVolumePan failed\n");
...@@ -246,7 +246,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume( ...@@ -246,7 +246,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(
LeaveCriticalSection(&(This->lock)); LeaveCriticalSection(&(This->lock));
/* **** */ /* **** */
return DS_OK; return hres;
} }
static HRESULT WINAPI IDirectSoundBufferImpl_GetVolume( static HRESULT WINAPI IDirectSoundBufferImpl_GetVolume(
...@@ -795,6 +795,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Unlock( ...@@ -795,6 +795,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Unlock(
) { ) {
IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
DWORD probably_valid_to; DWORD probably_valid_to;
HRESULT hres = DS_OK;
TRACE("(%p,%p,%ld,%p,%ld)\n", This,p1,x1,p2,x2); TRACE("(%p,%p,%ld,%p,%ld)\n", This,p1,x1,p2,x2);
...@@ -802,30 +803,28 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Unlock( ...@@ -802,30 +803,28 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Unlock(
EnterCriticalSection(&(This->lock)); EnterCriticalSection(&(This->lock));
if (!(This->dsound->drvdesc.dwFlags & DSDDESC_DONTNEEDSECONDARYLOCK) && This->hwbuf) { if (!(This->dsound->drvdesc.dwFlags & DSDDESC_DONTNEEDSECONDARYLOCK) && This->hwbuf) {
HRESULT hres;
hres = IDsDriverBuffer_Unlock(This->hwbuf, p1, x1, p2, x2); hres = IDsDriverBuffer_Unlock(This->hwbuf, p1, x1, p2, x2);
if (hres != DS_OK) { if (hres != DS_OK)
LeaveCriticalSection(&(This->lock));
WARN("IDsDriverBuffer_Unlock failed\n"); WARN("IDsDriverBuffer_Unlock failed\n");
return hres;
}
} }
if (p2) probably_valid_to = (((LPBYTE)p2)-This->buffer->memory) + x2; if (hres == DS_OK) {
else probably_valid_to = (((LPBYTE)p1)-This->buffer->memory) + x1; if (p2) probably_valid_to = (((LPBYTE)p2)-This->buffer->memory) + x2;
probably_valid_to %= This->buflen; else probably_valid_to = (((LPBYTE)p1)-This->buffer->memory) + x1;
if ((probably_valid_to == 0) && ((x1+x2) == This->buflen) && probably_valid_to %= This->buflen;
((This->state == STATE_STARTING) || if ((probably_valid_to == 0) && ((x1+x2) == This->buflen) &&
(This->state == STATE_PLAYING))) ((This->state == STATE_STARTING) ||
/* see IDirectSoundBufferImpl_Lock */ (This->state == STATE_PLAYING)))
probably_valid_to = (DWORD)-1; /* see IDirectSoundBufferImpl_Lock */
This->probably_valid_to = probably_valid_to; probably_valid_to = (DWORD)-1;
This->probably_valid_to = probably_valid_to;
}
LeaveCriticalSection(&(This->lock)); LeaveCriticalSection(&(This->lock));
/* **** */ /* **** */
TRACE("probably_valid_to=%ld\n", This->probably_valid_to); TRACE("probably_valid_to=%ld\n", This->probably_valid_to);
return DS_OK; return hres;
} }
static HRESULT WINAPI IDirectSoundBufferImpl_Restore( static HRESULT WINAPI IDirectSoundBufferImpl_Restore(
......
...@@ -775,7 +775,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan( ...@@ -775,7 +775,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
IDirectSoundImpl* dsound = This->dsound; IDirectSoundImpl* dsound = This->dsound;
DWORD ampfactors; DWORD ampfactors;
DSVOLUMEPAN volpan; DSVOLUMEPAN volpan;
HRESULT hres; HRESULT hres = DS_OK;
TRACE("(%p,%ld)\n",This,pan); TRACE("(%p,%ld)\n",This,pan);
...@@ -803,8 +803,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan( ...@@ -803,8 +803,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
hres = IDsDriverBuffer_SetVolumePan(dsound->hwbuf, &volpan); hres = IDsDriverBuffer_SetVolumePan(dsound->hwbuf, &volpan);
if (hres != DS_OK) if (hres != DS_OK)
WARN("IDsDriverBuffer_SetVolumePan failed\n"); WARN("IDsDriverBuffer_SetVolumePan failed\n");
} } else {
else {
ampfactors = (volpan.dwTotalLeftAmpFactor & 0xffff) | (volpan.dwTotalRightAmpFactor << 16); ampfactors = (volpan.dwTotalLeftAmpFactor & 0xffff) | (volpan.dwTotalRightAmpFactor << 16);
waveOutSetVolume(dsound->hwo, ampfactors); waveOutSetVolume(dsound->hwo, ampfactors);
} }
...@@ -813,7 +812,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan( ...@@ -813,7 +812,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
LeaveCriticalSection(&(dsound->mixlock)); LeaveCriticalSection(&(dsound->mixlock));
/* **** */ /* **** */
return DS_OK; return hres;
} }
static HRESULT WINAPI PrimaryBufferImpl_GetPan( static HRESULT WINAPI PrimaryBufferImpl_GetPan(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment