aboutsummaryrefslogtreecommitdiffstats
path: root/alc/alc.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-25 05:21:42 -0800
committerChris Robinson <[email protected]>2023-12-25 05:21:42 -0800
commitec914e895ff6d7bf2d19e8c8785e5d8bfd38629f (patch)
tree80a5efc31bbc88d76bce3e7116d27dcf14390870 /alc/alc.cpp
parentdae225e88dbf795e776a2c9f2dbe5bb07c2228b9 (diff)
Use standard methods for rounding
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r--alc/alc.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index d944cf0c..e9d3aed7 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -1025,7 +1025,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
optsrate = clampu(*freqopt, MinOutputRate, MaxOutputRate);
const double scale{static_cast<double>(*optsrate) / double{DefaultOutputRate}};
- period_size = static_cast<uint>(period_size*scale + 0.5);
+ period_size = static_cast<uint>(std::lround(period_size * scale));
}
if(auto persizeopt = device->configValue<uint>({}, "period_size"))
@@ -1330,8 +1330,8 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
freqAttr = clampi(freqAttr, MinOutputRate, MaxOutputRate);
const double scale{static_cast<double>(freqAttr) / oldrate};
- period_size = static_cast<uint>(period_size*scale + 0.5);
- buffer_size = static_cast<uint>(buffer_size*scale + 0.5);
+ period_size = static_cast<uint>(std::lround(period_size * scale));
+ buffer_size = static_cast<uint>(std::lround(buffer_size * scale));
optsrate = static_cast<uint>(freqAttr);
}
}