diff options
-rw-r--r-- | alc/alc.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index ef534182..df1e9c07 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1922,10 +1922,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { freq = maxu(freq, MIN_OUTPUT_RATE); - device->UpdateSize = (device->UpdateSize*freq + device->Frequency/2) / - device->Frequency; - device->BufferSize = (device->BufferSize*freq + device->Frequency/2) / - device->Frequency; + const double scale{static_cast<double>(freq) / device->Frequency}; + device->UpdateSize = static_cast<ALuint>(device->UpdateSize*scale + 0.5); + device->BufferSize = static_cast<ALuint>(device->BufferSize*scale + 0.5); device->Frequency = freq; device->Flags.set<FrequencyRequest>(); |