Commit 2ea305b0 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Actual buffer format may be different from requested format so use

returned one for calculation.
parent bcb13879
......@@ -329,7 +329,6 @@ static HRESULT WINAPI PrimaryBufferImpl_SetFormat(
) {
ICOM_THIS(PrimaryBufferImpl,iface);
IDirectSoundImpl* dsound = This->dsound;
IDirectSoundBufferImpl** dsb;
HRESULT err = DS_OK;
int i;
TRACE("(%p,%p)\n",This,wfex);
......@@ -361,20 +360,6 @@ static HRESULT WINAPI PrimaryBufferImpl_SetFormat(
/* **** */
RtlAcquireResourceExclusive(&(dsound->lock), TRUE);
if (dsound->wfx.nSamplesPerSec != wfex->nSamplesPerSec) {
dsb = dsound->buffers;
for (i = 0; i < dsound->nrofbuffers; i++, dsb++) {
/* **** */
EnterCriticalSection(&((*dsb)->lock));
(*dsb)->freqAdjust = ((*dsb)->freq << DSOUND_FREQSHIFT) /
wfex->nSamplesPerSec;
LeaveCriticalSection(&((*dsb)->lock));
/* **** */
}
}
dsound->wfx.nSamplesPerSec = wfex->nSamplesPerSec;
dsound->wfx.nChannels = wfex->nChannels;
dsound->wfx.wBitsPerSample = wfex->wBitsPerSample;
......@@ -431,6 +416,20 @@ static HRESULT WINAPI PrimaryBufferImpl_SetFormat(
}
DSOUND_RecalcPrimary(dsound);
if (dsound->wfx.nSamplesPerSec != wfex->nSamplesPerSec) {
IDirectSoundBufferImpl** dsb = dsound->buffers;
for (i = 0; i < dsound->nrofbuffers; i++, dsb++) {
/* **** */
EnterCriticalSection(&((*dsb)->lock));
(*dsb)->freqAdjust = ((*dsb)->freq << DSOUND_FREQSHIFT) /
wfex->nSamplesPerSec;
LeaveCriticalSection(&((*dsb)->lock));
/* **** */
}
}
RtlReleaseResource(&(dsound->lock));
/* **** */
......
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