Fix build on Rust < 1.50.0

This commit is contained in:
Roderick van Domburg 2021-03-02 20:21:05 +01:00
parent f29e5212c4
commit 1672eb87ab

View file

@ -1263,11 +1263,16 @@ impl PlayerInternal {
}
}
*sample =
(*sample as f64 * actual_normalisation_factor as f64) as f32;
// Extremely sharp attacks, however unlikely, *may* still clip and provide
// undefined results, so strictly enforce output within [-1.0, 1.0].
*sample = (*sample as f64 * actual_normalisation_factor as f64)
.clamp(-1.0, 1.0)
as f32;
if *sample < -1.0 {
*sample = -1.0;
} else if *sample > 1.0 {
*sample = 1.0;
}
}
}
}