1
0
Fork 0

Assert correct values for gain_skew_factor

This commit is contained in:
Robbert van der Helm 2022-07-24 21:06:26 +02:00
parent 2d3b601555
commit 6ee7e8f4e3

View file

@ -48,6 +48,8 @@ impl FloatRange {
/// Calculate a skew factor for [`FloatRange::Skewed`] that makes a linear gain parameter range
/// appear as if it was linear when formatted as decibels.
pub fn gain_skew_factor(min_db: f32, max_db: f32) -> f32 {
nih_debug_assert!(min_db < max_db);
let min_gain = util::db_to_gain(min_db);
let max_gain = util::db_to_gain(max_db);
let middle_db = (max_db + min_db) / 2.0;