diff options
author | Chris Robinson <[email protected]> | 2020-09-12 00:47:04 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-09-12 00:47:04 -0700 |
commit | cf298075b54f6b3af9a563097d9d07b9d6aac4a8 (patch) | |
tree | 5c286ca91299d74fdc5ecb63a8246eed6380e9ca /alc/backends/wasapi.cpp | |
parent | 33d91ceeec2f0f8d7f248f97966357388115a995 (diff) |
Round (and clamp) the reftime instead of ceiling it
Diffstat (limited to 'alc/backends/wasapi.cpp')
-rw-r--r-- | alc/backends/wasapi.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index f1f027e6..ff02d83b 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -121,11 +121,11 @@ constexpr DWORD X71Mask{MaskFromTopBits(X7DOT1)}; #define DEVNAME_HEAD "OpenAL Soft on " -/* Scales the given reftime value, ceiling the result. */ +/* Scales the given reftime value, rounding the result. */ inline ALuint RefTime2Samples(const ReferenceTime &val, ALuint srate) { - const auto retval = (val*srate + (seconds{1}-1_reftime)) / seconds{1}; - return static_cast<ALuint>(retval); + const auto retval = (val*srate + ReferenceTime{seconds{1}}/2) / seconds{1}; + return static_cast<ALuint>(mini64(retval, std::numeric_limits<ALuint>::max())); } |