Skip to content

Commit

Permalink
Fix off by one error due to rounding sometimes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrechette committed Nov 1, 2017
1 parent 45a9141 commit 42054ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/acl/core/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ namespace acl

inline uint32_t calculate_num_samples(float duration, uint32_t sample_rate)
{
return safe_static_cast<uint32_t>(floor(duration * float(sample_rate))) + 1;
return safe_static_cast<uint32_t>(floor((duration * float(sample_rate)) + 0.5f)) + 1;
}
}

0 comments on commit 42054ce

Please sign in to comment.