diff options
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())); } |