dsound: Request a more exact buffer size from MMDevAPI.
This commit is contained in:
parent
d0c38ece9d
commit
9d29d9f766
|
@ -84,6 +84,8 @@ static void DSOUND_RecalcPrimary(DirectSoundDevice *device)
|
||||||
|
|
||||||
HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
|
HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
|
||||||
{
|
{
|
||||||
|
UINT prebuf_frames;
|
||||||
|
REFERENCE_TIME prebuf_rt;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
TRACE("(%p, %d)\n", device, forcewave);
|
TRACE("(%p, %d)\n", device, forcewave);
|
||||||
|
@ -112,10 +114,11 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* buffer size = 200 * 100000 (100 ns) = 2.0 seconds */
|
prebuf_frames = device->prebuf * DSOUND_fraglen(device->pwfx->nSamplesPerSec, device->pwfx->nBlockAlign) / device->pwfx->nBlockAlign;
|
||||||
|
prebuf_rt = (prebuf_frames / (double)device->pwfx->nSamplesPerSec) * 10000000;
|
||||||
hres = IAudioClient_Initialize(device->client,
|
hres = IAudioClient_Initialize(device->client,
|
||||||
AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_NOPERSIST,
|
AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||||
200 * 100000, 50000, device->pwfx, NULL);
|
prebuf_rt, 50000, device->pwfx, NULL);
|
||||||
if(FAILED(hres)){
|
if(FAILED(hres)){
|
||||||
IAudioClient_Release(device->client);
|
IAudioClient_Release(device->client);
|
||||||
device->client = NULL;
|
device->client = NULL;
|
||||||
|
|
Loading…
Reference in New Issue