Commit dcac32a6 authored by Max Kellermann's avatar Max Kellermann

AudioFormat: add implicit cast to `duration::rep`

Fixes integer truncation bugs (closes #359).
parent 5286477f
......@@ -162,8 +162,9 @@ struct AudioFormat {
template<typename D>
constexpr D FramesToTime(std::uintmax_t size) const noexcept {
using Rep = typename D::rep;
using Period = typename D::period;
return D(((size / Period::num) * Period::den) / sample_rate);
return D(((Rep(1) * size / Period::num) * Period::den) / sample_rate);
}
template<typename D>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment