1
0
Fork 0

Prevent threshold from reaching zero

This commit is contained in:
Robbert van der Helm 2022-07-22 23:36:04 +02:00
parent 8fbdc43ce3
commit 43f86bcc85

View file

@ -528,7 +528,9 @@ impl CompressorBank {
{
let offset = log2_center_freq - log2_freq;
let threshold_db = intercept + (slope * offset) + (curve * offset * offset);
*threshold = util::db_to_gain(threshold_db)
// This threshold may never reach zero as it's used in divisions to get a gain ratio
// above the threshold
*threshold = util::db_to_gain(threshold_db).max(f32::EPSILON);
}
}
@ -545,7 +547,7 @@ impl CompressorBank {
{
let offset = log2_center_freq - log2_freq;
let threshold_db = intercept + (slope * offset) + (curve * offset * offset);
*threshold = util::db_to_gain(threshold_db)
*threshold = util::db_to_gain(threshold_db).max(f32::EPSILON);
}
}