Revert "Fix div/zero, allow switching backends"

This reverts commit 1288262ca7.
This commit is contained in:
Robin Gareus 2021-09-15 17:32:37 +02:00
parent 840e63e6b2
commit cb81b06a5d
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 1 additions and 5 deletions

View File

@ -32,10 +32,6 @@
template<typename T>
T int_div_round (T x, T y)
{
if (y == 0) {
/* usually `y' is sample-rate, or beats/bar */
return (x == 0) ? 0 : 1;
}
/* essentially ((x + (y/2)) / y) but handles signed/negative values correcvtly */
return (x + PBD_IDIV_ROUNDING(x,y)) / y ;
}

View File

@ -35,7 +35,7 @@ typedef int64_t superclock_t;
static superclock_t superclock_ticks_per_second = 508032000; // 2^10 * 3^4 * 5^3 * 7^2
#endif
static inline superclock_t superclock_to_samples (superclock_t s, int sr) { return sr == 0 ? 0 : int_div_round (s * sr, superclock_ticks_per_second); }
static inline superclock_t superclock_to_samples (superclock_t s, int sr) { return int_div_round (s * sr, superclock_ticks_per_second); }
static inline superclock_t samples_to_superclock (int64_t samples, int sr) { return int_div_round (samples * superclock_ticks_per_second, superclock_t (sr)); }
extern int (*sample_rate_callback)();