diff options
author | Chris Robinson <[email protected]> | 2012-02-15 22:54:17 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-02-15 22:54:17 -0800 |
commit | 5d17cef55fe291ceed83402c1d2af4da93e0f6d7 (patch) | |
tree | cfc5b44fad35d9630d6be34ff3ab7c01fead78a5 /Alc/backends/mmdevapi.c | |
parent | 70f1a7e3ca35754832dec92dc6c20a42ef08da26 (diff) |
Calculate the buffer time before modifying the frequency
Diffstat (limited to 'Alc/backends/mmdevapi.c')
-rw-r--r-- | Alc/backends/mmdevapi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c index fae14ff9..0c2e00b0 100644 --- a/Alc/backends/mmdevapi.c +++ b/Alc/backends/mmdevapi.c @@ -223,6 +223,9 @@ static HRESULT DoReset(ALCdevice *device) CoTaskMemFree(wfx); wfx = NULL; + buf_time = ((REFERENCE_TIME)device->UpdateSize*device->NumUpdates*10000000 + + device->Frequency-1) / device->Frequency; + if(!(device->Flags&DEVICE_FREQUENCY_REQUEST)) device->Frequency = OutputType.Format.nSamplesPerSec; if(!(device->Flags&DEVICE_CHANNELS_REQUEST)) @@ -391,8 +394,6 @@ static HRESULT DoReset(ALCdevice *device) SetDefaultWFXChannelOrder(device); - buf_time = ((REFERENCE_TIME)device->UpdateSize*device->NumUpdates*10000000 + - device->Frequency-1) / device->Frequency; hr = IAudioClient_Initialize(data->client, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, buf_time, 0, &OutputType.Format, NULL); |