+
+float
+CinemaSoundProcessor::db_for_fader_change (float from, float to) const
+{
+ float db = 0;
+
+ if (from < to) {
+ if (from <= _knee) {
+ float const t = min (to, _knee);
+ db += (t - from) * _below;
+ }
+
+ if (to > 4) {
+ float const t = max (from, _knee);
+ db += (to - t) * _above;
+ }
+ } else {
+ if (from >= _knee) {
+ float const t = max (to, _knee);
+ db -= (from - t) * _above;
+ }
+
+ if (to < _knee) {
+ float const t = min (from, _knee);
+ db -= (t - to) * _below;
+ }
+ }
+
+ return db;
+}