AudioFormat: add implicit cast to duration::rep
Fixes integer truncation bugs (closes #359).
This commit is contained in:
parent
5286477f73
commit
dcac32a6c4
@ -162,8 +162,9 @@ struct AudioFormat {
|
|||||||
|
|
||||||
template<typename D>
|
template<typename D>
|
||||||
constexpr D FramesToTime(std::uintmax_t size) const noexcept {
|
constexpr D FramesToTime(std::uintmax_t size) const noexcept {
|
||||||
|
using Rep = typename D::rep;
|
||||||
using Period = typename D::period;
|
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>
|
template<typename D>
|
||||||
|
Loading…
Reference in New Issue
Block a user